Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building gdal, dae, ffmpeg and obj plugins with /std:c++17 msvc flag #1246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/osgPlugins/dae/ReaderWriterDAE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define SERIALIZER() OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex)

#if __cplusplus > 199711L
#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L)
#define smart_ptr std::unique_ptr
#else
#define smart_ptr std::auto_ptr
Expand Down
9 changes: 7 additions & 2 deletions src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

#define STREAM_TIMEOUT_IN_SECONDS_TO_CONSIDER_IT_DEAD 10

#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L)
#define smart_ptr std::unique_ptr
#else
#define smart_ptr std::auto_ptr
#endif

namespace osgFFmpeg {

Expand All @@ -23,8 +28,8 @@ FFmpegImageStream::FFmpegImageStream() :
{
setOrigin(osg::Image::TOP_LEFT);

std::auto_ptr<FFmpegDecoder> decoder(new FFmpegDecoder);
std::auto_ptr<CommandQueue> commands(new CommandQueue);
smart_ptr<FFmpegDecoder> decoder(new FFmpegDecoder);
smart_ptr<CommandQueue> commands(new CommandQueue);

m_decoder = decoder.release();
m_commands = commands.release();
Expand Down
10 changes: 8 additions & 2 deletions src/osgPlugins/gdal/ReaderWriterGDAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

#define SERIALIZER() OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex)

#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L)
#define smart_ptr std::unique_ptr
#else
#define smart_ptr std::auto_ptr
#endif

// From easyrgb.com
float Hue_2_RGB( float v1, float v2, float vH )
{
Expand Down Expand Up @@ -123,7 +129,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter

initGDAL();

std::auto_ptr<GDALDataset> dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly));
smart_ptr<GDALDataset> dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly));
if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED;

int dataWidth = dataset->GetRasterXSize();
Expand Down Expand Up @@ -577,7 +583,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter

initGDAL();

std::auto_ptr<GDALDataset> dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly));
smart_ptr<GDALDataset> dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly));
if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED;

int dataWidth = dataset->GetRasterXSize();
Expand Down
13 changes: 9 additions & 4 deletions src/osgPlugins/obj/obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ using namespace obj;

static std::string strip( const std::string& ss )
{
std::string result;
result.assign( std::find_if( ss.begin(), ss.end(), std::not1( std::ptr_fun< int, int >( isspace ) ) ),
std::find_if( ss.rbegin(), ss.rend(), std::not1( std::ptr_fun< int, int >( isspace ) ) ).base() );
return( result );
std::string::const_iterator it = ss.begin();
while (it != ss.end() && isspace(*it))
it++;

std::string::const_reverse_iterator rit = ss.rbegin();
while (rit.base() != it && isspace(*rit))
rit++;

return std::string(it, rit.base());
}

/*
Expand Down