Patch #507 » ofstringoffbyone.diff
ofstd/libsrc/ofstring.cc | ||
---|---|---|
if (n == OFString_npos) {
|
||
n = strlen(s);
|
||
}
|
||
reserve(n);
|
||
reserve(n + 1);
|
||
OFBitmanipTemplate<char>::copyMem(s, this->theCString, n);
|
||
this->theCString[n] = '\0';
|
||
this->theSize = n;
|
||
... | ... | |
{
|
||
s = verify_string(s);
|
||
const size_t n = strlen(s);
|
||
reserve(n);
|
||
// Because we used strlen() to figure out the length we can use strcpy()
|
||
// since there won't be any '\0' bytes in the string.
|
||
reserve(n + 1);
|
||
strcpy(this->theCString, s);
|
||
this->theSize = n;
|
||
}
|
||
... | ... | |
OFString::OFString (size_t rep, char c)
|
||
: theCString(NULL), theSize(0), theCapacity(0)
|
||
{
|
||
reserve(rep);
|
||
reserve(rep + 1);
|
||
for (size_t i = 0; i < rep; i++) {
|
||
this->theCString[i] = c;
|
||
}
|
- « Previous
- 1
- 2
- 3
- Next »