diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-10-27 15:50:11 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-10-27 15:50:11 +0200 |
commit | 29ae5ac36d4ffc520232ff393b2455130ec0227e (patch) | |
tree | f89f8a4f2e5d61bc20ba16d2ab46070190cb411d /src/miav_config.cc | |
parent | caa558e59c248521d1d4ad483fe669828277664e (diff) |
fix warnings/errors.
Diffstat (limited to 'src/miav_config.cc')
-rw-r--r-- | src/miav_config.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/miav_config.cc b/src/miav_config.cc index adfa5c5..4e4b82b 100644 --- a/src/miav_config.cc +++ b/src/miav_config.cc @@ -27,9 +27,13 @@ #include <config.h> #include "miav_config.h" +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + MiavConfig *config; -MiavConfig::MiavConfig(char *file, Info *i) +MiavConfig::MiavConfig(const char *file, Info *i) { info = i; configs = NULL; @@ -49,7 +53,7 @@ MiavConfig::MiavConfig(char *file, Info *i) fseek(fp, 0, SEEK_SET); char *raw = (char*)calloc(fsz, 1); - fread(raw, 1, fsz, fp); + size_t rsz = fread(raw, 1, fsz, fp); rsz = rsz; fclose(fp); @@ -74,7 +78,7 @@ MiavConfig::~MiavConfig() /** * Prints a reasonable error message when a parse error occurres. */ -void MiavConfig::parseError(char* msg, _cfg* cfg) +void MiavConfig::parseError(const char* msg, _cfg* cfg) { if(info) info->error("Error parsing file %s at line %d:\n\t%s\n\t%s\n", filename.c_str(), @@ -412,7 +416,7 @@ _cfg* MiavConfig::parse(char* raw) return first; } -int MiavConfig::readInt(char *node) +int MiavConfig::readInt(const char *node) { _cfg* n = findNode(node); if(n) { @@ -422,7 +426,7 @@ int MiavConfig::readInt(char *node) return 0; } -bool MiavConfig::readBool(char *node) +bool MiavConfig::readBool(const char *node) { _cfg* n = findNode(node); if(n) { @@ -433,7 +437,7 @@ bool MiavConfig::readBool(char *node) return false; } -string *MiavConfig::readString(char *node) +string *MiavConfig::readString(const char *node) { _cfg* n = findNode(node); if(n) { @@ -443,7 +447,7 @@ string *MiavConfig::readString(char *node) return &emptyString; } -float MiavConfig::readFloat(char *node) +float MiavConfig::readFloat(const char *node) { _cfg* n = findNode(node); if(n) { @@ -454,7 +458,7 @@ float MiavConfig::readFloat(char *node) return 0.0f; } -_cfg *MiavConfig::findNode(char* node) +_cfg *MiavConfig::findNode(const char* node) { _cfg *cfg = configs; |