diff options
Diffstat (limited to 'src/Common/XmlPacket.cpp')
-rw-r--r-- | src/Common/XmlPacket.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/Common/XmlPacket.cpp b/src/Common/XmlPacket.cpp index dbd3fc7..ff8ca6a 100644 --- a/src/Common/XmlPacket.cpp +++ b/src/Common/XmlPacket.cpp @@ -101,6 +101,7 @@ XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) { } str = (char*)content; + std::istringstream buf(str); if(!xmlStrcmp(typestr, (xmlChar*)"binary")) { type = BINARY; @@ -109,31 +110,52 @@ XmlPacket::Element::Element(xmlNodePtr node) : elementNode(node), type(NONE) { } else if(!xmlStrcmp(typestr, (xmlChar*)"int")) { type = INT; - value = std::strtol((char*)content, 0, 10); + + long tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"uint")) { type = UINT; - value = std::strtoul((char*)content, 0, 10); + + unsigned long tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"int64")) { type = INT64; - value = std::strtoll((char*)content, 0, 10); + + long long tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"uint64")) { type = UINT64; - value = std::strtoull((char*)content, 0, 10); + + unsigned long long tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"float")) { type = FLOAT; - value = std::strtof((char*)content, 0); + + float tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"double")) { type = DOUBLE; - value = std::strtod((char*)content, 0); + + double tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"longdouble")) { type = LONGDOUBLE; - value = std::strtold((char*)content, 0); + + long double tmp; + buf >> tmp; + value = tmp; } else if(!xmlStrcmp(typestr, (xmlChar*)"string")) { type = STRING; @@ -272,7 +294,7 @@ void XmlPacket::setType(const std::string &type) { xmlSetProp(packetNode, (xmlChar*)"type", (xmlChar*)type.c_str()); } -Net::Packet XmlPacket::encode(uint16_t requestId) const { +Net::Packet XmlPacket::encode(boost::uint16_t requestId) const { xmlChar *buf; int length; |