From d15e332b2af7b8124d3f098d7ece8aaa67031486 Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 30 Sep 2016 09:34:06 +1000 Subject: [PATCH] ckdb - use a signed number for ram to handle numerical errors --- src/ckdb.h | 2 +- src/ckdb_cmd.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index ff6ca9d9..a2f0fd2d 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -58,7 +58,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.516" +#define CKDB_VERSION DB_VERSION"-2.517" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index e536802d..d0bdc3fa 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -5986,7 +5986,7 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id, char tmp[1024], *buf; const char *name; size_t len, off; - uint64_t ram, ram2, tot = 0; + int64_t ram, ram2, tot = 0; K_LIST *klist; K_LISTS *klists; int rows = 0; @@ -6031,8 +6031,8 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id, snprintf(tmp, sizeof(tmp), "name:%d=%s%s%s%cinitial:%d=%d%callocated:%d=%d%c" - "instore:%d=%d%cram:%d=%"PRIu64"%c" - "ram2:%d=%"PRIu64"%ccull:%d=%d%ccull_limit:%d=%d%c", + "instore:%d=%d%cram:%d=%"PRId64"%c" + "ram2:%d=%"PRId64"%ccull:%d=%d%ccull_limit:%d=%d%c", rows, name, istree ? " (tree)" : "", klist->is_lock_only ? " (lock)" : "", FLDSEP, rows, klist->allocate, FLDSEP, @@ -6051,7 +6051,7 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id, } ck_wunlock(&lock_check_lock); - snprintf(tmp, sizeof(tmp), "totalram=%"PRIu64"%c", tot, FLDSEP); + snprintf(tmp, sizeof(tmp), "totalram=%"PRId64"%c", tot, FLDSEP); APPEND_REALLOC(buf, off, len, tmp); snprintf(tmp, sizeof(tmp),