Quellcode durchsuchen

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 vor 9 Jahren
Ursprung
Commit
2632f6dc4b
1 geänderte Dateien mit 3 neuen und 1 gelöschten Zeilen
  1. 3
    1
      configuration.cpp

+ 3
- 1
configuration.cpp Datei anzeigen

@@ -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) :

Laden…
Abbrechen
Speichern