[Easysoap-checkins] CVS: easysoap/src SOAPTypeTraits.cpp,1.18,1.19
Status: Beta
Brought to you by:
dcrowley
From: David C. <dcr...@us...> - 2004-10-12 01:37:57
|
Update of /cvsroot/easysoap/easysoap/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25925/src Modified Files: SOAPTypeTraits.cpp Log Message: Fix unsigned int deserialization. Patch 1044948. Index: SOAPTypeTraits.cpp =================================================================== RCS file: /cvsroot/easysoap/easysoap/src/SOAPTypeTraits.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- SOAPTypeTraits.cpp 2 Jun 2004 06:33:05 -0000 1.18 +++ SOAPTypeTraits.cpp 12 Oct 2004 01:37:46 -0000 1.19 @@ -73,6 +73,32 @@ } +static int +sp_strtoul(const char *str) +{ + char *endptr = 0; + const char *startptr = str; + int ret; + + errno = 0; + ret = strtoul(startptr, &endptr, 10); + + if (endptr) + { + while (sp_isspace(*endptr)) + ++endptr; + + if (startptr == endptr || *endptr != 0) + throw SOAPException("Could not convert string to unsigned integer: '%s'", + str); + } + if (errno == ERANGE) + throw SOAPException("Unsigned integer overflow: %s", str); + + return ret; +} + + // // TODO: This is too tricky. We need to find a // portable and nice way to return NAN. @@ -312,7 +338,7 @@ if (param.IsNull() || str.IsEmpty()) throw SOAPException("Cannot convert null value to unsigned integer."); - val = sp_strtol(str); + val = sp_strtoul(str); return param; } |