diff --git a/src/json_parse.c b/src/json_parse.c index 9f76d4a5..d5d6f01e 100644 --- a/src/json_parse.c +++ b/src/json_parse.c @@ -94,6 +94,10 @@ int json_createFromFile(const char *filePath, INOUT JSON_s *parsedData) { char *jsonString = NULL; do { + if (!filePath) { + break; + } + if (!parsedData) { break; } @@ -241,7 +245,7 @@ bool json_mapCopyStringValue(const JSON_s *map, const char *key, INOUT char **va return foundMatch; } -bool json_mapParseLongValue(const JSON_s *map, const char *key, INOUT long *val, const int base) { +bool json_mapParseLongValue(const JSON_s *map, const char *key, INOUT long *val, const long base) { bool foundMatch = false; do { diff --git a/src/json_parse.h b/src/json_parse.h index 1954a9d5..510929cf 100644 --- a/src/json_parse.h +++ b/src/json_parse.h @@ -33,8 +33,8 @@ int json_createFromFile(const char *filePath, INOUT JSON_s *parsedData); // get string value for key in map JSON, returns true upon success and strdup()'d value in *val bool json_mapCopyStringValue(const JSON_s *map, const char *key, INOUT char **val); -// get int value for key in map JSON, returns true upon success -bool json_mapParseLongValue(const JSON_s *dict, const char *key, INOUT long *val, const int base); +// get long value for key in map JSON, returns true upon success +bool json_mapParseLongValue(const JSON_s *dict, const char *key, INOUT long *val, const long base); // get float value for key in map JSON, returns true upon success bool json_mapParseFloatValue(const JSON_s *dict, const char *key, INOUT float *val); @@ -42,10 +42,11 @@ bool json_mapParseFloatValue(const JSON_s *dict, const char *key, INOUT float *v // ---------------------------------------------------------------------------- // array functions -//bool json_arrayCopytStringValueAtIndex(const JSON_s *array, unsigned long index, INOUT const char **val); -//bool json_arrayParseIntValueAtIndex(const JSON_s *array, unsigned long index, INOUT const int *val); +//bool json_arrayCopyStringValueAtIndex(const JSON_s *array, unsigned long index, INOUT const char **val); +//bool json_arrayParseLongValueAtIndex(const JSON_s *array, unsigned long index, INOUT const long *val); //bool json_arrayParseFloatValueAtIndex(const JSON_s *array, unsigned long index, INOUT const float *val); +// ---------------------------------------------------------------------------- // destroys internal allocated memory (if any) void json_destroy(JSON_s *parsedData);