gdi32: Use BOOL type where appropriate

Frédéric Delanoy frederic.delanoy at gmail.com
Thu Oct 10 14:52:42 CDT 2013


---
 dlls/gdi32/dibdrv/opengl.c |  4 ++--
 dlls/gdi32/freetype.c      | 40 +++++++++++++++++++++++-----------------
 dlls/gdi32/region.c        |  2 +-
 3 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/dlls/gdi32/dibdrv/opengl.c b/dlls/gdi32/dibdrv/opengl.c
index add0b01..28a03f4 100644
--- a/dlls/gdi32/dibdrv/opengl.c
+++ b/dlls/gdi32/dibdrv/opengl.c
@@ -98,13 +98,13 @@ static const int nb_formats = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
 
 static BOOL init_opengl(void)
 {
-    static int init_done;
+    static BOOL init_done = FALSE;
     static void *osmesa_handle;
     char buffer[200];
     unsigned int i;
 
     if (init_done) return (osmesa_handle != NULL);
-    init_done = 1;
+    init_done = TRUE;
 
     osmesa_handle = wine_dlopen( SONAME_LIBOSMESA, RTLD_NOW, buffer, sizeof(buffer) );
     if (osmesa_handle == NULL)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 69779b8..905fd4f 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -904,32 +904,38 @@ static inline FT_Fixed FT_FixedFromFIXED(FIXED f)
 
 static BOOL is_hinting_enabled(void)
 {
-    static int enabled = -1;
+    static BOOL init_done = FALSE;
+    static BOOL enabled   = FALSE;
 
-    if (enabled == -1)
+    if (init_done)
+        return enabled;
+    init_done = TRUE;
+
+    /* Use the >= 2.2.0 function if available */
+    if (pFT_Get_TrueType_Engine_Type)
     {
-        /* Use the >= 2.2.0 function if available */
-        if (pFT_Get_TrueType_Engine_Type)
-        {
-            FT_TrueTypeEngineType type = pFT_Get_TrueType_Engine_Type(library);
-            enabled = (type == FT_TRUETYPE_ENGINE_TYPE_PATENTED);
-        }
-        else enabled = FALSE;
-        TRACE("hinting is %senabled\n", enabled ? "" : "NOT ");
+        FT_TrueTypeEngineType type = pFT_Get_TrueType_Engine_Type(library);
+        enabled = (type == FT_TRUETYPE_ENGINE_TYPE_PATENTED);
     }
+    TRACE("hinting is %senabled\n", enabled ? "" : "NOT ");
+
     return enabled;
 }
 
 static BOOL is_subpixel_rendering_enabled( void )
 {
 #ifdef HAVE_FREETYPE_FTLCDFIL_H
-    static int enabled = -1;
-    if (enabled == -1)
-    {
-        enabled = (pFT_Library_SetLcdFilter &&
-                   pFT_Library_SetLcdFilter( NULL, 0 ) != FT_Err_Unimplemented_Feature);
-        TRACE("subpixel rendering is %senabled\n", enabled ? "" : "NOT ");
-    }
+    static BOOL init_done = FALSE;
+    static BOOL enabled;
+
+    if (init_done)
+        return enabled;
+    init_done = TRUE;
+
+    enabled = (pFT_Library_SetLcdFilter &&
+               pFT_Library_SetLcdFilter( NULL, 0 ) != FT_Err_Unimplemented_Feature);
+    TRACE("subpixel rendering is %senabled\n", enabled ? "" : "NOT ");
+
     return enabled;
 #else
     return FALSE;
diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c
index 1c31d42..062272d 100644
--- a/dlls/gdi32/region.c
+++ b/dlls/gdi32/region.c
@@ -2664,7 +2664,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
     struct list AET;                 /* header for AET     */
     EdgeTableEntry *pETEs;           /* EdgeTableEntries pool   */
     ScanLineListBlock SLLBlock;      /* header for scanlinelist */
-    int fixWAET = FALSE;
+    BOOL fixWAET = FALSE;
     struct point_block FirstPtBlock, *block; /* PtBlock buffers    */
     struct edge_table_entry *active, *next;
     INT poly, total;
-- 
1.8.4




More information about the wine-patches mailing list