Skip to content

Commit

Permalink
[build] Silence compilation warnings
Browse files Browse the repository at this point in the history
Do not use the same buffer for readlink() input and output.

Add missing "fall through" comments and tell gcc to be less
strict about wording / capitalization of existing ones.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jan 30, 2020
1 parent c34d8cd commit 67ce438
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -262,6 +262,7 @@ CFLAGS += -Wstack-protector
#CFLAGS += -Werror (OBS build might have different compiler)
CFLAGS += -Wno-declaration-after-statement
CFLAGS += -Wno-missing-field-initializers
CFLAGS += -Wimplicit-fallthrough=2

# Linker
LDLIBS += -Wl,--as-needed
Expand Down
10 changes: 6 additions & 4 deletions evdev.c
Expand Up @@ -2,7 +2,8 @@
* @file evdev.c
* Mode Control Entity - evdev input device handling
* <p>
* Copyright (C) 2012-2019 Jolla Ltd.
* Copyright (c) 2012 - 2020 Jolla Ltd.
* Copyright (c) 2020 Open Mobile Platform LLC.
* <p>
* @author Simo Piiroinen <simo.piiroinen@jollamobile.com>
*
Expand Down Expand Up @@ -262,16 +263,17 @@ int evdev_identify_device(int fd)
unsigned long bmap_type[BMAP_SIZE(EV_CNT)];
unsigned long bmap_code[BMAP_SIZE(KEY_CNT)];
unsigned long bmap_stat[BMAP_SIZE(KEY_CNT)];
char path[256];
char linkpath[PATH_MAX];
char path[PATH_MAX];
int n;

if( fd < 0 )
{
goto cleanup;
}

snprintf(path, sizeof path, "/proc/self/fd/%d", fd);
if( (n = readlink(path, path, sizeof path - 1)) <= 0 )
snprintf(linkpath, sizeof linkpath, "/proc/self/fd/%d", fd);
if( (n = readlink(linkpath, path, sizeof path - 1)) <= 0 )
{
strcpy(path, "unknown");
}
Expand Down
6 changes: 4 additions & 2 deletions event-input.c
Expand Up @@ -2,8 +2,9 @@
* @file event-input.c
* /dev/input event provider for the Mode Control Entity
* <p>
* Copyright © 2004-2011 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2013-2019 Jolla Ltd.
* Copyright (c) 2004 - 2011 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (c) 2013 - 2020 Jolla Ltd.
* Copyright (c) 2020 Open Mobile Platform LLC.
* <p>
* @author David Weinehall <david.weinehall@nokia.com>
* @author Ismo Laitinen <ismo.laitinen@nokia.com>
Expand Down Expand Up @@ -3542,6 +3543,7 @@ evin_datapipe_display_state_curr_cb(gconstpointer data)
evin_input_grab_set_touching(&evin_ts_grab_state, true);
evin_input_grab_set_touching(&evin_ts_grab_state, false);
}
/* Fall through */

case MCE_DISPLAY_ON:
case MCE_DISPLAY_DIM:
Expand Down

0 comments on commit 67ce438

Please sign in to comment.