From 4c3abb3dd105e075bf1cf55e3fe8b5ec2ac8e6cc Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Sun, 9 May 2021 10:59:08 +0300
Subject: Fix compilation errors with latest w32 API headers

* src/w32common.h: Rename OS_* to OS_SUBTYPE__*, as w32 API
headers started defining OS_NT, which breaks the use of the
enumeration.  All users changed.  (Bug#48303)
---
 src/dynlib.c     |  2 +-
 src/w32.c        |  4 ++--
 src/w32common.h  |  4 ++--
 src/w32console.c |  2 +-
 src/w32fns.c     | 18 +++++++++---------
 src/w32heap.c    |  4 ++--
 src/w32notify.c  |  2 +-
 src/w32proc.c    |  8 ++++----
 src/w32select.c  |  2 +-
 src/w32term.c    |  8 ++++----
 src/w32term.h    |  2 +-
 11 files changed, 28 insertions(+), 28 deletions(-)

(limited to 'src')

diff --git a/src/dynlib.c b/src/dynlib.c
index 86f8b7e2063..62fc16e180d 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -135,7 +135,7 @@ dynlib_addr (void (*funcptr) (void), const char **fname, const char **symname)
   void *addr = (void *) funcptr;
 
   /* Step 1: Find the handle of the module where ADDR lives.  */
-  if (os_subtype == OS_9X
+  if (os_subtype == OS_SUBTYPE_9X
       /* Windows NT family version before XP (v5.1).  */
       || ((w32_major_version + (w32_minor_version > 0)) < 6))
     {
diff --git a/src/w32.c b/src/w32.c
index d4f31924429..f5b76979d74 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4674,7 +4674,7 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force)
   /* volume_info is set indirectly by map_w32_filename.  */
   oldname_dev = volume_info.serialnum;
 
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_SUBTYPE_9X)
     {
       char * o;
       char * p;
@@ -10323,7 +10323,7 @@ shutdown_handler (DWORD type)
 HANDLE
 maybe_load_unicows_dll (void)
 {
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_SUBTYPE_9X)
     {
       HANDLE ret = LoadLibrary ("Unicows.dll");
       if (ret)
diff --git a/src/w32common.h b/src/w32common.h
index 94bb457e59d..0f0be021b29 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -41,8 +41,8 @@ extern int    	      w32_minor_version;
 extern int    	      w32_build_number;
 
 enum {
-  OS_9X = 1,
-  OS_NT
+  OS_SUBTYPE_9X = 1,
+  OS_SUBTYPE_NT
 };
 
 extern int os_subtype;
diff --git a/src/w32console.c b/src/w32console.c
index cb9e288e880..99546c2d754 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -803,7 +803,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
       ceol_initialized = FALSE;
     }
 
-  if (os_subtype == OS_NT)
+  if (os_subtype == OS_SUBTYPE_NT)
     w32_console_unicode_input = 1;
   else
     w32_console_unicode_input = 0;
diff --git a/src/w32fns.c b/src/w32fns.c
index fcee1934ba9..00e7a3698bc 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8087,7 +8087,7 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
 
       /* The Unicode version of SHFileOperation is not supported on
 	 Windows 9X. */
-      if (w32_unicode_filenames && os_subtype != OS_9X)
+      if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
 	{
 	  SHFILEOPSTRUCTW file_op_w;
 	  /* We need one more element beyond MAX_PATH because this is
@@ -9216,7 +9216,7 @@ The coordinates X and Y are interpreted in pixels relative to a position
   /* When "mouse trails" are in effect, moving the mouse cursor
      sometimes leaves behind an annoying "ghost" of the pointer.
      Avoid that by momentarily switching off mouse trails.  */
-  if (os_subtype == OS_NT
+  if (os_subtype == OS_SUBTYPE_NT
       && w32_major_version + w32_minor_version >= 6)
     ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
   SetCursorPos (XFIXNUM (x), XFIXNUM (y));
@@ -9391,7 +9391,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
   if (!OpenPrinter (pname_buf, &hPrn, NULL))
     return Qnil;
   /* GetPrinterW is not supported by unicows.dll.  */
-  if (w32_unicode_filenames && os_subtype != OS_9X)
+  if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
     GetPrinterW (hPrn, 2, NULL, 0, &dwNeeded);
   else
     GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded);
@@ -9401,7 +9401,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
       return Qnil;
     }
   /* Call GetPrinter again with big enough memory block.  */
-  if (w32_unicode_filenames && os_subtype != OS_9X)
+  if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
     {
       /* Allocate memory for the PRINTER_INFO_2 struct.  */
       ppi2w = xmalloc (dwNeeded);
@@ -9537,9 +9537,9 @@ cache_system_info (void)
   w32_minor_version = version.info.minor;
 
   if (version.info.platform & 0x8000)
-    os_subtype = OS_9X;
+    os_subtype = OS_SUBTYPE_9X;
   else
-    os_subtype = OS_NT;
+    os_subtype = OS_SUBTYPE_NT;
 
   /* Cache page size, allocation unit, processor type, etc.  */
   GetSystemInfo (&sysinfo_cache);
@@ -9550,7 +9550,7 @@ cache_system_info (void)
   GetVersionEx (&osinfo_cache);
 
   w32_build_number = osinfo_cache.dwBuildNumber;
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_SUBTYPE_9X)
     w32_build_number &= 0xffff;
 
   w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
@@ -9717,7 +9717,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId)
 
   /* On NT, call ToUnicode instead and then convert to the current
      console input codepage.  */
-  if (os_subtype == OS_NT)
+  if (os_subtype == OS_SUBTYPE_NT)
     {
       WCHAR buf[128];
 
@@ -11078,7 +11078,7 @@ see `w32-ansi-code-page'.  */);
   w32_multibyte_code_page = _getmbcp ();
 #endif
 
-  if (os_subtype == OS_NT)
+  if (os_subtype == OS_SUBTYPE_NT)
     w32_unicode_gui = 1;
   else
     w32_unicode_gui = 0;
diff --git a/src/w32heap.c b/src/w32heap.c
index 07694d0f5cf..cdb8988e161 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -269,7 +269,7 @@ init_heap (bool use_dynamic_heap)
 	}
 #endif
 
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_SUBTYPE_9X)
         {
           the_malloc_fn = malloc_after_dump_9x;
           the_realloc_fn = realloc_after_dump_9x;
@@ -312,7 +312,7 @@ init_heap (bool use_dynamic_heap)
 	}
       heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params);
 
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_SUBTYPE_9X)
         {
           fprintf (stderr, "Cannot dump Emacs on Windows 9X; exiting.\n");
           exit (-1);
diff --git a/src/w32notify.c b/src/w32notify.c
index b9e90633923..889fd9f3c9f 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -566,7 +566,7 @@ generate notifications correctly, though.  */)
   CHECK_LIST (filter);
 
   /* The underlying features are available only since XP.  */
-  if (os_subtype == OS_9X
+  if (os_subtype == OS_SUBTYPE_9X
       || (w32_major_version == 5 && w32_minor_version < 1))
     {
       errno = ENOSYS;
diff --git a/src/w32proc.c b/src/w32proc.c
index b436eaff2c3..1233ea7e54a 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -623,7 +623,7 @@ init_timers (void)
      need to probe for its availability dynamically, and call it
      through a pointer.  */
   s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */
-  if (os_subtype != OS_9X)
+  if (os_subtype != OS_SUBTYPE_9X)
     s_pfn_Get_Thread_Times = (GetThreadTimes_Proc)
       get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes");
 
@@ -2653,7 +2653,7 @@ find_child_console (HWND hwnd, LPARAM arg)
 
       GetClassName (hwnd, window_class, sizeof (window_class));
       if (strcmp (window_class,
-		  (os_subtype == OS_9X)
+		  (os_subtype == OS_SUBTYPE_9X)
 		  ? "tty"
 		  : "ConsoleWindowClass") == 0)
 	{
@@ -2877,7 +2877,7 @@ sys_kill (pid_t pid, int sig)
       if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
 	{
 #if 1
-	  if (os_subtype == OS_9X)
+	  if (os_subtype == OS_SUBTYPE_9X)
 	    {
 /*
    Another possibility is to try terminating the VDM out-right by
@@ -3792,7 +3792,7 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
 
   if (!g_b_init_compare_string_w)
     {
-      if (os_subtype == OS_9X)
+      if (os_subtype == OS_SUBTYPE_9X)
 	{
 	  pCompareStringW = (CompareStringW_Proc)
             get_proc_addr (LoadLibrary ("Unicows.dll"),
diff --git a/src/w32select.c b/src/w32select.c
index 58cbea9130d..4d72295a279 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1207,7 +1207,7 @@ globals_of_w32select (void)
   QANSICP = coding_from_cp (ANSICP);
   QOEMCP = coding_from_cp (OEMCP);
 
-  if (os_subtype == OS_NT)
+  if (os_subtype == OS_SUBTYPE_NT)
     Vselection_coding_system = Qutf_16le_dos;
   else if (inhibit_window_system)
     Vselection_coding_system = QOEMCP;
diff --git a/src/w32term.c b/src/w32term.c
index 2de6b0d78c7..3b33b6bac13 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1890,7 +1890,7 @@ w32_draw_image_foreground (struct glyph_string *s)
 	      /* HALFTONE produces better results, especially when
 		 scaling to a larger size, but Windows 9X doesn't
 		 support HALFTONE.  */
-	      if (os_subtype == OS_NT
+	      if (os_subtype == OS_SUBTYPE_NT
 		  && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
 		SetBrushOrgEx (s->hdc, 0, 0, NULL);
 	      StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
@@ -1926,7 +1926,7 @@ w32_draw_image_foreground (struct glyph_string *s)
 	    {
 	      int pmode = 0;
 	      /* Windows 9X doesn't support HALFTONE.  */
-	      if (os_subtype == OS_NT
+	      if (os_subtype == OS_SUBTYPE_NT
 		  && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
 		SetBrushOrgEx (s->hdc, 0, 0, NULL);
 	      StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
@@ -6665,7 +6665,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
   /* When "mouse trails" are in effect, moving the mouse cursor
      sometimes leaves behind an annoying "ghost" of the pointer.
      Avoid that by momentarily switching off mouse trails.  */
-  if (os_subtype == OS_NT
+  if (os_subtype == OS_SUBTYPE_NT
       && w32_major_version + w32_minor_version >= 6)
     ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
   SetCursorPos (pt.x, pt.y);
@@ -7652,7 +7652,7 @@ specified by `file-name-coding-system'.
 This variable is set to non-nil by default when Emacs runs on Windows
 systems of the NT family, including W2K, XP, Vista, Windows 7 and
 Windows 8.  It is set to nil on Windows 9X.  */);
-  if (os_subtype == OS_9X)
+  if (os_subtype == OS_SUBTYPE_9X)
     w32_unicode_filenames = 0;
   else
     w32_unicode_filenames = 1;
diff --git a/src/w32term.h b/src/w32term.h
index 44378aa4c27..e55efaa13ff 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -759,7 +759,7 @@ extern bool w32_image_rotations_p (void);
 extern void setup_w32_kbdhook (void);
 extern void remove_w32_kbdhook (void);
 extern int check_w32_winkey_state (int);
-#define w32_kbdhook_active (os_subtype != OS_9X)
+#define w32_kbdhook_active (os_subtype != OS_SUBTYPE_9X)
 #else
 #define w32_kbdhook_active 0
 #endif
-- 
cgit v1.2.3