Changeset 6960 for code/branches/presentation3/src
- Timestamp:
- May 21, 2010, 6:49:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/libraries/network/packet/ClassID.cc
r6417 r6960 65 65 tempQueue.push( std::pair<unsigned int, std::string>(network_id, classname) ); 66 66 ++nrOfClasses; 67 packetSize += (classname.size()+1)+sizeof( uint32_t)+sizeof(uint32_t);67 packetSize += (classname.size()+1)+sizeof(network_id)+sizeof(uint32_t); 68 68 } 69 69 … … 80 80 // now save all classids and classnames 81 81 std::pair<uint32_t, std::string> tempPair; 82 uint32_t tempsize = 2*sizeof(uint32_t); // packetid and nrOfClasses 82 83 while( !tempQueue.empty() ){ 83 84 tempPair = tempQueue.front(); … … 87 88 memcpy(temp+2*sizeof(uint32_t), tempPair.second.c_str(), tempPair.second.size()+1); 88 89 temp+=2*sizeof(uint32_t)+tempPair.second.size()+1; 90 tempsize+=2*sizeof(uint32_t)+tempPair.second.size()+1; 89 91 } 92 assert(tempsize=packetSize); 90 93 91 94 COUT(5) << "classid packetSize is " << packetSize << endl; … … 111 114 for(unsigned int i=0; i<nrOfClasses; i++){ 112 115 totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); 116 temp += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); 113 117 } 114 118 return totalsize;
Note: See TracChangeset
for help on using the changeset viewer.