diff --git a/src/osgPlugins/dicom/ReaderWriterDICOM.cpp b/src/osgPlugins/dicom/ReaderWriterDICOM.cpp index dd7e7be90..9512b9d05 100644 --- a/src/osgPlugins/dicom/ReaderWriterDICOM.cpp +++ b/src/osgPlugins/dicom/ReaderWriterDICOM.cpp @@ -119,9 +119,7 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter typedef std::vector Files; bool getDicomFilesInDirectory(const std::string& path, Files& files) const { - osgDB::DirectoryContents contents = osgDB::getDirectoryContents(path); - - std::sort(contents.begin(), contents.end()); + osgDB::DirectoryContents contents = osgDB::getSortedDirectoryContents(path); for(osgDB::DirectoryContents::iterator itr = contents.begin(); itr != contents.end(); diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index a946568d1..cdb91cbd4 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -857,54 +857,6 @@ osg::Geometry* SlideShowConstructor::createTexturedQuadGeometry(const osg::Vec3& return pictureQuad; } -struct FileNameComparator -{ - bool operator() (const std::string& lhs, const std::string& rhs) const - { - std::string::size_type size_lhs = lhs.size(); - std::string::size_type size_rhs = rhs.size(); - std::string::size_type pos_lhs = 0; - std::string::size_type pos_rhs = 0; - while(pos_lhs='0' && lhs[pos_lhs]<='9'; - bool numeric_rhs = rhs[pos_rhs]>='0' && rhs[pos_rhs]<='9'; - if (numeric_lhs && numeric_rhs) - { - std::string::size_type start_lhs = pos_lhs; - ++pos_lhs; - while(pos_lhs='0' && lhs[pos_lhs]<='9')) ++pos_lhs; - - std::string::size_type start_rhs = pos_rhs; - ++pos_rhs; - while(pos_rhs='0' && rhs[pos_rhs]<='9')) ++pos_rhs; - - if (pos_lhsrhs[start_rhs]) return false; - ++start_lhs; - ++start_rhs; - } - } - else - { - if (c_lhs imageSequence = new osg::ImageSequence; @@ -1954,7 +1906,7 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position if (filenames.empty()) return; // make sure images are in alphabetical order. - std::sort(filenames.begin(), filenames.end()); + std::sort(filenames.begin(), filenames.end(), osgDB::FileNameComparator()); typedef std::vector< osg::ref_ptr > Images; Images images;