diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-12-24 15:55:59 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-12-24 15:55:59 +0000 |
| commit | a413cb50f7035fdaa1c85b6247b98946b3342ef1 (patch) | |
| tree | c8144080a3006de3bbd8ca6a43cbc9e8a49b3c23 /src/PeerMessageUtil.h | |
| parent | 708b9f4a3da70e963968c0a013dea6777c6b276e (diff) | |
Diffstat (limited to 'src/PeerMessageUtil.h')
| -rw-r--r-- | src/PeerMessageUtil.h | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/src/PeerMessageUtil.h b/src/PeerMessageUtil.h index a4fad679..110cef54 100644 --- a/src/PeerMessageUtil.h +++ b/src/PeerMessageUtil.h @@ -44,53 +44,27 @@ private: PeerMessageUtil() {} public: static uint32_t getIntParam(const unsigned char* msg, int32_t offset); - static uint32_t getIntParam(const char* msg, int32_t offset) { - return getIntParam((const unsigned char*)msg, offset); - } static uint16_t getShortIntParam(const unsigned char* msg, int32_t offset); - static uint16_t getShortIntParam(const char* msg, int32_t offset) { - return getShortIntParam((const unsigned char*)msg, offset); - } static void setIntParam(unsigned char* dest, uint32_t param); - static void setIntParam(char* dest, uint32_t param) { - setIntParam((unsigned char*)dest, param); - } static void setShortIntParam(unsigned char* dest, uint16_t param); - static void setShortIntParam(char* dest, uint16_t param) { - setShortIntParam((unsigned char*)dest, param); - } - static int32_t getId(const unsigned char* msg); - static int32_t getId(const char* msg) { - return getId((const unsigned char*)msg); - } + static uint8_t getId(const unsigned char* msg); - static void checkIndex(uint32_t index, uint32_t pieces); - static void checkBegin(uint32_t begin, uint32_t pieceLength); + static void checkIndex(int32_t index, uint32_t pieces); + static void checkBegin(int32_t begin, uint32_t pieceLength); static void checkLength(uint32_t length); - static void checkRange(uint32_t begin, uint32_t length, uint32_t pieceLength); + static void checkRange(int32_t begin, uint32_t length, uint32_t pieceLength); static void checkBitfield(const unsigned char* bitfield, uint32_t bitfieldLength, uint32_t pieces); - static void checkBitfield(const char* bitfield, - uint32_t bitfieldLength, - uint32_t pieces) { - checkBitfield((unsigned char*)bitfield, bitfieldLength, pieces); - } static void createPeerMessageString(unsigned char* msg, uint32_t msgLength, uint32_t payloadLength, - int32_t messageId); - static void createPeerMessageString(char* msg, - uint32_t msgLength, - uint32_t payloadLength, - int32_t messageId) { - createPeerMessageString((unsigned char*)msg, msgLength, payloadLength, messageId); - } + uint8_t messageId); }; #endif // _D_PEER_MESSAGE_UTIL_H_ |
