From 27fc87f5e86a51bbf7652152e7d171e3e8b0b674 Mon Sep 17 00:00:00 2001 From: driver1998 Date: Wed, 20 Mar 2019 02:42:55 +0800 Subject: [PATCH] Fixes various warnings on clang 9.0 --- src/config.c | 2 +- src/floppy/fdd_86f.c | 4 ++-- src/network/slirp/ip.h | 6 +++--- src/network/slirp/tcp.h | 2 +- src/network/slirp/tcp_var.h | 4 ++-- src/printer/printer.h | 2 +- src/printer/prt_cpmap.c | 6 +++--- src/scsi/scsi_ncr5380.c | 2 +- src/scsi/scsi_ncr53c8xx.h | 2 +- src/win/win_about.c | 2 +- src/win/win_devconf.c | 2 +- src/win/win_jsconf.c | 2 +- src/win/win_mouse.cpp | 42 ++++++++++++++++++------------------- src/win/win_new_floppy.c | 2 +- src/win/win_settings.c | 36 +++++++++++++++---------------- src/win/win_snd_gain.c | 2 +- src/win/win_stbar.c | 2 +- src/win/win_ui.c | 6 +++--- 18 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/config.c b/src/config.c index b4dae66e2..5653ebcb8 100644 --- a/src/config.c +++ b/src/config.c @@ -1911,7 +1911,7 @@ config_dump(void) while (sec != NULL) { entry_t *ent; - if (sec->name && sec->name[0]) + if (sec->name[0]) config_log("[%s]\n", sec->name); ent = (entry_t *)sec->entry_head.next; diff --git a/src/floppy/fdd_86f.c b/src/floppy/fdd_86f.c index 16de640b6..55ba012cc 100644 --- a/src/floppy/fdd_86f.c +++ b/src/floppy/fdd_86f.c @@ -1112,7 +1112,7 @@ d86f_get_bit(int drive, int side) /* In some cases, misindentification occurs so we need to make sure the surface data array is not not NULL. */ - if (d86f_has_surface_desc(drive) && dev->track_surface_data && dev->track_surface_data[side]) { + if (d86f_has_surface_desc(drive) && dev->track_surface_data[side]) { if (d86f_reverse_bytes(drive)) { surface_data = dev->track_surface_data[side][track_word] & 0xFF; } else { @@ -1124,7 +1124,7 @@ d86f_get_bit(int drive, int side) current_bit = (encoded_data >> track_bit) & 1; dev->last_word[side] <<= 1; - if (d86f_has_surface_desc(drive) && dev->track_surface_data && dev->track_surface_data[side]) { + if (d86f_has_surface_desc(drive) && dev->track_surface_data[side]) { surface_bit = (surface_data >> track_bit) & 1; if (! surface_bit) dev->last_word[side] |= current_bit; diff --git a/src/network/slirp/ip.h b/src/network/slirp/ip.h index 5fa673963..4ced4ef17 100644 --- a/src/network/slirp/ip.h +++ b/src/network/slirp/ip.h @@ -209,7 +209,7 @@ typedef u_int32_t caddr32_t; #endif #endif -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) typedef uintptr_t ipqp_32; typedef uintptr_t ipasfragp_32; #else @@ -230,7 +230,7 @@ typedef caddr32_t ipasfragp_32; #endif struct ipovly { -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) uintptr_t ih_next, ih_prev; /* for protocol sequence q's */ #else caddr32_t ih_next, ih_prev; /* for protocol sequence q's */ @@ -258,7 +258,7 @@ struct ipovly { * size 28 bytes */ struct ipq { -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) uintptr_t next,prev; /* to other reass headers */ #else ipqp_32 next,prev; /* to other reass headers */ diff --git a/src/network/slirp/tcp.h b/src/network/slirp/tcp.h index d9a8ccf72..5df25a8f0 100644 --- a/src/network/slirp/tcp.h +++ b/src/network/slirp/tcp.h @@ -33,7 +33,7 @@ #ifndef _TCP_H_ #define _TCP_H_ -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) typedef uintptr_t tcp_seq; #else typedef u_int32_t tcp_seq; diff --git a/src/network/slirp/tcp_var.h b/src/network/slirp/tcp_var.h index e6fbd3abb..a9606c276 100644 --- a/src/network/slirp/tcp_var.h +++ b/src/network/slirp/tcp_var.h @@ -36,7 +36,7 @@ #include "tcpip.h" #include "tcp_timer.h" -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) typedef uintptr_t tcpiphdrp_32; #else #if SIZEOF_CHAR_P == 4 @@ -178,7 +178,7 @@ struct tcpcb { * port numbers (which are no longer needed once we've located the * tcpcb) are overlayed with an mbuf pointer. */ -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) typedef uintptr_t mbufp_32; #else #if SIZEOF_CHAR_P == 4 diff --git a/src/printer/printer.h b/src/printer/printer.h index 88e52f8f5..33f7d58c9 100644 --- a/src/printer/printer.h +++ b/src/printer/printer.h @@ -58,7 +58,7 @@ #define FONT_FILE_OCRB L"ocra.ttf" -extern const void +extern void select_codepage(uint16_t code, uint16_t *curmap); diff --git a/src/printer/prt_cpmap.c b/src/printer/prt_cpmap.c index d29ace8a4..f7c7330f6 100644 --- a/src/printer/prt_cpmap.c +++ b/src/printer/prt_cpmap.c @@ -10,12 +10,12 @@ * * Version: @(#)prt_cpmap.c 1.0.2 2018/10/05 * - * Authors: Michael Drüing, + * Authors: Michael Dr�ing, * Fred N. van Kempen, * * Based on code by Frederic Weymann (originally for DosBox.) * - * Copyright 2018 Michael Drüing. + * Copyright 2018 Michael Dr�ing. * Copyright 2018 Fred N. van Kempen. * * Redistribution and use in source and binary forms, with @@ -572,7 +572,7 @@ static const struct { /* Select a ASCII->Unicode mapping by CP number */ -const void +void select_codepage(uint16_t code, uint16_t *curmap) { int i = 0; diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index e35c0cdf2..262725726 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -910,7 +910,7 @@ ncr_callback(void *priv) ncr_log("Select - target ID = %i\n", ncr->target_id); /*Once the device has been found and selected, mark it as busy*/ - if ((ncr->target_id != -1) && scsi_device_present(&scsi_devices[ncr->target_id])) { + if ((ncr->target_id != (uint8_t)-1) && scsi_device_present(&scsi_devices[ncr->target_id])) { ncr->cur_bus |= BUS_BSY; ncr_log("Device found at ID %i\n", ncr->target_id); ncr_log("Current Bus BSY=%02x\n", ncr->cur_bus); diff --git a/src/scsi/scsi_ncr53c8xx.h b/src/scsi/scsi_ncr53c8xx.h index bf2136e0d..e50e6d954 100644 --- a/src/scsi/scsi_ncr53c8xx.h +++ b/src/scsi/scsi_ncr53c8xx.h @@ -21,7 +21,7 @@ * Copyright 2009-2018 Artyom Tarasenko. * Copyright 2017,2018 Miran Grca. */ -#ifndef SCSI_NCR5C38XX_H +#ifndef SCSI_NCR53C8XX_H # define SCSI_NCR53C8XX_H diff --git a/src/win/win_about.c b/src/win/win_about.c index 355dd313d..ae0eea162 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -31,7 +31,7 @@ #include "win.h" -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c index b83c35e90..a0a1e5018 100644 --- a/src/win/win_devconf.c +++ b/src/win/win_devconf.c @@ -36,7 +36,7 @@ static device_context_t config_device; static uint8_t deviceconfig_changed = 0; -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_jsconf.c b/src/win/win_jsconf.c index 7fa1e52ce..1ca6f5ef8 100644 --- a/src/win/win_jsconf.c +++ b/src/win/win_jsconf.c @@ -150,7 +150,7 @@ static int get_pov(HWND hdlg, int id) return axis_sel - nr_povs; } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_mouse.cpp b/src/win/win_mouse.cpp index 5fab0ad9f..a57969196 100644 --- a/src/win/win_mouse.cpp +++ b/src/win/win_mouse.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "../86Box.h" +#include "../86box.h" #include "../mouse.h" #include "../plat.h" #include "win.h" @@ -60,10 +60,10 @@ win_mouse_init(void) void win_mouse_close(void) { - if (lpdi_mouse != NULL) { + if (lpdi_mouse != NULL) { lpdi_mouse->Release(); lpdi_mouse = NULL; - } + } } @@ -71,8 +71,8 @@ void mouse_poll(void) { static int buttons = 0; - static int x = 0, y = 0, z = 0; - int b; + static int x = 0, y = 0, z = 0; + int b; if (FAILED(lpdi_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate))) { @@ -81,23 +81,23 @@ mouse_poll(void) } if (mouse_capture || video_fullscreen) { - if (x != mousestate.lX || y != mousestate.lY || z != mousestate.lZ) { - mouse_x += mousestate.lX; - mouse_y += mousestate.lY; - mouse_z += mousestate.lZ/120; + if (x != mousestate.lX || y != mousestate.lY || z != mousestate.lZ) { + mouse_x += mousestate.lX; + mouse_y += mousestate.lY; + mouse_z += mousestate.lZ/120; - x = mousestate.lX; - y = mousestate.lY; - z = mousestate.lZ/120; - } + x = mousestate.lX; + y = mousestate.lY; + z = mousestate.lZ/120; + } - b = 0; - if (mousestate.rgbButtons[0] & 0x80) b |= 1; - if (mousestate.rgbButtons[1] & 0x80) b |= 2; - if (mousestate.rgbButtons[2] & 0x80) b |= 4; - if (buttons != b) { - mouse_buttons = b; - buttons = b; - } + b = 0; + if (mousestate.rgbButtons[0] & 0x80) b |= 1; + if (mousestate.rgbButtons[1] & 0x80) b |= 2; + if (mousestate.rgbButtons[2] & 0x80) b |= 4; + if (buttons != b) { + mouse_buttons = b; + buttons = b; + } } } diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 5a4dd7a1f..3b48b7f86 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -542,7 +542,7 @@ new_floppy_msgbox(HWND hwnd, int type, void *arg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 0bfd70fed..7a642fc69 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -154,7 +154,7 @@ image_list_init(HWND hwndList, const uint8_t *icon_ids) if (icon_ids[i] == 0) break; -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) hiconItem = LoadIcon(hinstance, (LPCWSTR) ((uint64_t) icon_ids[i])); #else hiconItem = LoadIcon(hinstance, (LPCWSTR) ((uint32_t) icon_ids[i])); @@ -644,7 +644,7 @@ win_settings_machine_recalc_machine(HWND hdlg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -858,7 +858,7 @@ recalc_vid_list(HWND hdlg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -977,7 +977,7 @@ mouse_valid(int num, int m) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -1128,7 +1128,7 @@ mpu401_standalone_allow(void) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -1335,7 +1335,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -1453,7 +1453,7 @@ recalc_hdc_list(HWND hdlg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -1785,7 +1785,7 @@ static void network_recalc_combos(HWND hdlg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -2513,7 +2513,7 @@ recalc_selection(HWND hdlg) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -3211,14 +3211,14 @@ hard_disk_track_all(void) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK #endif win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; + HWND h = NULL; int old_sel = 0, b = 0, assign = 0; const uint8_t hd_icons[2] = { 64, 0 }; @@ -4044,14 +4044,14 @@ zip_untrack(uint8_t id) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK #endif win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; + HWND h = NULL; int i = 0, old_sel = 0; WCHAR szText[256]; const uint8_t fd_icons[15] = { 248, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 0 }; @@ -4150,14 +4150,14 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK #endif win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; + HWND h = NULL; int old_sel = 0, b = 0, assign = 0; uint32_t b2 = 0; const uint8_t cd_icons[3] = { 249, 32, 0 }; @@ -4498,7 +4498,7 @@ win_settings_communicate_closure(void) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK @@ -4524,14 +4524,14 @@ win_settings_confirm(HWND hdlg, int button) } -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK #endif win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { - HWND h; + HWND h = NULL; int category, i = 0, j = 0; const uint8_t cat_icons[11] = { 240, 241, 242, 243, 80, 244, 245, 64, 246, 247, 0 }; diff --git a/src/win/win_snd_gain.c b/src/win/win_snd_gain.c index 6580fec7e..0dc4e5dcc 100644 --- a/src/win/win_snd_gain.c +++ b/src/win/win_snd_gain.c @@ -35,7 +35,7 @@ static uint8_t old_gain; -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index 13c6c9b20..d2fbb2d00 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -796,7 +796,7 @@ ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name) /* Handle messages for the Status Bar window. */ -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 02d45d532..fa06e4c26 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -349,7 +349,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Main Window. */ MoveWindow(hwnd, rect.left, rect.top, unscaled_size_x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2), - unscaled_size_y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1, +unscaled_size_y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1, TRUE); /* Render window. */ @@ -726,7 +726,7 @@ ui_init(int nCmdShow) WNDCLASSEX wincl; /* buffer for main window's class */ RAWINPUTDEVICE ridev; /* RawInput device */ MSG messages; /* received-messages buffer */ - HWND hwnd; /* handle for our window */ + HWND hwnd = NULL; /* handle for our window */ HACCEL haccel; /* handle to accelerator table */ int bRet; @@ -1060,7 +1060,7 @@ plat_mouse_capture(int on) /* Catch WM_INPUT messages for 'current focus' window. */ static LONG_PTR input_orig_proc; static HWND input_orig_hwnd = NULL; -#ifdef __amd64__ +#if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else static BOOL CALLBACK