Changeset 238
- Timestamp:
- Nov 24, 2007, 2:22:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Synchronisable.cc
r237 r238 9 9 // Copyright: See COPYING file that comes with this distribution 10 10 // 11 // 11 12 12 #include "network/Synchronisable.h" 13 13 … … 44 44 retVal.data = (unsigned char *)malloc(totalsize); 45 45 // copy to location 46 for(int n=0, i=syncList.begin(); n<totalsize && i!=syncList.end(); i++){ 47 std::memcpy(retVal.data+n, i->size, sizeof(int)); 46 //CHANGED: REMOVED DECLARATION int n=0 FROM LOOP 47 int n=0; 48 for(i=syncList.begin(); n<totalsize && i!=syncList.end(); i++){ 49 //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID* 50 std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int)); 48 51 n+=sizeof(int); 49 std::memcpy(retVal.data+n, *(*i.var), *i.size); 52 //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i 53 std::memcpy(retVal.data+n, (const void*)(i->var), i->size); 50 54 n+=i->size; 51 55 } … … 58 62 if((int)*data==i->size){ 59 63 data+=sizeof(int); 60 memcpy(i->data, data, i->size); 64 //CHANGED: THIS FROM i->var TO (void*)i->var SINCE var IS A CONST VOID* AND memcpy NEEDS A VOID* AS FIRST ARGUMENT 65 memcpy((void*)i->var, data, i->size); 61 66 data+=i->size; 62 67 } else
Note: See TracChangeset
for help on using the changeset viewer.