Changeset: 61840c4f5afa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=61840c4f5afa
Modified Files:
        clients/mapiclient/mclient.c
        clients/odbc/winsetup/setup.c
        common/options/getopt.c
        common/options/getopt1.c
        common/stream/stream.c
        common/utils/muuid.c
        gdk/gdk_posix.c
        gdk/gdk_private.h
        gdk/gdk_utils.h
        monetdb5/modules/mal/mal_mapi.c
        sql/server/sql_mvc.c
Branch: Jun2020
Log Message:

Fix some unsigned printf format/argument combinations.


diffs (249 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1269,7 +1269,7 @@ TESTrenderer(MapiHdl hdl)
                                                if ((unsigned char) *s < ' ')
                                                        mnstr_printf(toConsole,
                                                                     "\\%03o",
-                                                                    (int) 
(unsigned char) *s);
+                                                                    (unsigned 
char) *s);
                                                else
                                                        mnstr_write(toConsole, 
s, 1, 1);
                                                break;
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -113,7 +113,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
 
        switch (uMsg) {
        case WM_INITDIALOG:
-               ODBCLOG("DialogProc WM_INITDIALOG 0x%x 0x%x\n", (int) wParam, 
(int) lParam);
+               ODBCLOG("DialogProc WM_INITDIALOG 0x%x 0x%x\n", (unsigned) 
wParam, (unsigned) lParam);
 
                datap = (struct data *) lParam;
                /* center dialog on parent */
@@ -136,7 +136,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
                        EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_DSN), FALSE);
                return TRUE;
        case WM_COMMAND:
-               ODBCLOG("DialogProc WM_COMMAND 0x%x 0x%x\n", (int) wParam, 
(int) lParam);
+               ODBCLOG("DialogProc WM_COMMAND 0x%x 0x%x\n", (unsigned) wParam, 
(unsigned) lParam);
 
                switch (LOWORD(wParam)) {
                case IDOK:
@@ -179,7 +179,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
                        return TRUE;
                }
        default:
-               ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (int) wParam, 
(int) lParam);
+               ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
                break;
        }
        return FALSE;
diff --git a/common/options/getopt.c b/common/options/getopt.c
--- a/common/options/getopt.c
+++ b/common/options/getopt.c
@@ -912,7 +912,7 @@ char **argv;
                        break;
 
                default:
-                       printf("?? getopt returned character code 0%o ??\n", c);
+                       printf("?? getopt returned character code 0%o ??\n", 
(unsigned) c);
                }
        }
 
diff --git a/common/options/getopt1.c b/common/options/getopt1.c
--- a/common/options/getopt1.c
+++ b/common/options/getopt1.c
@@ -152,7 +152,7 @@ char **argv;
                        break;
 
                default:
-                       printf("?? getopt returned character code 0%o ??\n", c);
+                       printf("?? getopt returned character code 0%o ??\n", 
(unsigned) c);
                }
        }
 
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -3907,7 +3907,7 @@ bs_write(stream *restrict ss, const void
                                        if (' ' <= s->buf[i] && s->buf[i] < 127)
                                                putc(s->buf[i], stderr);
                                        else
-                                               fprintf(stderr, "\\%03o", 
s->buf[i]);
+                                               fprintf(stderr, "\\%03o", 
(unsigned char) s->buf[i]);
                                fprintf(stderr, "\"\n");
                        }
 #endif
@@ -3960,7 +3960,7 @@ bs_flush(stream *ss)
                                if (' ' <= s->buf[i] && s->buf[i] < 127)
                                        putc(s->buf[i], stderr);
                                else
-                                       fprintf(stderr, "\\%03o", s->buf[i]);
+                                       fprintf(stderr, "\\%03o", (unsigned 
char) s->buf[i]);
                        fprintf(stderr, "\"\n");
                        fprintf(stderr, "W %s 0\n", ss->name);
                }
@@ -4070,7 +4070,7 @@ bs_read(stream *restrict ss, void *restr
                                            ((char *) buf)[i] < 127)
                                                putc(((char *) buf)[i], stderr);
                                        else
-                                               fprintf(stderr, "\\%03o", 
((char *) buf)[i]);
+                                               fprintf(stderr, "\\%03o", 
((unsigned char *) buf)[i]);
                                fprintf(stderr, "\"\n");
                        }
 #endif
