浏览代码

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

正在加载...
取消
保存