48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
|
|
From 5648239f18ac041fe1a93b8b784bf3ca8e1d83bc Mon Sep 17 00:00:00 2001
|
||
|
|
From: nick black <nick.black@sprezzatech.com>
|
||
|
|
Date: Fri, 8 Feb 2013 05:52:13 -0500
|
||
|
|
Subject: [PATCH 07/21] fix highly illegal return of int as char *, and less
|
||
|
|
worrying set-but-not-used warning
|
||
|
|
|
||
|
|
---
|
||
|
|
src/twiddler.c | 9 +++++----
|
||
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/twiddler.c b/src/twiddler.c
|
||
|
|
index 1d2bd50..972a616 100644
|
||
|
|
--- a/src/twiddler.c
|
||
|
|
+++ b/src/twiddler.c
|
||
|
|
@@ -250,7 +250,6 @@ static inline int twiddler_use_item(char *item)
|
||
|
|
int twiddler_key(unsigned long message)
|
||
|
|
{
|
||
|
|
char **table = twiddler_get_table(message);
|
||
|
|
- char *val;
|
||
|
|
/*
|
||
|
|
* These two are needed to avoid transmitting single keys when typing
|
||
|
|
* chords. When the number of keys being held down decreases, data
|
||
|
|
@@ -269,7 +268,6 @@ int twiddler_key(unsigned long message)
|
||
|
|
|
||
|
|
if (!table) return 0;
|
||
|
|
message &= 0xff;
|
||
|
|
- val = table[message];
|
||
|
|
|
||
|
|
if ((message < last_message) && !marked) { /* ok, do it */
|
||
|
|
marked++; /* don't retransmit on release */
|
||
|
|
@@ -428,8 +426,11 @@ char *twiddler_rest_to_value(char *s)
|
||
|
|
buf[ibuf]='\0';
|
||
|
|
return strdup(buf);
|
||
|
|
}
|
||
|
|
- if (*ptr == '\\')
|
||
|
|
- return (char *)twiddler_escape_sequence(ptr+1, &len /* unused */);
|
||
|
|
+ if (*ptr == '\\') {
|
||
|
|
+ buf[ibuf++] = twiddler_escape_sequence(ptr+1, &len /* unused */);
|
||
|
|
+ buf[ibuf] = '\0';
|
||
|
|
+ return strdup(buf);
|
||
|
|
+ }
|
||
|
|
|
||
|
|
if (strlen(ptr)==1) return ((char *)((unsigned long)*ptr & 0xFF));
|
||
|
|
|
||
|
|
--
|
||
|
|
2.19.1
|
||
|
|
|