Changeset 2260


Ignore:
Timestamp:
Jan 22, 2013, 9:46:21 PM (7 years ago)
Author:
sam
Message:

base: fix a bug in the String fixed-size constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/base/string.h

    r2256 r2260  
    1515//
    1616
    17 #if !defined __LOL_CORE_STRING_H__
    18 #define __LOL_CORE_STRING_H__
     17#if !defined __LOL_BASE_STRING_H__
     18#define __LOL_BASE_STRING_H__
    1919
    2020#include <lol/base/array.h>
     
    5050    {
    5151        using namespace std;
    52         Resize(count + 1);
    53         memcpy(&(*this)[0], str, Count());
    54         ((Super &)*this).Last() = '\0';
     52        Resize(count);
     53        memcpy(&(*this)[0], str, count);
     54        (*this)[count] = '\0';
    5555    }
    5656
     
    147147} /* namespace lol */
    148148
    149 #endif // __LOL_CORE_STRING_H__
     149#endif // __LOL_BASE_STRING_H__
    150150
Note: See TracChangeset for help on using the changeset viewer.