Ver código fonte

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

master
kpl 10 anos atrás
pai
commit
e4cef833d0
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8
    2
      cmRtNet.c

+ 8
- 2
cmRtNet.c Ver arquivo

@@ -282,9 +282,15 @@ cmRtNetRC_t _cmRtNetSerializeSyncMsg( cmRtNet_t* p, const cmRtNetSyncMsg_t* m, v
282 282
 
283 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 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 294
   const cmChar_t*   s  = ((const cmChar_t*)(mp)) + mp->hdrByteCnt;
289 295
   m->label = cmMemAllocStr(s);
290 296
   return kOkNetRC;

Carregando…
Cancelar
Salvar