diff options
author | FeralChild64 <unknown> | 2022-10-07 16:20:36 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2022-10-22 21:15:34 +0300 |
commit | 5982bf5fbc3e38c6c0fb915da5b782a730b3ae0d (patch) | |
tree | f514902d7a1691db0f3c01cb2425d55e2dc050f6 | |
parent | b2e3cef0eb5b297eed194c92e6fd16254bd50910 (diff) |
Silence compiler warnings in ManyMouse library
-rw-r--r-- | .github/workflows/windows-msvc.yml | 2 | ||||
-rw-r--r-- | src/libs/manymouse/linux_evdev.c | 5 | ||||
-rw-r--r-- | src/libs/manymouse/macosx_hidmanager.c | 25 | ||||
-rw-r--r-- | src/libs/manymouse/windows_wminput.c | 16 | ||||
-rw-r--r-- | src/libs/manymouse/x11_xinput2.c | 3 |
5 files changed, 34 insertions, 17 deletions
diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml index a9783e950..269c44923 100644 --- a/.github/workflows/windows-msvc.yml +++ b/.github/workflows/windows-msvc.yml @@ -23,7 +23,7 @@ jobs: max_warnings: 20 - name: MSVC 64-bit arch: x64 - max_warnings: 915 + max_warnings: 917 steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/src/libs/manymouse/linux_evdev.c b/src/libs/manymouse/linux_evdev.c index 0db138c7d..f68c449d7 100644 --- a/src/libs/manymouse/linux_evdev.c +++ b/src/libs/manymouse/linux_evdev.c @@ -4,6 +4,7 @@ * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. + * Altered to silence compiler warnings by Roman Standzikowski. */ #include "manymouse.h" @@ -145,7 +146,7 @@ static int poll_mouse(MouseStruct *mouse, ManyMouseEvent *outevent) } /* poll_mouse */ -static int init_mouse(const char *fname, int fd) +static int init_mouse(__attribute__((unused)) const char *fname, int fd) { MouseStruct *mouse = &mice[available_mice]; int has_absolutes = 0; @@ -261,7 +262,7 @@ static int linux_evdev_init(void) while ((dent = readdir(dirp)) != NULL) { char fname[128]; - snprintf(fname, sizeof (fname), "/dev/input/%s", dent->d_name); + snprintf(fname, sizeof (fname), "/dev/input/%.100s", dent->d_name); if (open_if_mouse(fname)) available_mice++; } /* while */ diff --git a/src/libs/manymouse/macosx_hidmanager.c b/src/libs/manymouse/macosx_hidmanager.c index b28792eca..1b183f52b 100644 --- a/src/libs/manymouse/macosx_hidmanager.c +++ b/src/libs/manymouse/macosx_hidmanager.c @@ -8,6 +8,7 @@ * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. + * Altered to silence compiler warnings by Roman Standzikowski. */ #include "manymouse.h" @@ -131,7 +132,7 @@ static int dequeue_event(ManyMouseEvent *event) /* returns non-zero if (a <= b). */ -typedef unsigned long long ui64; +/* typedef unsigned long long ui64; static inline int oldEvent(const AbsoluteTime *a, const AbsoluteTime *b) { #if 0 // !!! FIXME: doesn't work, timestamps aren't reliable. @@ -139,11 +140,12 @@ static inline int oldEvent(const AbsoluteTime *a, const AbsoluteTime *b) const ui64 b64 = (((unsigned long long) b->hi) << 32) | b->lo; #endif return 0; -} /* oldEvent */ +} */ /* oldEvent */ /* Callback fires whenever a device is unplugged/lost/whatever. */ -static void unplugged_callback(void *ctx, IOReturn res, void *sender) +static void unplugged_callback(void *ctx, __attribute__((unused)) IOReturn res, + __attribute__((unused)) void *sender) { const unsigned int idx = (unsigned int) ((size_t) ctx); if ((idx < physical_mice) && (mice[idx].device) && (mice[idx].logical >= 0)) @@ -171,7 +173,8 @@ static void unplugged_callback(void *ctx, IOReturn res, void *sender) /* Callback fires for new mouse input events. */ static void input_callback(void *ctx, IOReturn res, - void *sender, IOHIDValueRef val) + __attribute__((unused)) void *sender, + IOHIDValueRef val) { const unsigned int idx = (unsigned int) ((size_t) ctx); const MouseStruct *mouse = NULL; @@ -234,8 +237,10 @@ static void input_callback(void *ctx, IOReturn res, /* We ignore hotplugs...this callback is only for initial device discovery. */ -static void enum_callback(void *ctx, IOReturn res, - void *sender, IOHIDDeviceRef device) +static void enum_callback(__attribute__((unused)) void *ctx, + IOReturn res, + __attribute__((unused)) void *sender, + IOHIDDeviceRef device) { if (res == kIOReturnSuccess) { @@ -367,9 +372,17 @@ static void macosx_hidmanager_quit(void) static int macosx_hidmanager_init(void) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-pointer-compare" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress" + if (IOHIDManagerCreate == NULL) return -1; /* weak symbol is NULL...we don't have OS X >= 10.5.0 */ +#pragma GCC diagnostic pop +#pragma clang diagnostic pop + macosx_hidmanager_quit(); /* just in case... */ /* Prepare global (hidman), (mice), (physical_mice), etc. */ diff --git a/src/libs/manymouse/windows_wminput.c b/src/libs/manymouse/windows_wminput.c index ec106af54..cbdf5eace 100644 --- a/src/libs/manymouse/windows_wminput.c +++ b/src/libs/manymouse/windows_wminput.c @@ -4,6 +4,7 @@ * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. + * Altered to silence compiler warnings by Roman Standzikowski. */ #include "manymouse.h" @@ -38,7 +39,7 @@ static ManyMouseEvent input_events[MAX_EVENTS]; static volatile int input_events_read = 0; static volatile int input_events_write = 0; -static int available_mice = 0; +static unsigned int available_mice = 0; static int did_api_lookup = 0; static HWND raw_hwnd = NULL; static const char *class_name = "ManyMouseRawInputCatcher"; @@ -216,7 +217,7 @@ static void queue_event(const ManyMouseEvent *event) static void queue_from_rawinput(const RAWINPUT *raw) { - int i; + unsigned int i; const RAWINPUTHEADER *header = &raw->header; const RAWMOUSE *mouse = &raw->data.mouse; ManyMouseEvent event; @@ -312,7 +313,7 @@ static void queue_from_rawinput(const RAWINPUT *raw) } /* queue_from_rawinput */ -static void wminput_handler(WPARAM wParam, LPARAM lParam) +static void wminput_handler(LPARAM lParam) { UINT dwSize = 0; LPBYTE lpb; @@ -337,7 +338,7 @@ static void wminput_handler(WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK RawWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { if (Msg == WM_INPUT) - wminput_handler(wParam, lParam); + wminput_handler(lParam); else if (Msg == WM_DESTROY) return 0; @@ -485,11 +486,12 @@ static void init_mouse(const RAWINPUTDEVICELIST *dev) char *buf = NULL; char *ptr = NULL; UINT ct = 0; + UINT error_threshold = 1 << 31; if (dev->dwType != RIM_TYPEMOUSE) return; /* keyboard or some other fruity thing. */ - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, NULL, &ct) < 0) + if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, NULL, &ct) >= error_threshold) return; /* ct == is chars, not bytes, but we used the ASCII version. */ @@ -497,7 +499,7 @@ static void init_mouse(const RAWINPUTDEVICELIST *dev) if (buf == NULL) return; - if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, buf, &ct) < 0) + if (pGetRawInputDeviceInfoA(dev->hDevice, RIDI_DEVICENAME, buf, &ct) >= error_threshold) return; buf[ct] = '\0'; /* make sure it's null-terminated. */ @@ -540,7 +542,7 @@ static void init_mouse(const RAWINPUTDEVICELIST *dev) /* avoiding memcmp here so we don't get a C runtime dependency... */ if (ct >= sizeof (rdp_ident) - 1) { - int i; + unsigned int i; for (i = 0; i < sizeof (rdp_ident) - 1; i++) { if (buf[i] != rdp_ident[i]) diff --git a/src/libs/manymouse/x11_xinput2.c b/src/libs/manymouse/x11_xinput2.c index f287eaed8..3593443fc 100644 --- a/src/libs/manymouse/x11_xinput2.c +++ b/src/libs/manymouse/x11_xinput2.c @@ -4,6 +4,7 @@ * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. + * Altered to silence compiler warnings by Roman Standzikowski. */ #include "manymouse.h" @@ -341,7 +342,7 @@ static int find_mouse_by_devid(const int devid) int i; const MouseStruct *mouse = mice; - for (i = 0; i < available_mice; i++, mouse++) + for (i = 0; i < (int) available_mice; i++, mouse++) { if (mouse->device_id == devid) return (mouse->connected) ? i : -1; |