Skip to content

Commit 9fd5288

Browse files
committed
Added a few "const" to remove a few GCC warnings
1 parent 0e9840d commit 9fd5288

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

JsonHashTable.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
1818
/*
1919
* Returns the token for the value associated with the specified key
2020
*/
21-
jsmntok_t* JsonHashTable::getToken(char* desiredKey)
21+
jsmntok_t* JsonHashTable::getToken(const char* desiredKey)
2222
{
2323
// sanity check
2424
if (json == 0 || tokens == 0 || desiredKey == 0)
@@ -48,37 +48,37 @@ jsmntok_t* JsonHashTable::getToken(char* desiredKey)
4848
return 0;
4949
}
5050

51-
bool JsonHashTable::containsKey(char* key)
51+
bool JsonHashTable::containsKey(const char* key)
5252
{
5353
return getToken(key) != 0;
5454
}
5555

56-
JsonArray JsonHashTable::getArray(char* key)
56+
JsonArray JsonHashTable::getArray(const char* key)
5757
{
5858
return JsonArray(json, getToken(key));
5959
}
6060

61-
bool JsonHashTable::getBool(char* key)
61+
bool JsonHashTable::getBool(const char* key)
6262
{
6363
return getBoolFromToken(getToken(key));
6464
}
6565

66-
double JsonHashTable::getDouble(char* key)
66+
double JsonHashTable::getDouble(const char* key)
6767
{
6868
return getDoubleFromToken(getToken(key));
6969
}
7070

71-
JsonHashTable JsonHashTable::getHashTable(char* key)
71+
JsonHashTable JsonHashTable::getHashTable(const char* key)
7272
{
7373
return JsonHashTable(json, getToken(key));
7474
}
7575

76-
long JsonHashTable::getLong(char* key)
76+
long JsonHashTable::getLong(const char* key)
7777
{
7878
return getLongFromToken(getToken(key));
7979
}
8080

81-
char* JsonHashTable::getString(char* key)
81+
char* JsonHashTable::getString(const char* key)
8282
{
8383
return getStringFromToken(getToken(key));
8484
}

JsonHashTable.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ class JsonHashTable : public JsonObjectBase
2121

2222
JsonHashTable() {}
2323

24-
bool containsKey(char* key);
24+
bool containsKey(const char* key);
2525

26-
JsonArray getArray(char* key);
27-
bool getBool(char* key);
28-
double getDouble(char* key);
29-
JsonHashTable getHashTable(char* key);
30-
long getLong(char* key);
31-
char* getString(char* key);
26+
JsonArray getArray(const char* key);
27+
bool getBool(const char* key);
28+
double getDouble(const char* key);
29+
JsonHashTable getHashTable(const char* key);
30+
long getLong(const char* key);
31+
char* getString(const char* key);
3232

3333
private:
3434

3535
JsonHashTable(char* json, jsmntok_t* tokens);
36-
jsmntok_t* getToken(char* key);
36+
jsmntok_t* getToken(const char* key);
3737
};
3838

3939
#endif

0 commit comments

Comments
 (0)