Changeset: bbf3d8a17272 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bbf3d8a17272
Modified Files:
        tools/merovingian/client/monetdb.c
        tools/merovingian/daemon/controlrunner.c
Branch: hot-snapshot
Log Message:

Avoid intmax_t

Intmax_t didn't work as expected on icc where apparently, printf's
"%jd" expects 'long long' while intmax_t is defined as 'long'.
They are the same size but they are of course different types.

Switched to using uint64_t for off_t and int64_t for time_t,
formatting them using PRIi64 and PRIu64 as defined in inttypes.h.


diffs (41 lines):

diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -1755,10 +1755,10 @@ snapshot_enumerate(struct snapshot **sna
                while (p < end) {
                        char *eol = strchr(p, '\n');
                        eol = (eol != NULL) ? eol : end;
-                       intmax_t time;
-                       intmax_t size;
+                       int64_t time;
+                       uint64_t size;
                        int len;
-                       if (sscanf(p, "%jd %jd %n", &time, &size, &len) != 2) {
+                       if (sscanf(p, "%" SCNd64 " %" SCNu64 " %n", &time, 
&size, &len) != 2) {
                                free(out);
                                return strdup("internal parse error");
                        }
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -17,6 +17,7 @@
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #endif
+#include <inttypes.h>
 #include <time.h>
 #include <string.h>  /* strerror */
 #include <unistd.h>  /* select */
@@ -783,9 +784,9 @@ static void ctl_handle_client(
                                send_client("=");
                                for (int i = 0; i < nsnaps; i++) {
                                        struct snapshot *snap = &snaps[i];
-                                       len = snprintf(buf2, sizeof(buf2), "%jd 
%jd %s %s\n",
-                                               (intmax_t)snap->time,
-                                               (intmax_t)snap->size,
+                                       len = snprintf(buf2, sizeof(buf2), "%" 
PRIi64 " %" PRIu64 " %s %s\n",
+                                               (int64_t)snap->time,
+                                               (uint64_t)snap->size,
                                                snap->dbname,
                                                snap->path != NULL ? snap->path 
: "");
                                        send_client("=");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to