]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix a few more clang-generated warnings.
authorSimon Tatham <anakin@pobox.com>
Sun, 5 Feb 2017 11:19:12 +0000 (11:19 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 5 Feb 2017 11:53:58 +0000 (11:53 +0000)
These are benign, I think. clang warns about casting non-pointer-sized
integers to pointers, but the Windows API actually does sometimes
involve values that are either pointers or _small_ integers, so in the
two cases involved I just cast through ULONG_PTR to silence the
warning. And clang insists that the integer whose address I give to
sk_getxdmdata is still uninitialised afterwards, which is just a lie.

windows/winctrls.c
windows/window.c
x11fwd.c

index a08771775ec18b8cdc4ea416802be110c262bce9..d5b962ae35f8251bd9719639fe77dcc857f5c781 100644 (file)
@@ -76,7 +76,7 @@ HWND doctl(struct ctlpos *cp, RECT r,
     if (cp->hwnd) {
        ctl = CreateWindowEx(exstyle, wclass, wtext, wstyle,
                             r.left, r.top, r.right, r.bottom,
-                            cp->hwnd, (HMENU) wid, hinst, NULL);
+                            cp->hwnd, (HMENU)(ULONG_PTR)wid, hinst, NULL);
        SendMessage(ctl, WM_SETFONT, cp->font, MAKELPARAM(TRUE, 0));
 
        if (!strcmp(wclass, "LISTBOX")) {
index 69a31593b381992f11153703a85c9dab817b6939..abb2b8ec713bed8ffe59d10c3ab67f6b98af692f 100644 (file)
@@ -1543,7 +1543,8 @@ static void init_fonts(int pick_width, int pick_height)
        if (cset == OEM_CHARSET)
            ucsdata.font_codepage = GetOEMCP();
        else
-           if (TranslateCharsetInfo ((DWORD *) cset, &info, TCI_SRCCHARSET))
+           if (TranslateCharsetInfo ((DWORD *)(ULONG_PTR)cset,
+                                      &info, TCI_SRCCHARSET))
                ucsdata.font_codepage = info.ciACP;
        else
            ucsdata.font_codepage = -1;
index bdfc4e743570f9173cf86d82040b593d41fc6e7e..584116aa69b29189ae93782da3ed0d5ffd15e2a8 100644 (file)
--- a/x11fwd.c
+++ b/x11fwd.c
@@ -934,7 +934,7 @@ int x11_send(struct X11Connection *xconn, char *data, int len)
          * Write a new connection header containing our replacement
          * auth data.
         */
-
+        socketdatalen = 0;             /* placate compiler warning */
         socketdata = sk_getxdmdata(xconn->s, &socketdatalen);
         if (socketdata && socketdatalen==6) {
             sprintf(new_peer_addr, "%d.%d.%d.%d", socketdata[0],