@@ -4407,12 +4407,12 @@ bs2_write(stream *restrict ss, const voi
                        {
                                size_t i;
 
-                               fprintf(stderr, "W %s %lu \"", ss->name, s->nr);
+                               fprintf(stderr, "W %s %zu \"", ss->name, s->nr);
                                for (i = 0; i < s->nr; i++)
                                        if (' ' <= s->buf[i] && s->buf[i] < 127)
                                                putc(s->buf[i], stderr);
                                        else
-                                               fprintf(stderr, "\\%03o", 
s->buf[i]);
+                                               fprintf(stderr, "\\%03o", 
(unsigned char) s->buf[i]);
                                fprintf(stderr, "\"\n");
                        }
 #endif
@@ -4471,12 +4471,12 @@ bs2_flush(stream *ss)
                if (s->nr > 0) {
                        size_t i;
 
-                       fprintf(stderr, "W %s %lu \"", ss->name, s->nr);
+                       fprintf(stderr, "W %s %zu \"", ss->name, s->nr);
                        for (i = 0; i < s->nr; i++)
                                if (' ' <= s->buf[i] && s->buf[i] < 127)
                                        putc(s->buf[i], stderr);
                                else
-                                       fprintf(stderr, "\\%03o", s->buf[i]);
+                                       fprintf(stderr, "\\%03o", (unsigned 
char) s->buf[i]);
                        fprintf(stderr, "\"\n");
                        fprintf(stderr, "W %s 0\n", ss->name);
                }
diff --git a/common/utils/muuid.c b/common/utils/muuid.c
--- a/common/utils/muuid.c
+++ b/common/utils/muuid.c
@@ -86,10 +86,10 @@ generateUUID(void)
                 * ("%08x-%04x-%04x-%04x-%012x") */
                snprintf(out, sizeof(out),
                         "%04x%04x-%04x-4%03x-8%03x-%04x%04x%04x",
-                        (unsigned) rand() % 65536U, (unsigned) rand() % 65536U,
-                        (unsigned) rand() % 65536U, (unsigned) rand() % 4096,
-                        (unsigned) rand() % 4096, (unsigned) rand() % 65536U,
-                        (unsigned) rand() % 65536U, (unsigned) rand() % 
65536U);
+                        (unsigned) rand() & 0xFFFF, (unsigned) rand() & 0xFFFF,
+                        (unsigned) rand() & 0xFFFF, (unsigned) rand() & 0x0FFF,
+                        (unsigned) rand() & 0x0FFF, (unsigned) rand() & 0xFFFF,
+                        (unsigned) rand() & 0xFFFF, (unsigned) rand() & 
0xFFFF);
        }
 #endif
        return strdup(out);
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -755,7 +755,7 @@ MT_mmap(const char *path, int mode, size
                h1 = CreateFile(path, mode0, mode1, &sa, OPEN_ALWAYS, mode2, 
NULL);
                if (h1 == INVALID_HANDLE_VALUE) {
                        GDKwinerror("MT_mmap: CreateFile('%s', %lu, %lu, &sa, 
%lu, %lu, NULL) failed\n",
-                                   path, mode0, mode1, (DWORD) OPEN_ALWAYS, 
mode2);
+                                   path, (unsigned long) mode0, (unsigned 
long) mode1, (unsigned long) OPEN_ALWAYS, (unsigned long) mode2);
                        return NULL;
                }
        }
@@ -763,9 +763,9 @@ MT_mmap(const char *path, int mode, size
        h2 = CreateFileMapping(h1, &sa, mode3, (DWORD) (((__int64) len >> 32) & 
LL_CONSTANT(0xFFFFFFFF)), (DWORD) (len & LL_CONSTANT(0xFFFFFFFF)), NULL);
        if (h2 == NULL) {
                GDKwinerror("MT_mmap: CreateFileMapping(%p, &sa, %lu, %lu, %lu, 
NULL) failed\n",
-                           h1, mode3,
-                           (DWORD) (((__int64) len >> 32) & 
LL_CONSTANT(0xFFFFFFFF)),
-                           (DWORD) (len & LL_CONSTANT(0xFFFFFFFF)));
+                           h1, (unsigned long) mode3,
+                           (unsigned long) (((unsigned __int64) len >> 32) & 
LL_CONSTANT(0xFFFFFFFF)),
+                           (unsigned long) (len & LL_CONSTANT(0xFFFFFFFF)));
                CloseHandle(h1);
                return NULL;
        }
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -403,7 +403,7 @@ GDKmremap_debug(const char *path, int mo
        size_t orig_new_size = *new_size;
        void *res = GDKmremap(path, mode, old_address, old_size, new_size);
        TRC_DEBUG(ALLOC, "GDKmremap(%s,0x%x,%p,%zu,%zu > %zu) -> %p\n",
-                 path ? path : "NULL", mode,
+                 path ? path : "NULL", (unsigned) mode,
                  old_address, old_size, orig_new_size, *new_size, res);
        return res;
 }
diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h
--- a/gdk/gdk_utils.h
+++ b/gdk/gdk_utils.h
@@ -300,7 +300,7 @@ GDKmmap_debug(const char *path, int mode
 {
        void *res = GDKmmap(path, mode, len);
        TRC_DEBUG(ALLOC, "GDKmmap(%s,0x%x,%zu) -> %p\n",
-                 path ? path : "NULL", mode, len, res);
+                 path ? path : "NULL", (unsigned) mode, len, res);
        return res;
 }
 #define GDKmmap(p, m, l)       GDKmmap_debug((p), (m), (l))
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -933,14 +933,14 @@ SERVERlisten(int port, const char *usock
                                host[sizeof(host) - 1] = '\0';
                        } else {
                                snprintf(host, 
sizeof(host),"[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]",
-                                               
(int)server_ipv6.sin6_addr.s6_addr[0],  (int)server_ipv6.sin6_addr.s6_addr[1],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[2],  (int)server_ipv6.sin6_addr.s6_addr[3],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[4],  (int)server_ipv6.sin6_addr.s6_addr[5],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[6],  (int)server_ipv6.sin6_addr.s6_addr[7],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[8],  (int)server_ipv6.sin6_addr.s6_addr[9],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[10], (int)server_ipv6.sin6_addr.s6_addr[11],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[12], (int)server_ipv6.sin6_addr.s6_addr[13],
-                                               
(int)server_ipv6.sin6_addr.s6_addr[14], (int)server_ipv6.sin6_addr.s6_addr[15]);
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[0],  
(uint8_t)server_ipv6.sin6_addr.s6_addr[1],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[2],  
(uint8_t)server_ipv6.sin6_addr.s6_addr[3],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[4],  
(uint8_t)server_ipv6.sin6_addr.s6_addr[5],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[6],  
(uint8_t)server_ipv6.sin6_addr.s6_addr[7],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[8],  
(uint8_t)server_ipv6.sin6_addr.s6_addr[9],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[10], 
(uint8_t)server_ipv6.sin6_addr.s6_addr[11],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[12], 
(uint8_t)server_ipv6.sin6_addr.s6_addr[13],
+                                               
(uint8_t)server_ipv6.sin6_addr.s6_addr[14], 
(uint8_t)server_ipv6.sin6_addr.s6_addr[15]);
                        }
                } else {
                        if (server_ipv4.sin_addr.s_addr == INADDR_ANY) {
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -1256,7 +1256,7 @@ mvc_drop_schema(mvc *m, sql_schema * s, 
 sql_ukey *
 mvc_create_ukey(mvc *m, sql_table *t, const char *name, key_type kt)
 {
-       TRC_DEBUG(SQL_TRANS, "Create ukey: %s %u\n", t->base.name, kt);
+       TRC_DEBUG(SQL_TRANS, "Create ukey: %s %u\n", t->base.name, (unsigned) 
kt);
        if (t->persistence == SQL_DECLARED_TABLE)
                return create_sql_ukey(m->sa, t, name, kt);     
        else
@@ -1275,7 +1275,7 @@ mvc_create_ukey_done(mvc *m, sql_key *k)
 sql_fkey *
 mvc_create_fkey(mvc *m, sql_table *t, const char *name, key_type kt, sql_key 
*rkey, int on_delete, int on_update)
 {
-       TRC_DEBUG(SQL_TRANS, "Create fkey: %s %u %p\n", t->base.name, kt, rkey);
+       TRC_DEBUG(SQL_TRANS, "Create fkey: %s %u %p\n", t->base.name, 
(unsigned) kt, rkey);
        if (t->persistence == SQL_DECLARED_TABLE)
                return create_sql_fkey(m->sa, t, name, kt, rkey, on_delete, 
on_update); 
        else
@@ -1318,7 +1318,7 @@ mvc_create_idx(mvc *m, sql_table *t, con
 {
        sql_idx *i;
 
-       TRC_DEBUG(SQL_TRANS, "Create index: %s %u\n", t->base.name, it);
+       TRC_DEBUG(SQL_TRANS, "Create index: %s %u\n", t->base.name, (unsigned) 
it);
        if (t->persistence == SQL_DECLARED_TABLE)
                /* declared tables should not end up in the catalog */
                return create_sql_idx(m->sa, t, name, it);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to