fix load text bug
This commit is contained in:
parent
b2c61760e5
commit
b80dc4d6e0
|
@ -58,12 +58,11 @@ bool ConfigManager::load(const std::string& fileName)
|
|||
YAML::Node doc;
|
||||
parser.GetNextDocument(doc);
|
||||
|
||||
for(YAML::Iterator it = doc.begin(); it != doc.end(); it++) {
|
||||
for(YAML::Iterator it = doc.begin(); it != doc.end(); ++it) {
|
||||
std::string key, value;
|
||||
it.first() >> key;
|
||||
it.second() >> value;
|
||||
m_confsMap[key] = value;
|
||||
dump() << key << value;
|
||||
}
|
||||
} catch (YAML::ParserException& e) {
|
||||
error("Malformed configuration file!");
|
||||
|
|
|
@ -81,8 +81,9 @@ unsigned char *ResourceManager::loadFile(const std::string& fileName, unsigned i
|
|||
}
|
||||
|
||||
*fileSize = PHYSFS_fileLength(file);
|
||||
unsigned char *buffer = new unsigned char[*fileSize];
|
||||
unsigned char *buffer = new unsigned char[*fileSize + 1];
|
||||
PHYSFS_read(file, (void*)buffer, 1, *fileSize);
|
||||
buffer[*fileSize] = 0;
|
||||
PHYSFS_close(file);
|
||||
return buffer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue