Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2005, 10:40:25 PM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Got the system to compile, the basic backbone now runs. What remains to be done is implementing all necessary functions to load all vital classes into a world

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/lib/util/substring.cc

    r3525 r3530  
    2222#include "substring.h"
    2323
    24 SubString::SubString( char* string)
     24SubString::SubString( const char* string)
    2525{
    2626        n = 0;
     
    3232        n += 1;
    3333       
    34         strings = malloc( sizeof( char*) * n);
     34        strings = new char*[n];
    3535       
    3636        int i = 0;
    3737        int l = 0;
    3838       
    39         char* offset = string;
     39        const char* offset = string;
    4040        char* end = strchr( string, ',');
    4141        while( end != NULL)
    4242        {
    4343                l = end - offset;
    44                 strings[i] = malloc( l + 1);
     44                strings[i] = new char[l + 1];
    4545                strncpy( strings[i], offset, l);
    4646                i++;
     
    5050        }
    5151       
    52         strings[i] = malloc( l + 1);
     52        strings[i] = new char[l + 1];
    5353        strncpy( strings[i], offset, l);
    5454        l = strlen( offset);
     
    6262        for( int i = 0; i < n; i++)
    6363        {
    64                 free( strings[i]);
     64                delete strings[i];
    6565        }
    6666       
    67         free( strings);
     67        delete strings;
    6868}
    6969
Note: See TracChangeset for help on using the changeset viewer.