Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3530 in orxonox.OLD for orxonox/branches/levelloader/src/lib/util


Ignore:
Timestamp:
Mar 13, 2005, 10:40:25 PM (20 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

Location:
orxonox/branches/levelloader/src/lib/util
Files:
2 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
  • orxonox/branches/levelloader/src/lib/util/substring.h

    r3525 r3530  
    33    \brief a small class to get the parts of a string separated by commas
    44*/
     5
     6#ifndef _SUBSTRING_H
     7#define _SUBSTRING_H
    58
    69#include "stdincl.h"
     
    1013        public:
    1114       
    12                 SubString( char* string);
     15                SubString( const char* string);
    1316                ~SubString();
    1417               
     
    2023                int n;
    2124};
     25
     26#endif /* _SUBSTRING_H */
Note: See TracChangeset for help on using the changeset viewer.