From Ulrich Hertlein, "Attached is a patch that introduces 'static_cast<unsigned int>' on some instances where

the code returns '.size()' of a std::vector.  This caused some warnings when using clang++
on OS X."
This commit is contained in:
Robert Osfield 2013-05-14 16:12:21 +00:00
parent 93eb471d99
commit 1a683e2f83
16 changed files with 32 additions and 32 deletions

View File

@ -406,8 +406,8 @@ class OSG_EXPORT GLBufferObjectSet : public Referenced
unsigned int computeNumGLBufferObjectsInList() const; unsigned int computeNumGLBufferObjectsInList() const;
unsigned int getNumOfGLBufferObjects() const { return _numOfGLBufferObjects; } unsigned int getNumOfGLBufferObjects() const { return _numOfGLBufferObjects; }
unsigned int getNumOrphans() const { return _orphanedGLBufferObjects.size(); } unsigned int getNumOrphans() const { return static_cast<unsigned int>(_orphanedGLBufferObjects.size()); }
unsigned int getNumPendingOrphans() const { return _pendingOrphanedGLBufferObjects.size(); } unsigned int getNumPendingOrphans() const { return static_cast<unsigned int>(_pendingOrphanedGLBufferObjects.size()); }
protected: protected:
@ -565,7 +565,7 @@ class OSG_EXPORT BufferObject : public Object
BufferData* getBufferData(unsigned int index) { return _bufferDataList[index]; } BufferData* getBufferData(unsigned int index) { return _bufferDataList[index]; }
const BufferData* getBufferData(unsigned int index) const { return _bufferDataList[index]; } const BufferData* getBufferData(unsigned int index) const { return _bufferDataList[index]; }
unsigned int getNumBufferData() const { return _bufferDataList.size(); } unsigned int getNumBufferData() const { return static_cast<unsigned int>(_bufferDataList.size()); }
void setGLBufferObject(unsigned int contextID, GLBufferObject* glbo) { _glBufferObjects[contextID] = glbo; } void setGLBufferObject(unsigned int contextID, GLBufferObject* glbo) { _glBufferObjects[contextID] = glbo; }

View File

@ -90,7 +90,7 @@ class OSG_EXPORT Geode : public Node
/** Return the number of <tt>Drawable</tt>s currently attached to the /** Return the number of <tt>Drawable</tt>s currently attached to the
* \c Geode. * \c Geode.
*/ */
inline unsigned int getNumDrawables() const { return _drawables.size(); } inline unsigned int getNumDrawables() const { return static_cast<unsigned int>(_drawables.size()); }
/** Return the \c Drawable at position \c i.*/ /** Return the \c Drawable at position \c i.*/
inline Drawable* getDrawable( unsigned int i ) { return _drawables[i].get(); } inline Drawable* getDrawable( unsigned int i ) { return _drawables[i].get(); }
@ -121,7 +121,7 @@ class OSG_EXPORT Geode : public Node
{ {
if (_drawables[drawableNum]==drawable) return drawableNum; if (_drawables[drawableNum]==drawable) return drawableNum;
} }
return _drawables.size(); // drawable not found. return static_cast<unsigned int>(_drawables.size()); // drawable not found.
} }
/** Get the list of drawables.*/ /** Get the list of drawables.*/

View File

@ -112,7 +112,7 @@ class OSG_EXPORT LOD : public Group
/** returns the number of ranges currently set. /** returns the number of ranges currently set.
* An LOD which has been fully set up will have getNumChildren()==getNumRanges(). */ * An LOD which has been fully set up will have getNumChildren()==getNumRanges(). */
inline unsigned int getNumRanges() const { return _rangeList.size(); } inline unsigned int getNumRanges() const { return static_cast<unsigned int>(_rangeList.size()); }
/** set the list of MinMax ranges for each child.*/ /** set the list of MinMax ranges for each child.*/
inline void setRangeList(const RangeList& rangeList) { _rangeList=rangeList; } inline void setRangeList(const RangeList& rangeList) { _rangeList=rangeList; }

View File

