use size_t for GeneratorExpressionContent::ContentLength to fix some warnings

CMake/Source/cmGeneratorExpressionParser.cxx: In member function ‘void cmGeneratorExpressionParser::ParseGeneratorExpression(std::vector<cmGeneratorExpressionEvaluator*>&)’:
CMake/Source/cmGeneratorExpressionParser.cxx:116:55: warning: conversion to ‘unsigned int’ from ‘long int’ may alter its value [-Wconversion]
CMake/Source/cmGeneratorExpressionParser.cxx:240:39: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
This commit is contained in:
Rolf Eike Beer 2013-10-21 19:18:16 +02:00
parent bf02e75079
commit a80fe4b1d2
4 changed files with 10 additions and 10 deletions

View File

@ -1446,7 +1446,7 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
GeneratorExpressionContent::GeneratorExpressionContent( GeneratorExpressionContent::GeneratorExpressionContent(
const char *startContent, const char *startContent,
unsigned int length) size_t length)
: StartContent(startContent), ContentLength(length) : StartContent(startContent), ContentLength(length)
{ {

View File

@ -63,7 +63,7 @@ private:
struct TextContent : public cmGeneratorExpressionEvaluator struct TextContent : public cmGeneratorExpressionEvaluator
{ {
TextContent(const char *start, unsigned int length) TextContent(const char *start, size_t length)
: Content(start), Length(length) : Content(start), Length(length)
{ {
@ -80,25 +80,25 @@ struct TextContent : public cmGeneratorExpressionEvaluator
return cmGeneratorExpressionEvaluator::Text; return cmGeneratorExpressionEvaluator::Text;
} }
void Extend(unsigned int length) void Extend(size_t length)
{ {
this->Length += length; this->Length += length;
} }
unsigned int GetLength() size_t GetLength()
{ {
return this->Length; return this->Length;
} }
private: private:
const char *Content; const char *Content;
unsigned int Length; size_t Length;
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
{ {
GeneratorExpressionContent(const char *startContent, unsigned int length); GeneratorExpressionContent(const char *startContent, size_t length);
void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier) void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier)
{ {
this->IdentifierChildren = identifier; this->IdentifierChildren = identifier;
@ -141,7 +141,7 @@ private:
std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren; std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren; std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;
const char *StartContent; const char *StartContent;
unsigned int ContentLength; size_t ContentLength;
}; };
#endif #endif

View File

@ -19,7 +19,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
struct cmGeneratorExpressionToken struct cmGeneratorExpressionToken
{ {
cmGeneratorExpressionToken(unsigned type, const char *c, unsigned l) cmGeneratorExpressionToken(unsigned type, const char *c, size_t l)
: TokenType(type), Content(c), Length(l) : TokenType(type), Content(c), Length(l)
{ {
} }
@ -32,7 +32,7 @@ struct cmGeneratorExpressionToken
}; };
unsigned TokenType; unsigned TokenType;
const char *Content; const char *Content;
unsigned Length; size_t Length;
}; };
/** \class cmGeneratorExpressionLexer /** \class cmGeneratorExpressionLexer

View File

@ -235,7 +235,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
return; return;
} }
int contentLength = ((this->it - 1)->Content size_t contentLength = ((this->it - 1)->Content
- startToken->Content) - startToken->Content)
+ (this->it - 1)->Length; + (this->it - 1)->Length;
GeneratorExpressionContent *content = new GeneratorExpressionContent( GeneratorExpressionContent *content = new GeneratorExpressionContent(