Procházet zdrojové kódy

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 před 9 roky
rodič
revize
2632f6dc4b
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3
    1
      configuration.cpp

+ 3
- 1
configuration.cpp Zobrazit soubor

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

Načítá se…
Zrušit
Uložit