@ -82,35 +82,35 @@ class OSG_EXPORT PagedLOD : public LOD
void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; } void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; }
const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; } const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; }
unsigned int getNumFileNames() const { return _perRangeDataList.size(); } unsigned int getNumFileNames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setPriorityOffset(unsigned int childNo, float priorityOffset) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityOffset=priorityOffset; } void setPriorityOffset(unsigned int childNo, float priorityOffset) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityOffset=priorityOffset; }
float getPriorityOffset(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityOffset; } float getPriorityOffset(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityOffset; }
unsigned int getNumPriorityOffsets() const { return _perRangeDataList.size(); } unsigned int getNumPriorityOffsets() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setPriorityScale(unsigned int childNo, float priorityScale) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityScale=priorityScale; } void setPriorityScale(unsigned int childNo, float priorityScale) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityScale=priorityScale; }
float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; } float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; }
unsigned int getNumPriorityScales() const { return _perRangeDataList.size(); } unsigned int getNumPriorityScales() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
/** Sets the minimum amount of time, in seconds, that must pass without a child being traversed before it can be expired. */ /** Sets the minimum amount of time, in seconds, that must pass without a child being traversed before it can be expired. */
void setMinimumExpiryTime(unsigned int childNo, double minTime) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryTime=minTime; } void setMinimumExpiryTime(unsigned int childNo, double minTime) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryTime=minTime; }
double getMinimumExpiryTime(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryTime; } double getMinimumExpiryTime(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryTime; }
unsigned int getNumMinimumExpiryTimes() const { return _perRangeDataList.size(); } unsigned int getNumMinimumExpiryTimes() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
/** Sets the minimum number of frames that must be rendered without a child being traversed before it can be expired. */ /** Sets the minimum number of frames that must be rendered without a child being traversed before it can be expired. */
void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryFrames=minFrames; } void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryFrames=minFrames; }
unsigned int getMinimumExpiryFrames(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryFrames; } unsigned int getMinimumExpiryFrames(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryFrames; }
unsigned int getNumMinimumExpiryFrames() const { return _perRangeDataList.size(); } unsigned int getNumMinimumExpiryFrames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setTimeStamp(unsigned int childNo, double timeStamp) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._timeStamp=timeStamp; } void setTimeStamp(unsigned int childNo, double timeStamp) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._timeStamp=timeStamp; }
double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; } double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; }
unsigned int getNumTimeStamps() const { return _perRangeDataList.size(); } unsigned int getNumTimeStamps() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; } void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; }
unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; } unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; }
unsigned int getNumFrameNumbers() const { return _perRangeDataList.size(); } unsigned int getNumFrameNumbers() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
/** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests /** Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests

View File

@ -158,7 +158,7 @@ class OSG_EXPORT Program : public osg::StateAttribute
GLenum getFormat() const {return _format;} GLenum getFormat() const {return _format;}
/** Get the size of the program binary data.*/ /** Get the size of the program binary data.*/
unsigned int getSize() const { return _data.size(); } unsigned int getSize() const { return static_cast<unsigned int>(_data.size()); }
/** Get a ptr to the program binary data.*/ /** Get a ptr to the program binary data.*/
unsigned char* getData() { return _data.empty() ? 0 : &(_data.front()); } unsigned char* getData() { return _data.empty() ? 0 : &(_data.front()); }

View File

@ -53,7 +53,7 @@ class OSG_EXPORT ShaderBinary : public osg::Object
void assign(unsigned int size, const unsigned char* data); void assign(unsigned int size, const unsigned char* data);
/** Get the size of the shader binary data.*/ /** Get the size of the shader binary data.*/
unsigned int getSize() const { return _data.size(); } unsigned int getSize() const { return static_cast<unsigned int>(_data.size()); }
/** Get a ptr to the shader binary data.*/ /** Get a ptr to the shader binary data.*/
unsigned char* getData() { return _data.empty() ? 0 : &(_data.front()); } unsigned char* getData() { return _data.empty() ? 0 : &(_data.front()); }
@ -294,7 +294,7 @@ class OSG_EXPORT ShaderComponent : public osg::Object
osg::Shader* getShader(unsigned int i) { return _shaders[i].get(); } osg::Shader* getShader(unsigned int i) { return _shaders[i].get(); }
const osg::Shader* getShader(unsigned int i) const { return _shaders[i].get(); } const osg::Shader* getShader(unsigned int i) const { return _shaders[i].get(); }
unsigned int getNumShaders() const { return _shaders.size(); } unsigned int getNumShaders() const { return static_cast<unsigned int>(_shaders.size()); }
virtual void compileGLObjects(State& state) const; virtual void compileGLObjects(State& state) const;
virtual void resizeGLObjectBuffers(unsigned int maxSize); virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@ -220,7 +220,7 @@ class OSG_EXPORT StateSet : public Object
inline const TextureModeList& getTextureModeList() const { return _textureModeList; } inline const TextureModeList& getTextureModeList() const { return _textureModeList; }
/** Return the number texture units active in the TextureModeList.*/ /** Return the number texture units active in the TextureModeList.*/
inline unsigned int getNumTextureModeLists() const { return _textureModeList.size(); } inline unsigned int getNumTextureModeLists() const { return static_cast<unsigned int>(_textureModeList.size()); }
typedef std::vector<AttributeList> TextureAttributeList; typedef std::vector<AttributeList> TextureAttributeList;
@ -257,7 +257,7 @@ class OSG_EXPORT StateSet : public Object
inline const TextureAttributeList& getTextureAttributeList() const { return _textureAttributeList; } inline const TextureAttributeList& getTextureAttributeList() const { return _textureAttributeList; }
/** Return the number of texture units active in the TextureAttributeList.*/ /** Return the number of texture units active in the TextureAttributeList.*/
inline unsigned int getNumTextureAttributeLists() const { return _textureAttributeList.size(); } inline unsigned int getNumTextureAttributeLists() const { return static_cast<unsigned int>(_textureAttributeList.size()); }
void setAssociatedModes(const StateAttribute* attribute, StateAttribute::GLModeValue value); void setAssociatedModes(const StateAttribute* attribute, StateAttribute::GLModeValue value);

