Updated the code, the save feature needs to be tested carefully before using it

This commit is contained in:
anschrammh 2019-11-17 19:28:50 +01:00
parent e9625b909c
commit ef2f986581
2 changed files with 61 additions and 56 deletions

View File

@ -13,11 +13,12 @@ void *CFGFileParser::parseFile()
CFGDictionary<CFGParameterValue> *dictioRef = new CFGDictionary<CFGParameterValue>; CFGDictionary<CFGParameterValue> *dictioRef = new CFGDictionary<CFGParameterValue>;
char readChar(0), *parsedParameter(NULL), *parsedValue(NULL); char readChar(0), *parsedParameter(NULL), *parsedValue(NULL);
if(!_sdCardManager.isMounted()) return NULL;
file = _sdCardManager.open(_resource); file = _sdCardManager.open(_resource);
if(!file) if(!file)
{ {
delete dictioRef; delete dictioRef;
file.close();
return NULL; return NULL;
} }
@ -167,17 +168,18 @@ void *CFGFileParser::parseFile()
boolean CFGFileParser::save(void *data) boolean CFGFileParser::save(void *data)
{ {
if(data == NULL) if(data == NULL) return false;
return false;
Dictionary<CFGParameterValue> *ref = (Dictionary<CFGParameterValue> *) data; Dictionary<CFGParameterValue> *ref = (Dictionary<CFGParameterValue> *) data;
int truncateHere(0); uint64_t truncateHere(0);
char readChar(0); char readChar(0);
if(!_sdCardManager.isMounted()) return NULL;
File file = _sdCardManager.open(_resource, FILE_READWRITE); File file = _sdCardManager.open(_resource, FILE_READWRITE);
if(!file) if(!file)
{ {
file.close();
return false; return false;
} }

View File

@ -7,6 +7,9 @@
#include "definition.h" #include "definition.h"
#include "CFGParameterValue.h" #include "CFGParameterValue.h"
//Forward class declaration because of cross includes...
class SDCardManager;
class CFGFileParser : public AbstractParser class CFGFileParser : public AbstractParser
{ {
public: public: