changeset 1997:0e354f2edb16

Win: Fixed a number of Visual C warnings show in the IDE.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 24 Oct 2019 23:57:51 +0000
parents 289a8ca4855b
children a3de27b07a8d
files win/dw.c
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Wed Oct 16 21:47:10 2019 +0000
+++ b/win/dw.c	Thu Oct 24 23:57:51 2019 +0000
@@ -1338,7 +1338,7 @@
  */
 void _initial_focus(HWND handle)
 {
-   Box *thisbox;
+   Box *thisbox = NULL;
    TCHAR tmpbuf[100] = {0};
 
    if(!handle)
@@ -2774,7 +2774,8 @@
 
             if(!cinfo || !cinfo->pOldProc)
                ret = DefWindowProc(hWnd, msg, mp1, mp2);
-            ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
+            else
+               ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
 
             /* Tell the edit control that a buttonpress has
              * occured and to update it's window title.
@@ -3125,7 +3126,7 @@
                         if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0)))
                         {
                            SetBkColor((HDC)mp1, _dw_transparencykey);
-                           if(thiscinfo->hbrush)
+                           if(thiscinfo && thiscinfo->hbrush)
                               DeleteObject(thiscinfo->hbrush);
                            thiscinfo->hbrush = CreateSolidBrush(_dw_transparencykey);
                            SelectObject((HDC)mp1, thiscinfo->hbrush);
@@ -5140,7 +5141,7 @@
    /* Free temporary bitmaps */
    if(ii.hbmColor)
       DeleteObject(ii.hbmColor);
-   if(ii.hbmMask);
+   if(ii.hbmMask)
       DeleteObject(ii.hbmMask);
 }
 
@@ -5182,9 +5183,8 @@
                 oldfont = cinfo->hfont;
             cinfo->hfont = hfont;
         }
-        else
+        else if(cinfo = calloc(1, sizeof(ColorInfo)))
         {
-            cinfo = calloc(1, sizeof(ColorInfo));
             cinfo->fore = cinfo->back = -1;
 
             strncpy(cinfo->fontname, fontname, 127);
@@ -5354,10 +5354,8 @@
       cinfo->fore = fore;
       cinfo->back = back;
    }
-   else
-   {
-      cinfo = calloc(1, sizeof(ColorInfo));
-
+   else if(cinfo = calloc(1, sizeof(ColorInfo)))
+   {
       cinfo->fore = fore;
       cinfo->back = back;