From c36c0033fd47819deb4d376552034b853200dc07 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 23 May 2016 20:02:36 +0100 Subject: [PATCH] Fixed shadows warnings --- include/osgDB/ExternalFileWriter | 2 +- include/osgDB/XmlParser | 2 +- src/osgDB/ClassInterface.cpp | 20 ++++++++++---------- src/osgDB/DotOsgWrapper.cpp | 6 +++--- src/osgDB/FileUtils.cpp | 15 ++++++--------- src/osgDB/OutputStream.cpp | 3 +-- src/osgDB/PluginQuery.cpp | 14 ++++++++------ src/osgDB/Registry.cpp | 3 ++- src/osgDB/XmlParser.cpp | 4 ++-- 9 files changed, 34 insertions(+), 35 deletions(-) diff --git a/include/osgDB/ExternalFileWriter b/include/osgDB/ExternalFileWriter index 4814edfd4..9f4194f0b 100644 --- a/include/osgDB/ExternalFileWriter +++ b/include/osgDB/ExternalFileWriter @@ -63,7 +63,7 @@ namespace osgDB struct ObjectData { ObjectData() : written(false) {} - ObjectData(const std::string & absolutePath, const std::string & relativePath, bool written) : absolutePath(absolutePath), relativePath(relativePath), written(written) {} + ObjectData(const std::string & in_absolutePath, const std::string & in_relativePath, bool in_written) : absolutePath(in_absolutePath), relativePath(in_relativePath), written(in_written) {} std::string absolutePath; std::string relativePath; bool written; ///< Says if write succeeded or not. diff --git a/include/osgDB/XmlParser b/include/osgDB/XmlParser index e95f0e263..fbe682a93 100644 --- a/include/osgDB/XmlParser +++ b/include/osgDB/XmlParser @@ -149,7 +149,7 @@ class OSGDB_EXPORT XmlNode : public osg::Referenced bool writeChildren(const ControlMap& controlMap, std::ostream& fout, const std::string& indent) const; bool writeProperties(const ControlMap& controlMap, std::ostream& fout) const; - bool readAndReplaceControl(std::string& contents, Input& input); + bool readAndReplaceControl(std::string& in_contents, Input& input) const; }; } diff --git a/src/osgDB/ClassInterface.cpp b/src/osgDB/ClassInterface.cpp index c55741956..c51838cad 100644 --- a/src/osgDB/ClassInterface.cpp +++ b/src/osgDB/ClassInterface.cpp @@ -575,13 +575,13 @@ bool ClassInterface::run(void* objectPtr, const std::string& compoundClassName, ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName); if (!ow) return false; - const ObjectWrapper::MethodObjectMap& methodObjectMap = ow->getMethodObjectMap(); - ObjectWrapper::MethodObjectMap::const_iterator itr = methodObjectMap.find(methodName); - while ((itr!=methodObjectMap.end()) && (itr->first==methodName)) + const ObjectWrapper::MethodObjectMap& ow_methodObjectMap = ow->getMethodObjectMap(); + for(ObjectWrapper::MethodObjectMap::const_iterator itr = ow_methodObjectMap.find(methodName); + (itr!=ow_methodObjectMap.end()) && (itr->first==methodName); + ++itr) { MethodObject* mo = itr->second.get(); if (mo->run(objectPtr, inputParameters, outputParameters)) return true; - ++itr; } const osgDB::StringList& associates = ow->getAssociates(); @@ -593,12 +593,12 @@ bool ClassInterface::run(void* objectPtr, const std::string& compoundClassName, if (aow) { const ObjectWrapper::MethodObjectMap& methodObjectMap = aow->getMethodObjectMap(); - ObjectWrapper::MethodObjectMap::const_iterator itr = methodObjectMap.find(methodName); - while ((itr!=methodObjectMap.end()) && (itr->first==methodName)) + for(ObjectWrapper::MethodObjectMap::const_iterator itr = methodObjectMap.find(methodName); + (itr!=methodObjectMap.end()) && (itr->first==methodName); + ++itr) { MethodObject* mo = itr->second.get(); if (mo->run(objectPtr, inputParameters, outputParameters)) return true; - ++itr; } } } @@ -616,9 +616,9 @@ bool ClassInterface::hasMethod(const std::string& compoundClassName, const std:: ObjectWrapper* ow = osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper(compoundClassName); if (!ow) return false; - const ObjectWrapper::MethodObjectMap& methodObjectMap = ow->getMethodObjectMap(); - ObjectWrapper::MethodObjectMap::const_iterator itr = methodObjectMap.find(methodName); - if (itr!=methodObjectMap.end()) return true; + const ObjectWrapper::MethodObjectMap& ow_methodObjectMap = ow->getMethodObjectMap(); + ObjectWrapper::MethodObjectMap::const_iterator oitr = ow_methodObjectMap.find(methodName); + if (oitr!=ow_methodObjectMap.end()) return true; const osgDB::StringList& associates = ow->getAssociates(); for(osgDB::StringList::const_iterator aitr = associates.begin(); diff --git a/src/osgDB/DotOsgWrapper.cpp b/src/osgDB/DotOsgWrapper.cpp index 94436ef27..9b2f0f350 100644 --- a/src/osgDB/DotOsgWrapper.cpp +++ b/src/osgDB/DotOsgWrapper.cpp @@ -229,8 +229,8 @@ osg::Object* DeprecatedDotOsgWrapperManager::readObjectOfType(const basic_type_w } std::string name = str; - DotOsgWrapperMap::iterator itr = _objectWrapperMap.find(name); - if (itr==_objectWrapperMap.end()) + DotOsgWrapperMap::iterator ow_itr = _objectWrapperMap.find(name); + if (ow_itr==_objectWrapperMap.end()) { // not found so check if a library::class composite name. std::string token = fr[0].getStr(); @@ -256,7 +256,7 @@ osg::Object* DeprecatedDotOsgWrapperManager::readObjectOfType(const basic_type_w } else if (fr[1].isOpenBracket()) { - DotOsgWrapper* wrapper = itr->second.get(); + DotOsgWrapper* wrapper = ow_itr->second.get(); const osg::Object* proto = wrapper->getPrototype(); if (proto==NULL) { diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index 92e90486d..1575efcaa 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -168,13 +168,11 @@ bool osgDB::makeDirectory( const std::string &path ) } } - std::string dir = path; std::stack paths; - while( true ) + for(std::string dir = path; + !dir.empty(); + dir = getFilePath(dir)) { - if( dir.empty() ) - break; - #ifdef OSG_USE_UTF8_FILENAME if( _wstat64( OSGDB_STRING_TO_FILENAME(dir).c_str(), &stbuf ) < 0 ) #else @@ -193,7 +191,6 @@ bool osgDB::makeDirectory( const std::string &path ) return false; } } - dir = getFilePath(std::string(dir)); } while( !paths.empty() ) @@ -1016,7 +1013,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) } appendInstallationLibraryFilePaths(filepath); - + // Since this is currently the only Objective-C code in the // library, we need an autoreleasepool for obj-c memory management. // If more Obj-C is added, we might move this pool to another @@ -1036,7 +1033,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // the Obj-C strings must be converted down to C strings so // C++ can make them into C++ strings. filepath.push_back( [myBundlePlugInPath UTF8String] ); - + // add all application-support-folders NSArray *systemSearchPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSAllDomainsMask, YES); @@ -1117,7 +1114,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths) // Next, check the User's Application Support folder int domains[3] = { kUserDomain, kLocalDomain, kNetworkDomain }; - + for(unsigned int domain_ndx = 0; domain_ndx < 3; ++domain_ndx) { errCode = FSFindFolder( domains[domain_ndx], kApplicationSupportFolderType, kDontCreateFolder, &f ); diff --git a/src/osgDB/OutputStream.cpp b/src/osgDB/OutputStream.cpp index 993f3c209..98efa9f9e 100644 --- a/src/osgDB/OutputStream.cpp +++ b/src/osgDB/OutputStream.cpp @@ -499,8 +499,7 @@ void OutputStream::writeImage( const osg::Image* img ) *this << img->getAllocationMode(); // _allocationMode // _data - unsigned int size = img->getTotalSizeInBytesIncludingMipmaps(); - writeSize(size); + writeSize( static_cast(img->getTotalSizeInBytesIncludingMipmaps()) ); for(osg::Image::DataIterator img_itr(img); img_itr.valid(); ++img_itr) { diff --git a/src/osgDB/PluginQuery.cpp b/src/osgDB/PluginQuery.cpp index 650bfe8f8..8c649218e 100644 --- a/src/osgDB/PluginQuery.cpp +++ b/src/osgDB/PluginQuery.cpp @@ -54,13 +54,15 @@ bool osgDB::queryPlugin(const std::string& fileName, ReaderWriterInfoList& infoL typedef std::set ReaderWriterSet; ReaderWriterSet previouslyLoadedReaderWriters; - const Registry::ReaderWriterList& rwList = osgDB::Registry::instance()->getReaderWriterList(); - for(Registry::ReaderWriterList::const_iterator itr = rwList.begin(); - itr != rwList.end(); - ++itr) { - const ReaderWriter* rw = itr->get(); - previouslyLoadedReaderWriters.insert(rw); + const Registry::ReaderWriterList& rwList = osgDB::Registry::instance()->getReaderWriterList(); + for(Registry::ReaderWriterList::const_iterator itr = rwList.begin(); + itr != rwList.end(); + ++itr) + { + const ReaderWriter* rw = itr->get(); + previouslyLoadedReaderWriters.insert(rw); + } } if (osgDB::Registry::instance()->loadLibrary(fileName)) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 271b73090..557f639e5 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1092,6 +1092,7 @@ std::string Registry::findLibraryFileImplementation(const std::string& filename, const FilePathList& filepath = Registry::instance()->getLibraryFilePathList(); + std::string fileFound = findFileInPath(filename, filepath,caseSensitivity); if (!fileFound.empty()) return fileFound; @@ -1106,7 +1107,7 @@ std::string Registry::findLibraryFileImplementation(const std::string& filename, std::string simpleFileName = getSimpleFileName(filename); if (simpleFileName!=filename) { - std::string fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); + fileFound = findFileInPath(simpleFileName, filepath,caseSensitivity); if (!fileFound.empty()) return fileFound; } diff --git a/src/osgDB/XmlParser.cpp b/src/osgDB/XmlParser.cpp index 450de4dd1..c1ca76e51 100644 --- a/src/osgDB/XmlParser.cpp +++ b/src/osgDB/XmlParser.cpp @@ -522,7 +522,7 @@ bool XmlNode::writeProperties(const ControlMap& controlMap, std::ostream& fout) return true; } -bool XmlNode::readAndReplaceControl(std::string& contents, XmlNode::Input& input) +bool XmlNode::readAndReplaceControl(std::string& in_contents, XmlNode::Input& input) const { int c = 0; std::string value; @@ -533,7 +533,7 @@ bool XmlNode::readAndReplaceControl(std::string& contents, XmlNode::Input& input { c = input._controlToCharacterMap[value]; OSG_INFO<<"Read control character "<