Changeset 307 for trunk


Ignore:
Timestamp:
Mar 9, 2006, 7:55:44 PM (19 years ago)
Author:
cxsong
Message:

updated comments, corrected deletes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mesh/reader.cc

    r303 r307  
    2626#endif
    2727
    28         delete header;
     28        delete [] header;
    2929}
    3030
     
    5757// parse object name
    5858//
    59 void readString(const char* buf, string& name)
     59void readString(const char* buf, string& str)
    6060{
    6161        char* ptr = (char*)buf;
    6262        int len;
    6363
    64         // copy length of name
     64        // read length of string
    6565
    6666        ByteOrder<int>::OrderCopy((int*)ptr, &len);
     
    6868        ptr += sizeof(int);
    6969       
    70         // copy name as chars
     70        // read chars
    7171
    7272        char* cstr = new char[len]; ;
    7373        ByteOrder<char>::OrderCopyArray(ptr, cstr, len);
    7474        filterTrailingBlanks(cstr, len);
    75         name = cstr;
     75        str = cstr;
    7676
    77         delete cstr;
     77        delete [] cstr;
    7878}
    7979
     
    8282        char *ptr = buf;
    8383
    84         // copy length of name
     84        // write length of string
    8585
    8686        ByteOrder<int>::OrderCopy(&len, (int*)ptr);
    8787        ptr += sizeof(int);
    8888       
    89         // copy chars
     89        // write chars
    9090        ByteOrder<char>::OrderCopyArray(str, ptr, len);
    9191}
Note: See TracChangeset for help on using the changeset viewer.