win32 port of new sockets, with fixes
[chaz/yoink] / src / Moof / Packet.hh
index 198212c352646984e3a3352a6705a73e0de9c600..208b22e9bc75fa51af739546708e7023206b6bdc 100644 (file)
@@ -38,9 +38,8 @@ public:
        Packet& operator<<(uint16_t value);
        Packet& operator<<(uint32_t value);
        Packet& operator<<(uint64_t value);
-       //Packet& operator<<(float value);
-       //Packet& operator<<(double value);
-       //Packet& operator<<(long double value);
+       Packet& operator<<(float value);
+       Packet& operator<<(double value);
 
        size_t write(const void* bytes, size_t size);
 
@@ -53,6 +52,8 @@ public:
        Packet& operator>>(uint16_t& value);
        Packet& operator>>(uint32_t& value);
        Packet& operator>>(uint64_t& value);
+       Packet& operator>>(float& value);
+       Packet& operator>>(double& value);
 
        size_t read(void* bytes, size_t size);
 
@@ -85,7 +86,7 @@ private:
 
 inline Packet& operator<<(Packet& packet, const char* value)
 {
-       uint8_t length = strnlen(value, 255);
+       uint16_t length = strlen(value);
        packet << length;
        packet.write(value, length);
        return packet;
@@ -93,7 +94,7 @@ inline Packet& operator<<(Packet& packet, const char* value)
 
 inline Packet& operator<<(Packet& packet, const std::string& value)
 {
-       packet << (uint8_t)value.length();
+       packet << (uint16_t)value.length();
        packet.write(value.c_str(), value.length());
        return packet;
 }
This page took 0.019423 seconds and 4 git commands to generate.