Changeset 510
- Timestamp:
- 04/10/06 15:39:23 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
library/trunk/modules/service-gotek2/GotekPacket.cpp
r507 r510 19 19 20 20 m_type = (GotekPacketType)readUInt8(); 21 readUInt16(); 21 22 uint32_t size = readUInt32(); 23 24 if( size != m_data.size() ) 25 { 26 m_options |= GotekBad; 27 throw GotekException(string("Packet size information does not match actual packet size!")); 28 } 22 29 } 23 30 … … 45 52 string packet; 46 53 47 uint 16_t nsize = htons(m_data.size());54 uint32_t nsize = htonl(m_data.size()); 48 55 49 56 packet.push_back((unsigned char)type()); 50 packet.push_back((unsigned char)(nsize >> 8)); 57 packet.push_back((unsigned char)(nsize >> 24)); 58 packet.push_back((unsigned char)((nsize >> 16) & 0xff)); 59 packet.push_back((unsigned char)((nsize >> 8) & 0xff)); 51 60 packet.push_back((unsigned char)(nsize & 0xff)); 52 61
