Commit afb0606f5ac9972954b8afc2cf1c540a1ddecde7

Ozkan Sezer 2022-03-10T18:50:10

minor os/2 clean-ups.

diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c
index 52f1483..95aae6f 100644
--- a/src/video/os2/SDL_os2dive.c
+++ b/src/video/os2/SDL_os2dive.c
@@ -67,10 +67,12 @@ OS2VIDEOOUTPUT voDive = {
 
 static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo)
 {
-    DIVE_CAPS sDiveCaps = { 0 };
-    FOURCC fccFormats[100] = { 0 };
+    DIVE_CAPS sDiveCaps;
+    FOURCC fccFormats[100];
 
     /* Query information about display hardware from DIVE. */
+    SDL_zeroa(fccFormats);
+    SDL_zero(sDiveCaps);
     sDiveCaps.pFormatData    = fccFormats;
     sDiveCaps.ulFormatLength = 100;
     sDiveCaps.ulStructLen    = sizeof(DIVE_CAPS);
@@ -172,7 +174,7 @@ static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd,
             /* Setup DIVE blitter. */
             SETUP_BLITTER   sSetupBlitter;
             SWP             swp;
-            POINTL          pointl = { 0 };
+            POINTL          pointl = { 0,0 };
 
             WinQueryWindowPos(hwnd, &swp);
             WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1);
diff --git a/src/video/os2/SDL_os2util.c b/src/video/os2/SDL_os2util.c
index adc2fd5..bcc6c54 100644
--- a/src/video/os2/SDL_os2util.c
+++ b/src/video/os2/SDL_os2util.c
@@ -27,8 +27,8 @@
 HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY)
 {
     HBITMAP             hbm;
-    BITMAPINFOHEADER2   bmih = { 0 };
-    BITMAPINFO          bmi = { 0 };
+    BITMAPINFOHEADER2   bmih;
+    BITMAPINFO          bmi;
     HPS                 hps;
     PULONG              pulBitmap;
     PULONG              pulDst, pulSrc, pulDstMask;
@@ -40,7 +40,7 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY)
         return NULLHANDLE;
     }
 
-    pulBitmap = SDL_malloc(surface->h * surface->w * 4 * 2);
+    pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG));
     if (pulBitmap == NULL) {
         SDL_OutOfMemory();
         return NULLHANDLE;
@@ -72,6 +72,9 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY)
     }
 
     /* Create system bitmap object. */
+    SDL_zero(bmih);
+    SDL_zero(bmi);
+
     bmih.cbFix          = sizeof(BITMAPINFOHEADER2);
     bmih.cx             = surface->w;
     bmih.cy             = 2 * surface->h;
diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index 6b9fcda..64731d7 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -335,7 +335,7 @@ static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2)
 static VOID _wmMove(WINDATA *pWinData)
 {
     SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(pWinData->window);
-    POINTL  pointl = { 0 };
+    POINTL  pointl = { 0,0 };
     RECTL   rectl;
 
     WinQueryWindowRect(pWinData->hwnd, &rectl);
@@ -1219,7 +1219,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape,
 {
     SDL_ShapeTree *pShapeTree;
     WINDATA       *pWinData;
-    SHAPERECTS     stShapeRects = { 0 };
+    SHAPERECTS     stShapeRects;
     HPS            hps;
 
     debug_os2("Enter");
@@ -1235,6 +1235,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape,
     pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape);
     shaper->driverdata = pShapeTree;
 
+    SDL_zero(stShapeRects);
     stShapeRects.ulWinHeight = shaper->window->h;
     SDL_TraverseShapeTree(pShapeTree, &_combineRectRegions, &stShapeRects);
 
diff --git a/src/video/os2/SDL_os2vman.c b/src/video/os2/SDL_os2vman.c
index 3fb93f1..acb9200 100644
--- a/src/video/os2/SDL_os2vman.c
+++ b/src/video/os2/SDL_os2vman.c
@@ -91,10 +91,10 @@ static VOID APIENTRY ExitVMan(VOID)
 static BOOL _vmanInit(void)
 {
     ULONG       ulRC;
-    CHAR        acBuf[255];
+    CHAR        acBuf[256];
     INITPROCOUT stInitProcOut;
 
-    if (hmodVMan != NULLHANDLE) /* Already was initialized */
+    if (hmodVMan != NULLHANDLE) /* already initialized */
         return TRUE;
 
     /* Load vman.dll */
@@ -108,8 +108,7 @@ static BOOL _vmanInit(void)
     /* Get VMIEntry */
     ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry);
     if (ulRC != NO_ERROR) {
-        debug_os2("Could not query address of pfnVMIEntry func. of VMAN.DLL, "
-                  "rc = %u", ulRC);
+        debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC);
         DosFreeModule(hmodVMan);
         hmodVMan = NULLHANDLE;
         return FALSE;
@@ -327,9 +326,8 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
     PPOINTL     pptlSrcOrg;
     PBLTRECT    pbrDst;
     HWREQIN     sHWReqIn;
-    BITBLTINFO  sBitbltInfo = { 0 };
+    BITBLTINFO  sBitbltInfo;
     ULONG       ulIdx;
-/*  RECTL       rectlScreenUpdate;*/
 
     if (pVOData->pBuffer == NULL)
         return FALSE;
@@ -454,6 +452,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
         rclSrcBounds.xRight = bmiSrc.ulWidth;
         rclSrcBounds.yTop = bmiSrc.ulHeight;
 
+        SDL_zero(sBitbltInfo);
         sBitbltInfo.ulLength = sizeof(BITBLTINFO);
         sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW;
         sBitbltInfo.cBlits = cSDLRects;