Преглед изворни кода

Increased size of myDataBuffer by one, and added null byte

at the end.  Reason:  To be able to pass myDataBuffer to the
constructor of std::string that expects a null-terminated
c-string.


git-svn-id: https://svn.microneil.com/svn/CodeDweller/branches/adeniz_1@70 d34b734f-a00e-4b39-a726-e4eeb87269ab
adeniz_1
adeniz пре 9 година
родитељ
комит
2632f6dc4b
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3
    1
      configuration.cpp

+ 3
- 1
configuration.cpp Прегледај датотеку

@@ -1169,8 +1169,10 @@ ConfigurationData::ConfigurationData(const char* Data, int Length) :
myBufferSize(Length), // and it's length.
myIndex(0), // Our Index is zero
myLine(1) { // We start on line 1
myDataBuffer = new char[myBufferSize]; // Allocate a buffer.
myDataBuffer = new char[myBufferSize + 1]; // Allocate a buffer, with
// room for null byte.
memcpy(myDataBuffer, Data, myBufferSize); // Copy the data.
myDataBuffer[myBufferSize] = '\0'; // Null-terminate.
}

ConfigurationData::ConfigurationData(const char* FileName) :

Loading…
Откажи
Сачувај