Changeset 2702 in orxonox.OLD for orxonox/branches/chris/src
- Timestamp:
- Nov 2, 2004, 9:15:50 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/chris/src/data_tank.cc
r2666 r2702 24 24 */ 25 25 26 #include "data tank.h"26 #include "data_tank.h" 27 27 28 28 using namespace std; … … 345 345 { 346 346 FILE* out; 347 DataTree* act;348 347 349 348 out = fopen( filename, "w"); … … 403 402 int type = 0; 404 403 char testfile[MAX_FILENAME_LENGHT]; 405 404 406 405 if( !postfix || !lfunc || !ffunc || !placeholderfile) return -1; 407 406 408 407 sprintf( testfile, "blabla.%s", postfix); 409 408 if( (type = get_type( testfile)) != -1) … … 420 419 char** old_postfixes = postfixes; 421 420 void** old_placeholders = placeholders; 422 421 423 422 // realloc 424 423 load_funcs = (void*(**)(char*)) malloc( sizeof( void*(*)(char*)) * (ntypes + 1)); 425 424 free_funcs = (void(**)(void*)) malloc( sizeof( void(*)(void*)) * (ntypes + 1)); 426 postfixes = (char**) malloc( sizeof( char*) * POSTFIX_LENGHT *(ntypes + 1));425 postfixes = (char**) malloc( sizeof( char*) * (ntypes + 1)); 427 426 placeholders = (void**) malloc( sizeof( void*) * (ntypes + 1)); 428 427 429 428 // copy 430 429 memcpy( load_funcs, old_load_funcs, sizeof( void*(*)(char*)) * ntypes); 431 memcpy( free_funcs, old_free_funcs, sizeof( void *(*)(void*)) * ntypes);432 memcpy( postfixes, old_postfixes, sizeof( char*) * POSTFIX_LENGHT *ntypes);430 memcpy( free_funcs, old_free_funcs, sizeof( void(*)(void*)) * ntypes); 431 memcpy( postfixes, old_postfixes, sizeof( char*) * ntypes); 433 432 memcpy( placeholders, old_placeholders, sizeof( void*) * ntypes); 433 434 // free 435 free( old_load_funcs); 436 free( old_free_funcs); 437 free( old_postfixes); 438 free( old_placeholders); 434 439 435 440 // add … … 439 444 load_funcs[type] = lfunc; 440 445 free_funcs[type] = ffunc; 441 memset( postfixes[type], 0, 5); 442 strncpy( postfixes[type], postfix, 5); 446 postfixes[type] = (char*) malloc( sizeof( char) * POSTFIX_LENGHT); 447 memset( postfixes[type], 0, POSTFIX_LENGHT); 448 strncpy( postfixes[type], postfix, POSTFIX_LENGHT); 443 449 placeholders[type] = lfunc( placeholderfile); 444 450
Note: See TracChangeset
for help on using the changeset viewer.