changeset 1358:cf411b1dcbbb

Improve compatibility with old systems. Use c_str() to get C strings for printing.
author Thomas Klausner <tk@giga.or.at>
date Wed, 29 May 2019 16:36:32 +0200
parents 925470fbe59d
children 09f94b1bedc3 56f9e13f0ef0
files extensions/dict_json/json-schema-to-c.cc
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/dict_json/json-schema-to-c.cc	Sat May 18 17:58:48 2019 +0200
+++ b/extensions/dict_json/json-schema-to-c.cc	Wed May 29 16:36:32 2019 +0200
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include <json/SchemaValidator.h>
 
@@ -91,13 +92,13 @@
     }
     off_t n = stat_buf.st_size;
     if (max_size > 0 && n > max_size) {
-        fprintf (stderr, "%s file [%s] is larger than %" PRIi64 " bytes\n", desc, filename, (int64_t)max_size);
+        fprintf (stderr, "%s file [%s] is larger than %lld bytes\n", desc, filename, (long long)max_size);
         fclose (fp);
         return NULL;
     }
     char *buf;
     if ((buf = (char *) malloc ((size_t)n+1)) == NULL) {
-        fprintf (stderr, "error allocating %" PRIi64 " bytes for read of %s file [%s]\n", (int64_t)n, desc, filename);
+        fprintf (stderr, "error allocating %lld bytes for read of %s file [%s]\n", (long long)n, desc, filename);
         fclose (fp);
         return NULL;
     }
@@ -180,7 +181,7 @@
 
     Json::Value json;
     if (!reader.parse(str, json)) {
-	fprintf(stderr, "%s: parse error: %s\n", input, reader.getFormattedErrorMessages());
+	fprintf(stderr, "%s: parse error: %s\n", input, reader.getFormattedErrorMessages().c_str());
         exit(1);
     }
 
"Welcome to our mercurial repository"