diff options
author | Michi Henning <michi@zeroc.com> | 2005-06-20 12:33:21 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-06-20 12:33:21 +0000 |
commit | 6a715c528373127fb91575fe7daf5b645ccddc7a (patch) | |
tree | 685fecc40472f9bd8481366b59704f6f53aceafe /cpp/src/IceUtil/InputUtil.cpp | |
parent | Updated depends (diff) | |
download | ice-6a715c528373127fb91575fe7daf5b645ccddc7a.tar.bz2 ice-6a715c528373127fb91575fe7daf5b645ccddc7a.tar.xz ice-6a715c528373127fb91575fe7daf5b645ccddc7a.zip |
Another fix for bug 377 -- the string wrapper was incorrect as well.
Diffstat (limited to 'cpp/src/IceUtil/InputUtil.cpp')
-rw-r--r-- | cpp/src/IceUtil/InputUtil.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cpp/src/IceUtil/InputUtil.cpp b/cpp/src/IceUtil/InputUtil.cpp index b6fc2ce7cc2..71829afc1f4 100644 --- a/cpp/src/IceUtil/InputUtil.cpp +++ b/cpp/src/IceUtil/InputUtil.cpp @@ -43,19 +43,20 @@ static IceUtil::Int64 strToInt64Impl(const char* s, char** endptr, int base) { // - // Assume nothing will be there to convert for now + // Skip leading whitespace // - if(endptr) + const char* start = s.c_str(); + while(*start && isspace(*start)) { - *endptr = const_cast<char *>(s); + ++start; } // - // Skip leading whitespace + // Assume nothing will be there to convert for now // - while(*s && isspace(*s)) + if(endptr) { - ++s; + *endptr = const_cast<char *>(s); } // @@ -180,7 +181,15 @@ strToInt64(const char* s, char** endptr, int base) bool stringToInt64(const string& s, Int64& result) { + // + // Skip leading whitespace + // const char* start = s.c_str(); + while(*start && isspace(*start)) + { + ++start; + } + char* end = 0; errno = 0; result = strToInt64(start, &end, 0); |