diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-04-09 20:35:24 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-04-09 20:35:24 +0000 |
commit | bf7f172c1071c95ac39aa77f9e46f3ac1fdf5327 (patch) | |
tree | 9ab51037bdd515c98652efb0aeecf785a3f55131 /cpp/src/IceXML/StreamI.cpp | |
parent | Win32 Fix (diff) | |
download | ice-bf7f172c1071c95ac39aa77f9e46f3ac1fdf5327.tar.bz2 ice-bf7f172c1071c95ac39aa77f9e46f3ac1fdf5327.tar.xz ice-bf7f172c1071c95ac39aa77f9e46f3ac1fdf5327.zip |
fixed bugs with range errors and int64 parsing
Diffstat (limited to 'cpp/src/IceXML/StreamI.cpp')
-rw-r--r-- | cpp/src/IceXML/StreamI.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp index 39fe38546ed..343c99d1547 100644 --- a/cpp/src/IceXML/StreamI.cpp +++ b/cpp/src/IceXML/StreamI.cpp @@ -17,6 +17,7 @@ #include <Ice/Logger.h> #include <Ice/LocalException.h> #include <Ice/ObjectFactory.h> +#include <IceUtil/InputUtil.h> #include <IceXML/StreamI.h> @@ -514,7 +515,7 @@ IceXML::StreamI::readByte(const string& name) string s = toString(child->getNodeValue()); ::Ice::Int i = atoi(s.c_str()); - if(i < -127 || i > 128) + if(i < -128 || i > 127) { throw ::Ice::MarshalException(__FILE__, __LINE__); } @@ -681,7 +682,7 @@ IceXML::StreamI::readShort(const string& name) string s = toString(child->getNodeValue()); ::Ice::Int i = atoi(s.c_str()); - if(i < -32767 || i > 32768) + if(i < -32768 || i > 32767) { throw ::Ice::MarshalException(__FILE__, __LINE__); } @@ -810,7 +811,13 @@ IceXML::StreamI::readLong(const string& name) endRead(); - return atol(s.c_str()); + Ice::Long result; + string::size_type pos; + if(!IceUtil::stringToInt64(s, result, pos)) + { + throw ::Ice::MarshalException(__FILE__, __LINE__); + } + return result; } ::Ice::LongSeq |