fix a couple of implicit signed/unsigned conversions

This commit is contained in:
Dennis Luxen 2014-06-06 18:05:07 +02:00
parent 63ee376f71
commit 0ed9caf969
3 changed files with 16 additions and 16 deletions

View File

@ -68,18 +68,18 @@ inline unsigned parseDuration(const std::string &s)
{
if (1 == result.size())
{
minutes = stringToInt(result[0]);
minutes = StringToUint(result[0]);
}
if (2 == result.size())
{
minutes = stringToInt(result[1]);
hours = stringToInt(result[0]);
minutes = StringToUint(result[1]);
hours = StringToUint(result[0]);
}
if (3 == result.size())
{
seconds = stringToInt(result[2]);
minutes = stringToInt(result[1]);
hours = stringToInt(result[0]);
seconds = StringToUint(result[2]);
minutes = StringToUint(result[1]);
hours = StringToUint(result[0]);
}
return 10 * (3600 * hours + 60 * minutes + seconds);
}

View File

@ -165,17 +165,17 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
if (xmlStrEqual(role, (const xmlChar *)"to") &&
xmlStrEqual(type, (const xmlChar *)"way"))
{
restriction.toWay = stringToUint((const char *)ref);
restriction.toWay = StringToUint((const char *)ref);
}
if (xmlStrEqual(role, (const xmlChar *)"from") &&
xmlStrEqual(type, (const xmlChar *)"way"))
{
restriction.fromWay = stringToUint((const char *)ref);
restriction.fromWay = StringToUint((const char *)ref);
}
if (xmlStrEqual(role, (const xmlChar *)"via") &&
xmlStrEqual(type, (const xmlChar *)"node"))
{
restriction.restriction.viaNode = stringToUint((const char *)ref);
restriction.restriction.viaNode = StringToUint((const char *)ref);
}
if (NULL != type)
@ -229,7 +229,7 @@ ExtractionWay XMLParser::ReadXMLWay()
xmlStrEqual(child_name, (const xmlChar *)"way") == 1)
{
xmlChar *id = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
way.id = stringToUint((char *)id);
way.id = StringToUint((char *)id);
xmlFree(id);
xmlFree(child_name);
break;
@ -263,7 +263,7 @@ ExtractionWay XMLParser::ReadXMLWay()
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
if (ref != NULL)
{
way.path.push_back(stringToUint((const char *)ref));
way.path.push_back(StringToUint((const char *)ref));
xmlFree(ref);
}
}
@ -291,7 +291,7 @@ ImportNode XMLParser::ReadXMLNode()
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
if (attribute != NULL)
{
node.node_id = stringToUint((const char *)attribute);
node.node_id = StringToUint((const char *)attribute);
xmlFree(attribute);
}

View File

@ -96,7 +96,7 @@ static inline void int64ToString(const int64_t value, std::string &output)
boost::spirit::karma::generate(sink, boost::spirit::karma::long_long, value);
}
static inline int stringToInt(const std::string &input)
static inline int StringToInt(const std::string &input)
{
auto first_digit = input.begin();
// Delete any trailing white-spaces
@ -109,7 +109,7 @@ static inline int stringToInt(const std::string &input)
return value;
}
static inline unsigned stringToUint(const std::string &input)
static inline unsigned StringToUint(const std::string &input)
{
auto first_digit = input.begin();
// Delete any trailing white-spaces
@ -117,12 +117,12 @@ static inline unsigned stringToUint(const std::string &input)
{
++first_digit;
}
int value = 0;
unsigned value = 0;
boost::spirit::qi::parse(first_digit, input.end(), boost::spirit::uint_, value);
return value;
}
static inline uint64_t stringToInt64(const std::string &input)
static inline uint64_t StringToInt64(const std::string &input)
{
auto first_digit = input.begin();
// Delete any trailing white-spaces