View File

@ -1276,8 +1276,8 @@ class OSG_EXPORT Texture : public osg::StateAttribute
unsigned int computeNumTextureObjectsInList() const; unsigned int computeNumTextureObjectsInList() const;
unsigned int getNumOfTextureObjects() const { return _numOfTextureObjects; } unsigned int getNumOfTextureObjects() const { return _numOfTextureObjects; }
unsigned int getNumOrphans() const { return _orphanedTextureObjects.size(); } unsigned int getNumOrphans() const { return static_cast<unsigned int>(_orphanedTextureObjects.size()); }
unsigned int getNumPendingOrphans() const { return _pendingOrphanedTextureObjects.size(); } unsigned int getNumPendingOrphans() const { return static_cast<unsigned int>(_pendingOrphanedTextureObjects.size()); }
protected: protected:

View File

@ -661,7 +661,7 @@ class OSG_EXPORT Uniform : public Object
* Get the number of parents of this Uniform. * Get the number of parents of this Uniform.
* @return the number of parents of this Uniform. * @return the number of parents of this Uniform.
*/ */
inline unsigned int getNumParents() const { return _parents.size(); } inline unsigned int getNumParents() const { return static_cast<unsigned int>(_parents.size()); }
/** convenient scalar (non-array) value assignment */ /** convenient scalar (non-array) value assignment */

View File

@ -134,7 +134,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
const DatabaseThread* getDatabaseThread(unsigned int i) const { return _databaseThreads[i].get(); } const DatabaseThread* getDatabaseThread(unsigned int i) const { return _databaseThreads[i].get(); }
unsigned int getNumDatabaseThreads() const { return _databaseThreads.size(); } unsigned int getNumDatabaseThreads() const { return static_cast<unsigned int>(_databaseThreads.size()); }
/** Set whether the database pager thread should be paused or not.*/ /** Set whether the database pager thread should be paused or not.*/
void setDatabasePagerThreadPause(bool pause); void setDatabasePagerThreadPause(bool pause);
@ -245,13 +245,13 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual void updateSceneGraph(const osg::FrameStamp& frameStamp); virtual void updateSceneGraph(const osg::FrameStamp& frameStamp);
/** Report how many items are in the _fileRequestList queue */ /** Report how many items are in the _fileRequestList queue */
unsigned int getFileRequestListSize() const { return _fileRequestQueue->size() + _httpRequestQueue->size(); } unsigned int getFileRequestListSize() const { return static_cast<unsigned int>(_fileRequestQueue->size() + _httpRequestQueue->size()); }
/** Report how many items are in the _dataToCompileList queue */ /** Report how many items are in the _dataToCompileList queue */
unsigned int getDataToCompileListSize() const { return _dataToCompileList->size(); } unsigned int getDataToCompileListSize() const { return static_cast<unsigned int>(_dataToCompileList->size()); }
/** Report how many items are in the _dataToMergeList queue */ /** Report how many items are in the _dataToMergeList queue */
unsigned int getDataToMergeListSize() const { return _dataToMergeList->size(); } unsigned int getDataToMergeListSize() const { return static_cast<unsigned int>(_dataToMergeList->size()); }
/** Report whether any requests are in the pager.*/ /** Report whether any requests are in the pager.*/
bool getRequestsInProgress() const; bool getRequestsInProgress() const;

