Changeset 8620 for source/ariba/utility/serialization
- Timestamp:
- Oct 4, 2010, 2:27:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/serialization/Data.hpp
r7523 r8620 396 396 size_t res_length = calcLength(new_length); 397 397 if (old_length != res_length) { 398 T* new_buffer = new T[res_length]; 399 if (bufferPtr != NULL) { 400 size_t clength = res_length < old_length ? res_length : old_length; 401 memcpy( new_buffer, bufferPtr, clength*sizeof(T) ); 402 delete [] bufferPtr; 398 399 if(res_length <= 0){ 400 if (bufferPtr != NULL) delete [] bufferPtr; 401 bufferPtr = NULL; 402 bufferLen = 0; 403 }else{ 404 T* new_buffer = new T[res_length]; 405 if (new_buffer != NULL) memset(new_buffer, 0, res_length*sizeof(T)); 406 if (bufferPtr != NULL) { 407 size_t clength = res_length < old_length ? res_length : old_length; 408 memcpy( new_buffer, bufferPtr, clength*sizeof(T) ); 409 delete [] bufferPtr; 410 } 411 bufferPtr = new_buffer; 412 bufferLen = new_length; 403 413 } 404 bufferPtr = new_buffer;405 bufferLen = new_length;406 414 } 407 415 }
Note:
See TracChangeset
for help on using the changeset viewer.