Browse Source

cmRtNet.c : Updated _cmRtNetDeserializeSyncMsg() to use cmRtNetSyncMsg_t.hdrByteCnt.

master
kpl 10 years ago
parent
commit
e4cef833d0
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      cmRtNet.c

+ 8
- 2
cmRtNet.c View File

282
 
282
 
283
 cmRtNetRC_t _cmRtNetDeserializeSyncMsg( const void* buf, unsigned n, cmRtNetSyncMsg_t* m )
283
 cmRtNetRC_t _cmRtNetDeserializeSyncMsg( const void* buf, unsigned n, cmRtNetSyncMsg_t* m )
284
 {
284
 {
285
-  assert( n > sizeof(*m));
286
-  memcpy(m,buf,sizeof(*m));
287
   const cmRtNetSyncMsg_t* mp = (const cmRtNetSyncMsg_t*)buf;
285
   const cmRtNetSyncMsg_t* mp = (const cmRtNetSyncMsg_t*)buf;
286
+  
287
+  m->hdr.rtSubIdx = mp->hdr.rtSubIdx;
288
+  m->hdr.selId    = mp->hdr.selId;
289
+  m->selId        = mp->selId;
290
+  m->hdrByteCnt   = sizeof(cmRtNetSyncMsg_t);
291
+  m->rtSubIdx     = mp->rtSubIdx;
292
+  m->id           = mp->id;
293
+
288
   const cmChar_t*   s  = ((const cmChar_t*)(mp)) + mp->hdrByteCnt;
294
   const cmChar_t*   s  = ((const cmChar_t*)(mp)) + mp->hdrByteCnt;
289
   m->label = cmMemAllocStr(s);
295
   m->label = cmMemAllocStr(s);
290
   return kOkNetRC;
296
   return kOkNetRC;

Loading…
Cancel
Save