Commit 8011d4e3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

keys: fix signed overflow

parent 4ee185d1
......@@ -32,18 +32,19 @@ struct keysym
{
char xname[32];
char uname[64];
int32_t xsym;
int32_t usym;
uint32_t xsym;
uint32_t usym;
};
static int cmpkey (const void *va, const void *vb)
{
const struct keysym *ka = va, *kb = vb;
#if (INT_MAX < 0x7fffffff)
# error Oups!
#endif
return ka->xsym - kb->xsym;
if (ka->xsym > kb->xsym)
return +1;
if (ka->xsym < kb->xsym)
return -1;
return 0;
}
static void printkey (const void *node, const VISIT which, const int depth)
......@@ -79,7 +80,7 @@ static int parse (FILE *in)
abort ();
int val = sscanf (line,
"#define XK_%31s %"SCNi32" /*%*cU+%"SCNx32" %63[^*]",
"#define XK_%31s %"SCNu32" /*%*cU+%"SCNx32" %63[^*]",
sym->xname, &sym->xsym, &sym->usym, sym->uname);
if (val < 3)
{
......
......@@ -386,11 +386,7 @@ static int keycmp (const void *a, const void *b)
{
const struct mapping *ka = a, *kb = b;
#if (INT_MAX >= 0x7fffffff)
return ka->key - kb->key;
#else
return (ka->key < kb->key) ? -1 : (ka->key > kb->key) ? +1 : 0;
#endif
}
struct vlc_actions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment