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)
This commit is contained in:
Eli Zaretskii 2021-05-09 10:59:08 +03:00
parent 127f1f330b
commit 4c3abb3dd1
11 changed files with 28 additions and 28 deletions

View file

@ -135,7 +135,7 @@ dynlib_addr (void (*funcptr) (void), const char **fname, const char **symname)
void *addr = (void *) funcptr; void *addr = (void *) funcptr;
/* Step 1: Find the handle of the module where ADDR lives. */ /* 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). */ /* Windows NT family version before XP (v5.1). */
|| ((w32_major_version + (w32_minor_version > 0)) < 6)) || ((w32_major_version + (w32_minor_version > 0)) < 6))
{ {

View file

@ -4674,7 +4674,7 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force)
/* volume_info is set indirectly by map_w32_filename. */ /* volume_info is set indirectly by map_w32_filename. */
oldname_dev = volume_info.serialnum; oldname_dev = volume_info.serialnum;
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
{ {
char * o; char * o;
char * p; char * p;
@ -10323,7 +10323,7 @@ shutdown_handler (DWORD type)
HANDLE HANDLE
maybe_load_unicows_dll (void) maybe_load_unicows_dll (void)
{ {
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
{ {
HANDLE ret = LoadLibrary ("Unicows.dll"); HANDLE ret = LoadLibrary ("Unicows.dll");
if (ret) if (ret)

View file

@ -41,8 +41,8 @@ extern int w32_minor_version;
extern int w32_build_number; extern int w32_build_number;
enum { enum {
OS_9X = 1, OS_SUBTYPE_9X = 1,
OS_NT OS_SUBTYPE_NT
}; };
extern int os_subtype; extern int os_subtype;

View file

@ -803,7 +803,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
ceol_initialized = FALSE; ceol_initialized = FALSE;
} }
if (os_subtype == OS_NT) if (os_subtype == OS_SUBTYPE_NT)
w32_console_unicode_input = 1; w32_console_unicode_input = 1;
else else
w32_console_unicode_input = 0; w32_console_unicode_input = 0;

View file

@ -8087,7 +8087,7 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
/* The Unicode version of SHFileOperation is not supported on /* The Unicode version of SHFileOperation is not supported on
Windows 9X. */ Windows 9X. */
if (w32_unicode_filenames && os_subtype != OS_9X) if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
{ {
SHFILEOPSTRUCTW file_op_w; SHFILEOPSTRUCTW file_op_w;
/* We need one more element beyond MAX_PATH because this is /* 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 /* When "mouse trails" are in effect, moving the mouse cursor
sometimes leaves behind an annoying "ghost" of the pointer. sometimes leaves behind an annoying "ghost" of the pointer.
Avoid that by momentarily switching off mouse trails. */ 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) && w32_major_version + w32_minor_version >= 6)
ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
SetCursorPos (XFIXNUM (x), XFIXNUM (y)); 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)) if (!OpenPrinter (pname_buf, &hPrn, NULL))
return Qnil; return Qnil;
/* GetPrinterW is not supported by unicows.dll. */ /* 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); GetPrinterW (hPrn, 2, NULL, 0, &dwNeeded);
else else
GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded); GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded);
@ -9401,7 +9401,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
return Qnil; return Qnil;
} }
/* Call GetPrinter again with big enough memory block. */ /* 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. */ /* Allocate memory for the PRINTER_INFO_2 struct. */
ppi2w = xmalloc (dwNeeded); ppi2w = xmalloc (dwNeeded);
@ -9537,9 +9537,9 @@ cache_system_info (void)
w32_minor_version = version.info.minor; w32_minor_version = version.info.minor;
if (version.info.platform & 0x8000) if (version.info.platform & 0x8000)
os_subtype = OS_9X; os_subtype = OS_SUBTYPE_9X;
else else
os_subtype = OS_NT; os_subtype = OS_SUBTYPE_NT;
/* Cache page size, allocation unit, processor type, etc. */ /* Cache page size, allocation unit, processor type, etc. */
GetSystemInfo (&sysinfo_cache); GetSystemInfo (&sysinfo_cache);
@ -9550,7 +9550,7 @@ cache_system_info (void)
GetVersionEx (&osinfo_cache); GetVersionEx (&osinfo_cache);
w32_build_number = osinfo_cache.dwBuildNumber; w32_build_number = osinfo_cache.dwBuildNumber;
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
w32_build_number &= 0xffff; w32_build_number &= 0xffff;
w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS); 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 /* On NT, call ToUnicode instead and then convert to the current
console input codepage. */ console input codepage. */
if (os_subtype == OS_NT) if (os_subtype == OS_SUBTYPE_NT)
{ {
WCHAR buf[128]; WCHAR buf[128];
@ -11078,7 +11078,7 @@ see `w32-ansi-code-page'. */);
w32_multibyte_code_page = _getmbcp (); w32_multibyte_code_page = _getmbcp ();
#endif #endif
if (os_subtype == OS_NT) if (os_subtype == OS_SUBTYPE_NT)
w32_unicode_gui = 1; w32_unicode_gui = 1;
else else
w32_unicode_gui = 0; w32_unicode_gui = 0;

View file

@ -269,7 +269,7 @@ init_heap (bool use_dynamic_heap)
} }
#endif #endif
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
{ {
the_malloc_fn = malloc_after_dump_9x; the_malloc_fn = malloc_after_dump_9x;
the_realloc_fn = realloc_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); 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"); fprintf (stderr, "Cannot dump Emacs on Windows 9X; exiting.\n");
exit (-1); exit (-1);

View file

@ -566,7 +566,7 @@ generate notifications correctly, though. */)
CHECK_LIST (filter); CHECK_LIST (filter);
/* The underlying features are available only since XP. */ /* 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)) || (w32_major_version == 5 && w32_minor_version < 1))
{ {
errno = ENOSYS; errno = ENOSYS;

View file

@ -623,7 +623,7 @@ init_timers (void)
need to probe for its availability dynamically, and call it need to probe for its availability dynamically, and call it
through a pointer. */ through a pointer. */
s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */ 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) s_pfn_Get_Thread_Times = (GetThreadTimes_Proc)
get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes"); 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)); GetClassName (hwnd, window_class, sizeof (window_class));
if (strcmp (window_class, if (strcmp (window_class,
(os_subtype == OS_9X) (os_subtype == OS_SUBTYPE_9X)
? "tty" ? "tty"
: "ConsoleWindowClass") == 0) : "ConsoleWindowClass") == 0)
{ {
@ -2877,7 +2877,7 @@ sys_kill (pid_t pid, int sig)
if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
{ {
#if 1 #if 1
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
{ {
/* /*
Another possibility is to try terminating the VDM out-right by 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 (!g_b_init_compare_string_w)
{ {
if (os_subtype == OS_9X) if (os_subtype == OS_SUBTYPE_9X)
{ {
pCompareStringW = (CompareStringW_Proc) pCompareStringW = (CompareStringW_Proc)
get_proc_addr (LoadLibrary ("Unicows.dll"), get_proc_addr (LoadLibrary ("Unicows.dll"),

View file

@ -1207,7 +1207,7 @@ globals_of_w32select (void)
QANSICP = coding_from_cp (ANSICP); QANSICP = coding_from_cp (ANSICP);
QOEMCP = coding_from_cp (OEMCP); QOEMCP = coding_from_cp (OEMCP);
if (os_subtype == OS_NT) if (os_subtype == OS_SUBTYPE_NT)
Vselection_coding_system = Qutf_16le_dos; Vselection_coding_system = Qutf_16le_dos;
else if (inhibit_window_system) else if (inhibit_window_system)
Vselection_coding_system = QOEMCP; Vselection_coding_system = QOEMCP;

View file

@ -1890,7 +1890,7 @@ w32_draw_image_foreground (struct glyph_string *s)
/* HALFTONE produces better results, especially when /* HALFTONE produces better results, especially when
scaling to a larger size, but Windows 9X doesn't scaling to a larger size, but Windows 9X doesn't
support HALFTONE. */ support HALFTONE. */
if (os_subtype == OS_NT if (os_subtype == OS_SUBTYPE_NT
&& (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
SetBrushOrgEx (s->hdc, 0, 0, NULL); SetBrushOrgEx (s->hdc, 0, 0, NULL);
StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, 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; int pmode = 0;
/* Windows 9X doesn't support HALFTONE. */ /* Windows 9X doesn't support HALFTONE. */
if (os_subtype == OS_NT if (os_subtype == OS_SUBTYPE_NT
&& (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
SetBrushOrgEx (s->hdc, 0, 0, NULL); SetBrushOrgEx (s->hdc, 0, 0, NULL);
StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, 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 /* When "mouse trails" are in effect, moving the mouse cursor
sometimes leaves behind an annoying "ghost" of the pointer. sometimes leaves behind an annoying "ghost" of the pointer.
Avoid that by momentarily switching off mouse trails. */ 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) && w32_major_version + w32_minor_version >= 6)
ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
SetCursorPos (pt.x, pt.y); 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 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 systems of the NT family, including W2K, XP, Vista, Windows 7 and
Windows 8. It is set to nil on Windows 9X. */); 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; w32_unicode_filenames = 0;
else else
w32_unicode_filenames = 1; w32_unicode_filenames = 1;

View file

@ -759,7 +759,7 @@ extern bool w32_image_rotations_p (void);
extern void setup_w32_kbdhook (void); extern void setup_w32_kbdhook (void);
extern void remove_w32_kbdhook (void); extern void remove_w32_kbdhook (void);
extern int check_w32_winkey_state (int); 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 #else
#define w32_kbdhook_active 0 #define w32_kbdhook_active 0
#endif #endif