diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-06-02 23:49:49 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2011-06-03 11:03:25 -0600 |
commit | 894038adf52a3e2b42542239a147d6c1cc1ad204 (patch) | |
tree | b881994e4605bcf0ba2d1df68068a78fb21ecf01 /src/net/manaserv | |
parent | d50f35d13e73b72eae1d744971657bd665aa1f33 (diff) | |
download | mana-client-894038adf52a3e2b42542239a147d6c1cc1ad204.tar.gz mana-client-894038adf52a3e2b42542239a147d6c1cc1ad204.tar.bz2 mana-client-894038adf52a3e2b42542239a147d6c1cc1ad204.tar.xz mana-client-894038adf52a3e2b42542239a147d6c1cc1ad204.zip |
Cleanup network code to use unsigned integers of the relevant size
Diffstat (limited to 'src/net/manaserv')
-rw-r--r-- | src/net/manaserv/messagein.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/messagein.h | 4 | ||||
-rw-r--r-- | src/net/manaserv/messageout.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/messageout.h | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/net/manaserv/messagein.cpp b/src/net/manaserv/messagein.cpp index 592182f7..128dd14f 100644 --- a/src/net/manaserv/messagein.cpp +++ b/src/net/manaserv/messagein.cpp @@ -32,9 +32,9 @@ MessageIn::MessageIn(const char *data, unsigned int length): mId = readInt16(); } -int MessageIn::readInt16() +Uint16 MessageIn::readInt16() { - int value = -1; + Uint16 value = 0; if (mPos + 2 <= mLength) { uint16_t t; @@ -45,9 +45,9 @@ int MessageIn::readInt16() return value; } -int MessageIn::readInt32() +Uint32 MessageIn::readInt32() { - int value = -1; + Uint32 value = 0; if (mPos + 4 <= mLength) { uint32_t t; diff --git a/src/net/manaserv/messagein.h b/src/net/manaserv/messagein.h index 6d0a4035..ed6510eb 100644 --- a/src/net/manaserv/messagein.h +++ b/src/net/manaserv/messagein.h @@ -36,8 +36,8 @@ class MessageIn : public Net::MessageIn public: MessageIn(const char *data, unsigned int length); - int readInt16(); /**< Reads a short. */ - int readInt32(); /**< Reads a long. */ + Uint16 readInt16(); /**< Reads a short. */ + Uint32 readInt32(); /**< Reads a "long". */ }; } diff --git a/src/net/manaserv/messageout.cpp b/src/net/manaserv/messageout.cpp index 8779c5f6..695b1b39 100644 --- a/src/net/manaserv/messageout.cpp +++ b/src/net/manaserv/messageout.cpp @@ -28,7 +28,7 @@ namespace ManaServ { -MessageOut::MessageOut(short id): +MessageOut::MessageOut(Uint16 id): Net::MessageOut(id) { writeInt16(id); @@ -45,7 +45,7 @@ void MessageOut::expand(size_t bytes) mDataSize = mPos + bytes; } -void MessageOut::writeInt16(Sint16 value) +void MessageOut::writeInt16(Uint16 value) { expand(2); uint16_t t = ENET_HOST_TO_NET_16(value); @@ -53,7 +53,7 @@ void MessageOut::writeInt16(Sint16 value) mPos += 2; } -void MessageOut::writeInt32(Sint32 value) +void MessageOut::writeInt32(Uint32 value) { expand(4); uint32_t t = ENET_HOST_TO_NET_32(value); diff --git a/src/net/manaserv/messageout.h b/src/net/manaserv/messageout.h index 451bc0aa..a22ea824 100644 --- a/src/net/manaserv/messageout.h +++ b/src/net/manaserv/messageout.h @@ -29,12 +29,12 @@ namespace ManaServ { class MessageOut : public Net::MessageOut { public: - MessageOut(short id); + MessageOut(Uint16 id); ~MessageOut(); - void writeInt16(Sint16 value); /**< Writes a short. */ - void writeInt32(Sint32 value); /**< Writes a long. */ + void writeInt16(Uint16 value); /**< Writes a short. */ + void writeInt32(Uint32 value); /**< Writes a "long". */ protected: /** |