Преглед изворни кода

cmData.c : Initial implementation of cmDataSerialize().

master
kevin пре 11 година
родитељ
комит
0debd730a6
1 измењених фајлова са 19 додато и 1 уклоњено
  1. 19
    1
      cmData.c

+ 19
- 1
cmData.c Прегледај датотеку

@@ -2161,10 +2161,28 @@ char* _cmDataSerializeWrite( cmData_t* np, char* dp, const char* ep )
2161 2161
   return dp;
2162 2162
 }
2163 2163
 
2164
-cmDtRC_t cmDataSerialize( const cmData_t* p, void* buf, unsigned bufByteCnt )
2164
+char* _cmDataSerialize( const cmData_t* p, char* buf, const char* ep )
2165 2165
 {
2166
+
2167
+  buf = _cmDataSerializeWrite(p,buf,ep);
2168
+
2169
+  // if this data type has a child then write the child
2170
+  if( kMinStructDtId <= p->tid && p->tid <= kMaxStructDtId && p->u.child != NULL )
2171
+    buf = _cmDataSerialize(p->u.child,buf,ep);
2166 2172
   
2173
+  // if this data type has siblings then write sibings
2174
+  cmData_t* dp = p->u.child;
2175
+  for(; dp != NULL; dp=dp->sibling )
2176
+    buf = cmDataSerialize(dp->sibling,buf,ep);
2177
+
2178
+  return buf;
2179
+}
2167 2180
 
2181
+cmDtRC_t cmDataSerialize( const cmData_t* p, void* buf, unsigned bufByteCnt )
2182
+{
2183
+  const char* ep = (char*)p + bufByteCnt;
2184
+  buf = _cmDataSerialize(p,buf,bufByteCnt);
2185
+  assert( buf <= ep );
2168 2186
   return kOkDtRC;
2169 2187
 }
2170 2188
 

Loading…
Откажи
Сачувај