freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master 501ac20 2/4: * graph/win32/grwin32.c: Fix compi


From: Werner Lemberg
Subject: [freetype2-demos] master 501ac20 2/4: * graph/win32/grwin32.c: Fix compiler warnings
Date: Wed, 26 May 2021 09:50:29 -0400 (EDT)

branch: master
commit 501ac20f725e17cf44b06398b650f57219f3e605
Author: David Turner <david@freetype.org>
Commit: David Turner <david.turner.dev@gmail.com>

    * graph/win32/grwin32.c: Fix compiler warnings
    
    - Redefine the LCS_sRGB macro to properly compile with the Mingw64
      toolchain and the -Wmultichar warning enabled.
    
    - Add missing return code paths in function.
---
 ChangeLog             |  9 +++++++++
 graph/win32/grwin32.c | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a7dfa84..87ebffb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-05-23  David Turner  <david@freetype.org>
+
+        * graph/win32/grwin32.c: Fix compiler warnings
+
+        - Redefine the LCS_sRGB macro to properly compile with the Mingw64
+         toolchain and the -Wmultichar warning enabled.
+
+        - Add missing return code paths in function.
+
 2021-05-22  David Turner  <david@freetype.org>
 
         * src/ftbench.c: Fix get_time() for Mingw64
diff --git a/graph/win32/grwin32.c b/graph/win32/grwin32.c
index 799e4e3..a078a57 100644
--- a/graph/win32/grwin32.c
+++ b/graph/win32/grwin32.c
@@ -256,6 +256,15 @@ gr_win32_surface_set_icon( grWin32Surface*  surface,
   ICONINFO  ici = { TRUE };
   HICON     hIcon;
 
+/* NOTE: The Mingw64 wingdi.h defines this macro as 'sRGB'
+ * which triggers the -Wmultichar warning during compilation,
+ * so replace it with the corresponding numerical value.
+ */
+#ifdef __MINGW64__
+#undef  LCS_sRGB
+#define LCS_sRGB 0x73524742
+#endif
+
   BITMAPV4HEADER  hdr = { sizeof( BITMAPV4HEADER ),
                           0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0,
                           0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
@@ -297,6 +306,8 @@ gr_win32_surface_set_icon( grWin32Surface*  surface,
   case ICON_BIG:
     surface->bIcon = hIcon;
     return s[0];
+  default:
+    return 0;  /* should not happen */
   }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]