View File

@ -72,7 +72,7 @@ class OSGDB_EXPORT ImagePager : public osg::NodeVisitor::ImageRequestHandler
const ImageThread* getImageThread(unsigned int i) const { return _imageThreads[i].get(); } const ImageThread* getImageThread(unsigned int i) const { return _imageThreads[i].get(); }
unsigned int getNumImageThreads() const { return _imageThreads.size(); } unsigned int getNumImageThreads() const { return static_cast<unsigned int>(_imageThreads.size()); }
void setPreLoadTime(double preLoadTime) { _preLoadTime=preLoadTime; } void setPreLoadTime(double preLoadTime) { _preLoadTime=preLoadTime; }

View File

@ -175,7 +175,7 @@ class OSGDB_EXPORT Options : public osg::Object
void removePluginData(const std::string& s) const { _pluginData.erase(s); } void removePluginData(const std::string& s) const { _pluginData.erase(s); }
/** Get number of PluginData values */ /** Get number of PluginData values */
unsigned int getNumPluginData() const { return _pluginData.size(); } unsigned int getNumPluginData() const { return static_cast<unsigned int>(_pluginData.size()); }
/** Sets a plugindata value PluginData with a string */ /** Sets a plugindata value PluginData with a string */
@ -195,7 +195,7 @@ class OSGDB_EXPORT Options : public osg::Object
void removePluginStringData(const std::string& s) const { _pluginStringData.erase(s); } void removePluginStringData(const std::string& s) const { _pluginStringData.erase(s); }
/** Get number of PluginStrData values */ /** Get number of PluginStrData values */
unsigned int getNumPluginStringData() const { return _pluginStringData.size(); } unsigned int getNumPluginStringData() const { return static_cast<unsigned int>(_pluginStringData.size()); }
/** Parse string into plugin string data. This will be automatically done in Options(const std::string&) */ /** Parse string into plugin string data. This will be automatically done in Options(const std::string&) */
void parsePluginStringData(const std::string& str, char separator1=' ', char separator2='='); void parsePluginStringData(const std::string& str, char separator1=' ', char separator2='=');

View File

@ -40,7 +40,7 @@ public:
typedef std::map<Value, std::string> ValueToString; typedef std::map<Value, std::string> ValueToString;
IntLookup() {} IntLookup() {}
unsigned int size() const { return _stringToValue.size(); } unsigned int size() const { return static_cast<unsigned int>(_stringToValue.size()); }
void add( const char* str, Value value ) void add( const char* str, Value value )
{ {

View File

@ -416,7 +416,7 @@ public:
META_Object(osgGA, TouchData); META_Object(osgGA, TouchData);
unsigned int getNumTouchPoints() const { return _touches.size(); } unsigned int getNumTouchPoints() const { return static_cast<unsigned int>(_touches.size()); }
iterator begin() { return _touches.begin(); } iterator begin() { return _touches.begin(); }
const_iterator begin() const { return _touches.begin(); } const_iterator begin() const { return _touches.begin(); }

View File

@ -526,7 +526,7 @@ class OSGTERRAIN_EXPORT CompositeLayer : public Layer
void removeLayer(unsigned int i) { _layers.erase(_layers.begin()+i); } void removeLayer(unsigned int i) { _layers.erase(_layers.begin()+i); }
unsigned int getNumLayers() const { return _layers.size(); } unsigned int getNumLayers() const { return static_cast<unsigned int>(_layers.size()); }
protected: protected:

View File

@ -139,7 +139,7 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
const Layer* getColorLayer(unsigned int i) const { return i<_colorLayers.size() ? _colorLayers[i].get() : 0; } const Layer* getColorLayer(unsigned int i) const { return i<_colorLayers.size() ? _colorLayers[i].get() : 0; }
/** Get the number of colour layers.*/ /** Get the number of colour layers.*/
unsigned int getNumColorLayers() const { return _colorLayers.size(); } unsigned int getNumColorLayers() const { return static_cast<unsigned int>(_colorLayers.size()); }
/** Set hint to whether the TerrainTechnique should create per vertex normals for lighting purposes.*/ /** Set hint to whether the TerrainTechnique should create per vertex normals for lighting purposes.*/