Skip to content

Commit

Permalink
Update sm-json to v5 dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdnk committed Mar 25, 2023
1 parent 1ca652d commit 48aba89
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "dependencies/sm-json"]
path = dependencies/sm-json
url = https://github.com/clugg/sm-json
branch = develop
2 changes: 1 addition & 1 deletion scripting/get5/jsonhelpers.sp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ stock int AddJsonAuthsToList(JSON_Object json, const char[] key, ArrayList list,
}

} else {
int length = data.Iterate();
int length = data.Length;
int key_length = 0;
char name[MAX_NAME_LENGTH];
for (int i = 0; i < length; i++) {
Expand Down
8 changes: 4 additions & 4 deletions scripting/get5/matchconfig.sp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static bool LoadMatchFile(const char[] config, char[] error, bool backup) {

bool success = false;
if (IsJSONPath(config)) {
JSON_Object json = json_read_from_file(config, JSON_DECODE_ORDERED_KEYS);
JSON_Object json = json_read_from_file(config);
if (json == null) {
FormatEx(error, PLATFORM_MAX_PATH, "Failed to read match config from file \"%s\" as JSON.", config);
} else {
Expand Down Expand Up @@ -618,7 +618,7 @@ static bool LoadMatchFromJson(const JSON_Object json, char[] error) {
if (cvars != null) {
char cvarValue[MAX_CVAR_LENGTH];

int length = cvars.Iterate();
int length = cvars.Length;
int key_length = 0;
for (int i = 0; i < length; i++) {
key_length = cvars.GetKeySize(i);
Expand Down Expand Up @@ -931,7 +931,7 @@ static bool LoadMapListFromFile(const char[] fromFile, char[] error) {
}
bool success = false;
if (IsJSONPath(fromFile)) {
JSON_Object jsonFromFile = json_read_from_file(fromFile, JSON_DECODE_ORDERED_KEYS);
JSON_Object jsonFromFile = json_read_from_file(fromFile);
if (jsonFromFile == null) {
FormatEx(error, PLATFORM_MAX_PATH,
"\"maplist\" -> \"fromfile\" points to an invalid or unreadable JSON file: \"%s\".", fromFile);
Expand Down Expand Up @@ -966,7 +966,7 @@ bool LoadTeamDataFromFile(const char[] fromFile, const Get5Team team, char[] err
}
bool success = false;
if (IsJSONPath(fromFile)) {
JSON_Object jsonFromFile = json_read_from_file(fromFile, JSON_DECODE_ORDERED_KEYS);
JSON_Object jsonFromFile = json_read_from_file(fromFile);
if (jsonFromFile != null) {
success = LoadTeamDataJson(jsonFromFile, team, error, false);
json_cleanup_and_delete(jsonFromFile);
Expand Down

0 comments on commit 48aba89

Please sign in to comment.