diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-08-18 15:58:17 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-08-18 15:58:17 +0200 |
commit | db5ad2e09a6b38e841463dbe7eb076492b62c948 (patch) | |
tree | 5907f6416e35cbd25432a5f1f6dc9664d36aa73c /src/Common/XmlPacket.cpp | |
parent | 5da7b0847bac2a5abec95b9ac1701b74baae8964 (diff) | |
download | mad-db5ad2e09a6b38e841463dbe7eb076492b62c948.tar mad-db5ad2e09a6b38e841463dbe7eb076492b62c948.zip |
Mad funktioniert jetzt unter Windows
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; |