Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Fix json error in version output (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchassin authored Nov 14, 2022
1 parent 3cdedd1 commit 558fa7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions source/cmdarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,10 @@ int GldCmdarg::version(int argc, const char *argv[])
global_suppress_repeat_messages = false;
output_message("{");
#define OUTPUT(TAG,FORMAT,VALUE) output_message("\t\"%s\" : \"" FORMAT "\",",TAG,VALUE)
#define OUTPUT_LAST(TAG,FORMAT,VALUE) output_message("\t\"%s\" : \"" FORMAT "\"\n}",TAG,VALUE)
#define OUTPUT_LAST(TAG,FORMAT,VALUE) output_message("\t\"%s\" : \"%s\"\n}",TAG,escape(VALUE))
#define OUTPUT_LIST_START(TAG) output_message("\t\"%s\" : [",TAG)
#define OUTPUT_LIST_ITEM(VALUE) output_message("\t\t\"%s\",",VALUE)
#define OUTPUT_LIST_END(VALUE) output_message("\t\t\"%s\"],",VALUE)
#define OUTPUT_LIST_ITEM(VALUE) output_message("\t\t\"%s\",",escape(VALUE))
#define OUTPUT_LIST_END(VALUE) output_message("\t\t\"%s\"],",escape(VALUE))
#define OUTPUT_MULTILINE(TAG,VALUE) {\
const char *value = VALUE;\
char *token=NULL, *last=NULL;\
Expand Down
2 changes: 1 addition & 1 deletion source/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GldJsonWriter::~GldJsonWriter(void)
free((void*)filename);
}

const char * escape(const char *buffer, size_t len = 1024)
const char * escape(const char *buffer, size_t len)
{
static char *result = NULL;
static size_t result_len = 0;
Expand Down
1 change: 1 addition & 0 deletions source/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DEPRECATED CDECL int json_dump(const char *filename);
DEPRECATED CDECL int json_output(FILE *fp);
DEPRECATED CDECL int json_to_glm(const char *jsonfile, char *glmfile);
DEPRECATED CDECL const char * escape(const char *buffer, size_t len = 1024);

class GldJsonWriter
{
Expand Down

0 comments on commit 558fa7c

Please sign in to comment.