Skip to content
Permalink
Browse files
Remove usages of std::auto_ptr to get rid of warnings when building with
gcc 8.2+
  • Loading branch information
therocode authored and eXpl0it3r committed Jan 23, 2019
1 parent 353c846 commit bf92efe9a4035fee0258386173d53556aa196e49
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/SFML/Audio/AudioDevice.cpp
@@ -29,7 +29,7 @@
#include <SFML/Audio/ALCheck.hpp>
#include <SFML/Audio/Listener.hpp>
#include <SFML/System/Err.hpp>
#include <memory>
#include <vector>


namespace
@@ -107,9 +107,13 @@ bool AudioDevice::isExtensionSupported(const std::string& extension)
// This device will not be used in this function and merely
// makes sure there is a valid OpenAL device for extension
// queries if none has been created yet.
std::auto_ptr<AudioDevice> device;
//
// Using an std::vector for this since auto_ptr is deprecated
// and we have no better STL facility for dynamically allocating
// a temporary instance with strong exception guarantee.
std::vector<AudioDevice> device;
if (!audioDevice)
device.reset(new AudioDevice);
device.resize(1);

if ((extension.length() > 2) && (extension.substr(0, 3) == "ALC"))
return alcIsExtensionPresent(audioDevice, extension.c_str()) != AL_FALSE;
@@ -125,9 +129,13 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount)
// This device will not be used in this function and merely
// makes sure there is a valid OpenAL device for format
// queries if none has been created yet.
std::auto_ptr<AudioDevice> device;
//
// Using an std::vector for this since auto_ptr is deprecated
// and we have no better STL facility for dynamically allocating
// a temporary instance with strong exception guarantee.
std::vector<AudioDevice> device;
if (!audioDevice)
device.reset(new AudioDevice);
device.resize(1);

// Find the good format according to the number of channels
int format = 0;

0 comments on commit bf92efe

Please sign in to comment.