Browse Source

fix load text bug

Eduardo Bart 10 years ago
parent
commit
b80dc4d6e0
2 changed files with 3 additions and 3 deletions
  1. 1
    2
      src/framework/configmanager.cpp
  2. 2
    1
      src/framework/resourcemanager.cpp

+ 1
- 2
src/framework/configmanager.cpp View File

@@ -58,12 +58,11 @@ bool ConfigManager::load(const std::string& fileName)
58 58
         YAML::Node doc;
59 59
         parser.GetNextDocument(doc);
60 60
 
61
-        for(YAML::Iterator it = doc.begin(); it != doc.end(); it++) {
61
+        for(YAML::Iterator it = doc.begin(); it != doc.end(); ++it) {
62 62
             std::string key, value;
63 63
             it.first() >> key;
64 64
             it.second() >> value;
65 65
             m_confsMap[key] = value;
66
-            dump() << key << value;
67 66
         }
68 67
     } catch (YAML::ParserException& e) {
69 68
         error("Malformed configuration file!");

+ 2
- 1
src/framework/resourcemanager.cpp View File

@@ -81,8 +81,9 @@ unsigned char *ResourceManager::loadFile(const std::string& fileName, unsigned i
81 81
     }
82 82
 
83 83
     *fileSize = PHYSFS_fileLength(file);
84
-    unsigned char *buffer = new unsigned char[*fileSize];
84
+    unsigned char *buffer = new unsigned char[*fileSize + 1];
85 85
     PHYSFS_read(file, (void*)buffer, 1, *fileSize);
86
+    buffer[*fileSize] = 0;
86 87
     PHYSFS_close(file);
87 88
     return buffer;
88 89
 }

Loading…
Cancel
Save