OSDN Git Service

Fix MinGW-Bug #2248 (SF ticket).
authorKeith Marshall <keith@users.osdn.me>
Fri, 23 Nov 2018 21:06:43 +0000 (21:06 +0000)
committerKeith Marshall <keith@users.osdn.me>
Fri, 23 Nov 2018 21:06:43 +0000 (21:06 +0000)
w32api/ChangeLog
w32api/include/commctrl.h

index 8b51598..c197ea1 100644 (file)
@@ -1,5 +1,12 @@
 2018-11-23  Keith Marshall  <keith@users.osdn.me>
 
+       Fix MinGW-Bug #2248 (SF ticket).
+
+       * include/commctrl.h (NMPGSCROLL): Set packing to 1-byte alignment.
+       (NMPGSCROLL.fwKeys): Change type from BOOL to WORD.
+
+2018-11-23  Keith Marshall  <keith@users.osdn.me>
+
        Apply some more cosmetic layout adjustments.
 
        * include/commctrl.h: Keep 'typedef' and 'struct' on a single line,
index 69df63a..2bc2371 100644 (file)
@@ -2419,12 +2419,20 @@ typedef struct
   int                   iHeight;
 } NMPGCALCSIZE, *LPNMPGCALCSIZE;
 
+#pragma pack (push, 1)
+
 typedef struct
-{ /* FIXME: What are correct alignment constraints?  What is correct type
-   * for fwKeys field?  See: https://sourceforge.net/p/mingw/bugs/2248/
+{ /* Formerly, MinGW.org had this declared with 4-byte BOOL type for
+   * the "fwKeys" field, and no specific packing requirement.  Today,
+   * I can find no Microsoft documentation to support that declaration.
+   * Furthermore, https://sourceforge.net/p/mingw/bugs/2248/ shows, by
+   * way of a test case, that the correct declaration should probably
+   * have 2-byte WORD type for "fwKeys", (as hinted by its Hungarian
+   * notation name anyway), and the structure should be packed as
+   * tightly as possible.
    */
   NMHDR                 hdr;
-  BOOL                  fwKeys;
+  WORD                  fwKeys;
   RECT                  rcParent;
   int                   iDir;
   int                   iXpos;
@@ -2432,6 +2440,8 @@ typedef struct
   int                   iScroll;
 } NMPGSCROLL, *LPNMPGSCROLL;
 
+#pragma pack (pop)
+
 typedef
 struct tagNMSELCHANGE
 { NMHDR                 nmhdr;