From f4d268636a02346acc46c993666fe02bbc1ff0b8 Mon Sep 17 00:00:00 2001 From: Tycho Date: Wed, 13 Aug 2014 13:37:07 +0100 Subject: Fixed comments --- src/StringUtils.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/StringUtils.h b/src/StringUtils.h index 30a193845..a78f8b0bf 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -100,12 +100,12 @@ extern int GetBEInt(const char * a_Mem); /// Writes four bytes to the specified memory location so that they interpret as BigEndian int extern void SetBEInt(char * a_Mem, Int32 a_Value); -/// Parses any integer type. Checks bounds and +/// Parses any integer type. Checks bounds and returns errors out of band. template -bool StringToInteger(AString a_str, T& a_Num) +bool StringToInteger(const AString& a_str, T& a_Num) { size_t i = 0; - T positive = true; + bool positive = true; T result = 0; if (a_str[0] == '+') { @@ -118,7 +118,7 @@ bool StringToInteger(AString a_str, T& a_Num) } if (positive) { - for(; i <= a_str.size(); i++) + for(size_t size = a_str.size(); i < size; i++) { if ((a_str[i] <= '0') || (a_str[i] >= '9')) { @@ -139,7 +139,7 @@ bool StringToInteger(AString a_str, T& a_Num) } else { - for(; i <= a_str.size(); i++) + for(size_t size = a_str.size(); i < size; i++) { if ((a_str[i] <= '0') || (a_str[i] >= '9')) { -- cgit v1.2.3