diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-07-30 13:53:25 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-07-30 13:53:25 +0200 |
commit | 2fa7db7a2d34973a168f90e6605ce123b293cf13 (patch) | |
tree | 9ce1db9c7b0e13ea36bdd26c7afb5a5d19965271 /glcdskin/xml.c | |
parent | 21d15ba6ddf7440f229eb627ff3cc28393e3faee (diff) | |
download | graphlcd-base-2fa7db7a2d34973a168f90e6605ce123b293cf13.tar.gz graphlcd-base-2fa7db7a2d34973a168f90e6605ce123b293cf13.tar.bz2 |
skin definitions: added simple support for including files; increased graphlcd-base version to 0.3.0 and version of included libraries to 2.1.0; bug fix: don't syslog a detection of an invalid number when evaluating in cSkinFunction (just return that this is obviously not a valid function)
Diffstat (limited to 'glcdskin/xml.c')
-rw-r--r-- | glcdskin/xml.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/glcdskin/xml.c b/glcdskin/xml.c index 1ed927d..a3ad976 100644 --- a/glcdskin/xml.c +++ b/glcdskin/xml.c @@ -70,18 +70,21 @@ cXML::cXML(const std::string & file, const std::string sysCharset) if (!f.is_open()) { syslog(LOG_ERR, "ERROR: skin file %s not found\n", file.c_str()); - } - size = f.tellg(); + validFile = false; + } else { + validFile = true; + size = f.tellg(); #if (__GNUC__ < 3) - f.seekg(0, std::ios::beg); + f.seekg(0, std::ios::beg); #else - f.seekg(0, std::ios_base::beg); + f.seekg(0, std::ios_base::beg); #endif - buffer = new char[size]; - f.read(buffer, size); - f.close(); - data.assign(buffer, size); - delete[] buffer; + buffer = new char[size]; + f.read(buffer, size); + f.close(); + data.assign(buffer, size); + delete[] buffer; + } } #if 0 @@ -135,6 +138,9 @@ int cXML::Parse(void) uint32_t c, c_tmp; unsigned int i_old; int l, char_size; + + if (!validFile) + return -1; state = LOOK4START; linenr = 1; |