Browse Source

Merge pull request #436 from zrax/plStringBuffer_sizeof

Fix plStringBuffer constructor with explicit size to count chars, not bytes
Adam Johnson 11 years ago
parent
commit
b49b9f384c
  1. 2
      Sources/Plasma/CoreLib/plString.h

2
Sources/Plasma/CoreLib/plString.h

@ -137,7 +137,7 @@ public:
{ {
memset(fShort, 0, sizeof(fShort)); memset(fShort, 0, sizeof(fShort));
_Ch *copyData = IHaveACow() ? new _Ch[size + 1] : fShort; _Ch *copyData = IHaveACow() ? new _Ch[size + 1] : fShort;
memcpy(copyData, data, size); memcpy(copyData, data, size * sizeof(_Ch));
copyData[size] = 0; copyData[size] = 0;
if (IHaveACow()) if (IHaveACow())

Loading…
Cancel
Save