aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-23 02:33:06 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-23 03:05:01 +0200
commit56f7847ce3f6c3f56ed5735afb4431402cf3675e (patch)
treeed1c1d4505f38ed06fb1051ee43a8d663f90a2a4
parentb630bf7a5f5ec85317db04f770ffc90664ac28f0 (diff)
downloadtermo-56f7847ce3f6c3f56ed5735afb4431402cf3675e.tar.gz
termo-56f7847ce3f6c3f56ed5735afb4431402cf3675e.tar.xz
termo-56f7847ce3f6c3f56ed5735afb4431402cf3675e.zip
Add -Wextra
-rw-r--r--Makefile2
-rw-r--r--demo-async.c3
-rw-r--r--driver-csi.c22
-rw-r--r--driver-ti.c4
4 files changed, 27 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 410ed33..b96a1d6 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ifneq ($(VERBOSE),1)
LIBTOOL +=--quiet
endif
-CFLAGS +=-Wall -std=c99
+CFLAGS +=-Wall -Wextra -std=c99
ifeq ($(DEBUG),1)
CFLAGS +=-ggdb -DDEBUG
diff --git a/demo-async.c b/demo-async.c
index 51bc1b3..afe1d24 100644
--- a/demo-async.c
+++ b/demo-async.c
@@ -17,6 +17,9 @@ on_key (termkey_t *tk, termkey_key_t *key)
int
main (int argc, char *argv[])
{
+ (void) argc;
+ (void) argv;
+
TERMKEY_CHECK_VERSION;
termkey_t *tk = termkey_new (0, 0);
diff --git a/driver-csi.c b/driver-csi.c
index c2b2673..9fd1bb6 100644
--- a/driver-csi.c
+++ b/driver-csi.c
@@ -29,6 +29,8 @@ static termkey_result_t
handle_csi_ss3_full (termkey_t *tk,
termkey_key_t *key, int cmd, long *arg, int args)
{
+ (void) tk;
+
if (args > 1 && arg[1] != -1)
key->modifiers = arg[1] - 1;
else
@@ -90,11 +92,13 @@ register_ss3kpalt (termkey_type_t type, termkey_sym_t sym,
/* This value must be increased if more CSI function keys are added */
static struct keyinfo csifuncs[35];
-#define NCSIFUNCS (sizeof csifuncs / sizeof csifuncs[0])
+#define NCSIFUNCS ((long) (sizeof csifuncs / sizeof csifuncs[0]))
static termkey_result_t
handle_csifunc (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{
+ (void) cmd;
+
if (args > 1 && arg[1] != -1)
key->modifiers = arg[1] - 1;
else
@@ -177,6 +181,8 @@ handle_csi_u (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
static termkey_result_t
handle_csi_m (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{
+ (void) tk;
+
int initial = cmd >> 8;
cmd &= 0xff;
@@ -224,6 +230,8 @@ termkey_result_t
termkey_interpret_mouse (termkey_t *tk, const termkey_key_t *key,
termkey_mouse_event_t *event, int *button, int *line, int *col)
{
+ (void) tk;
+
if (key->type != TERMKEY_TYPE_MOUSE)
return TERMKEY_RES_NONE;
@@ -298,6 +306,8 @@ termkey_result_t
termkey_interpret_position (termkey_t *tk,
const termkey_key_t *key, int *line, int *col)
{
+ (void) tk;
+
if (key->type != TERMKEY_TYPE_POSITION)
return TERMKEY_RES_NONE;
@@ -312,6 +322,8 @@ termkey_interpret_position (termkey_t *tk,
static termkey_result_t
handle_csi_y (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{
+ (void) tk;
+
switch (cmd)
{
case 'y' | '$' << 16:
@@ -335,6 +347,8 @@ termkey_result_t
termkey_interpret_modereport (termkey_t *tk,
const termkey_key_t *key, int *initial, int *mode, int *value)
{
+ (void) tk;
+
if (key->type != TERMKEY_TYPE_MODEREPORT)
return TERMKEY_RES_NONE;
@@ -524,6 +538,8 @@ register_keys (void)
static void *
new_driver (termkey_t *tk, const char *term)
{
+ (void) term;
+
if (!keyinfo_initialised && !register_keys ())
return NULL;
@@ -546,6 +562,8 @@ static termkey_result_t
peekkey_csi (termkey_t *tk, termkey_csi_t *csi,
size_t introlen, termkey_key_t *key, int force, size_t *nbytep)
{
+ (void) csi;
+
size_t csi_len;
size_t args = 16;
long arg[16];
@@ -621,6 +639,8 @@ static termkey_result_t
peekkey_ss3 (termkey_t *tk, termkey_csi_t *csi, size_t introlen,
termkey_key_t *key, int force, size_t *nbytep)
{
+ (void) csi;
+
if (tk->buffcount < introlen + 1)
{
if (!force)
diff --git a/driver-ti.c b/driver-ti.c
index ab76c25..54ef27c 100644
--- a/driver-ti.c
+++ b/driver-ti.c
@@ -332,7 +332,7 @@ start_driver (termkey_t *tk, void *info)
len = strlen (start_string);
while (len)
{
- size_t written = write (tk->fd, start_string, len);
+ ssize_t written = write (tk->fd, start_string, len);
if (written == -1)
return 0;
start_string += written;
@@ -368,7 +368,7 @@ stop_driver (termkey_t *tk, void *info)
len = strlen (stop_string);
while (len)
{
- size_t written = write (tk->fd, stop_string, len);
+ ssize_t written = write (tk->fd, stop_string, len);
if (written == -1)
return 0;
stop_string += written;