Fix all -Wsign-compare warnings
i.e comparison of signed and unsigned values. These are mostly harmless but fixing them allows to compile cleanly with -Wextra. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
813ddf255d
commit
2165e16ed9
|
@ -99,7 +99,7 @@ XkbcFreeCompatMap(struct xkb_desc * xkb)
|
|||
}
|
||||
|
||||
int
|
||||
XkbcAllocNames(struct xkb_desc * xkb, unsigned which, int nTotalAliases)
|
||||
XkbcAllocNames(struct xkb_desc * xkb, unsigned which, unsigned nTotalAliases)
|
||||
{
|
||||
struct xkb_names * names;
|
||||
|
||||
|
|
12
src/malloc.c
12
src/malloc.c
|
@ -121,7 +121,7 @@ XkbcAllocClientMap(struct xkb_desc * xkb, unsigned which, unsigned nTotalTypes)
|
|||
int
|
||||
XkbcAllocServerMap(struct xkb_desc * xkb, unsigned which, unsigned nNewActions)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
struct xkb_server_map * map;
|
||||
|
||||
if (!xkb)
|
||||
|
@ -166,7 +166,7 @@ XkbcAllocServerMap(struct xkb_desc * xkb, unsigned which, unsigned nNewActions)
|
|||
map->num_acts = 1;
|
||||
map->size_acts = nNewActions + 1;
|
||||
}
|
||||
else if ((map->size_acts - map->num_acts) < nNewActions) {
|
||||
else if ((map->size_acts - map->num_acts) < (int)nNewActions) {
|
||||
unsigned need;
|
||||
union xkb_action *prev_acts = map->acts;
|
||||
|
||||
|
@ -298,7 +298,7 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
|||
newSyms[0] = NoSymbol;
|
||||
nSyms = 1;
|
||||
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
|
||||
int nCopy;
|
||||
uint32_t nCopy;
|
||||
|
||||
nCopy = nKeySyms = XkbKeyNumSyms(xkb, i);
|
||||
if ((nKeySyms == 0) && (i != key))
|
||||
|
@ -325,7 +325,7 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
|||
}
|
||||
|
||||
union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, int needed)
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, uint32_t needed)
|
||||
{
|
||||
xkb_keycode_t i, nActs;
|
||||
union xkb_action *newActs;
|
||||
|
@ -336,10 +336,10 @@ XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, int needed)
|
|||
}
|
||||
|
||||
if (XkbKeyHasActions(xkb, key) &&
|
||||
(XkbKeyNumSyms(xkb, key) >= (unsigned)needed))
|
||||
(XkbKeyNumSyms(xkb, key) >= (int)needed))
|
||||
return XkbKeyActionsPtr(xkb, key);
|
||||
|
||||
if (xkb->server->size_acts - xkb->server->num_acts >= (unsigned)needed) {
|
||||
if (xkb->server->size_acts - xkb->server->num_acts >= (int)needed) {
|
||||
xkb->server->key_acts[key] = xkb->server->num_acts;
|
||||
xkb->server->num_acts += needed;
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
|
|||
{
|
||||
unsigned int info = XkbKeyGroupInfo(state->xkb, key);
|
||||
unsigned int num_groups = XkbKeyNumGroups(state->xkb, key);
|
||||
int ret = state->group;
|
||||
unsigned int ret = state->group;
|
||||
|
||||
if (ret < XkbKeyNumGroups(state->xkb, key))
|
||||
return ret;
|
||||
|
|
|
@ -263,7 +263,8 @@ SetUpRemap(InputLine *line,RemapSpec *remap)
|
|||
char *tok, *str;
|
||||
unsigned present, l_ndx_present, v_ndx_present;
|
||||
int i;
|
||||
int len, ndx;
|
||||
size_t len;
|
||||
int ndx;
|
||||
_Xstrtokparams strtok_buf;
|
||||
#ifdef DEBUG
|
||||
Bool found;
|
||||
|
@ -727,7 +728,7 @@ static void
|
|||
XkbRF_CheckApplyRules( XkbRF_RulesPtr rules,
|
||||
XkbRF_MultiDefsPtr mdefs,
|
||||
struct xkb_component_names * names,
|
||||
int flags)
|
||||
unsigned int flags)
|
||||
{
|
||||
int i;
|
||||
XkbRF_RulePtr rule;
|
||||
|
@ -751,7 +752,8 @@ static char *
|
|||
XkbRF_SubstituteVars(char *name, XkbRF_MultiDefsPtr mdefs)
|
||||
{
|
||||
char *str, *outstr, *orig, *var;
|
||||
int len, ndx;
|
||||
size_t len;
|
||||
int ndx;
|
||||
|
||||
orig= name;
|
||||
str= strchr(name,'%');
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#define BUFFER_SIZE 1024
|
||||
static char textBuffer[BUFFER_SIZE];
|
||||
static int tbNext = 0;
|
||||
static unsigned int tbNext = 0;
|
||||
|
||||
static char *
|
||||
tbGetBuffer(unsigned int size)
|
||||
|
|
|
@ -36,7 +36,7 @@ extern int
|
|||
XkbcAllocCompatMap(struct xkb_desc * xkb, unsigned which, unsigned nSI);
|
||||
|
||||
extern int
|
||||
XkbcAllocNames(struct xkb_desc * xkb, unsigned which, int nTotalAliases);
|
||||
XkbcAllocNames(struct xkb_desc * xkb, unsigned which, unsigned nTotalAliases);
|
||||
|
||||
extern int
|
||||
XkbcAllocControls(struct xkb_desc * xkb, unsigned which);
|
||||
|
@ -65,7 +65,7 @@ extern xkb_keysym_t *
|
|||
XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key, uint32_t needed);
|
||||
|
||||
extern union xkb_action *
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, int needed);
|
||||
XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, uint32_t needed);
|
||||
|
||||
extern void
|
||||
XkbcFreeClientMap(struct xkb_desc * xkb);
|
||||
|
|
|
@ -102,7 +102,7 @@ siText(SymInterpInfo * si, CompatInfo * info)
|
|||
static void
|
||||
InitCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
info->xkb = xkb;
|
||||
info->name = NULL;
|
||||
|
@ -132,7 +132,7 @@ InitCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
|
|||
static void
|
||||
ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
ActionInfo *next;
|
||||
|
||||
free(info->name);
|
||||
|
|
|
@ -351,7 +351,7 @@ InitKeyNamesInfo(KeyNamesInfo * info)
|
|||
static int
|
||||
FindKeyByLong(KeyNamesInfo * info, unsigned long name)
|
||||
{
|
||||
int i;
|
||||
uint64_t i;
|
||||
|
||||
for (i = info->computedMin; i <= info->computedMax; i++)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ AddKeyName(KeyNamesInfo * info,
|
|||
xkb_keycode_t kc,
|
||||
char *name, unsigned merge, unsigned fileID, Bool reportCollisions)
|
||||
{
|
||||
int old;
|
||||
xkb_keycode_t old;
|
||||
unsigned long lval;
|
||||
|
||||
if (kc > info->arraySize && !ResizeKeyNameArrays(info, kc)) {
|
||||
|
@ -474,7 +474,7 @@ static void
|
|||
MergeIncludedKeycodes(KeyNamesInfo * into, KeyNamesInfo * from,
|
||||
unsigned merge)
|
||||
{
|
||||
int i;
|
||||
uint64_t i;
|
||||
char buf[5];
|
||||
|
||||
if (from->errorCount > 0)
|
||||
|
@ -549,9 +549,11 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo *
|
|||
{
|
||||
unsigned newMerge;
|
||||
XkbFile *rtrn;
|
||||
KeyNamesInfo included = {NULL};
|
||||
KeyNamesInfo included;
|
||||
Bool haveSelf;
|
||||
|
||||
memset(&included, 0, sizeof(included));
|
||||
|
||||
haveSelf = False;
|
||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
||||
{
|
||||
|
@ -894,7 +896,7 @@ CompileKeycodes(XkbFile *file, struct xkb_desc * xkb, unsigned merge)
|
|||
if (XkbcAllocNames(xkb, XkbKeyNamesMask | XkbIndicatorNamesMask, 0)
|
||||
== Success)
|
||||
{
|
||||
int i;
|
||||
uint64_t i;
|
||||
for (i = info.computedMin; i <= info.computedMax; i++)
|
||||
LongToKeyName(info.names[i], xkb->names->keys[i].name);
|
||||
}
|
||||
|
|
|
@ -57,12 +57,12 @@ typedef struct _KeyTypeInfo
|
|||
unsigned mask;
|
||||
unsigned vmask;
|
||||
Bool groupInfo;
|
||||
int numLevels;
|
||||
int nEntries;
|
||||
int szEntries;
|
||||
unsigned numLevels;
|
||||
unsigned nEntries;
|
||||
unsigned szEntries;
|
||||
struct xkb_kt_map_entry * entries;
|
||||
PreserveInfo *preserve;
|
||||
int szNames;
|
||||
unsigned szNames;
|
||||
xkb_atom_t *lvlNames;
|
||||
} KeyTypeInfo;
|
||||
|
||||
|
@ -72,7 +72,7 @@ typedef struct _KeyTypesInfo
|
|||
int errorCount;
|
||||
int fileID;
|
||||
unsigned stdPresent;
|
||||
int nTypes;
|
||||
unsigned nTypes;
|
||||
KeyTypeInfo *types;
|
||||
KeyTypeInfo dflt;
|
||||
VModInfo vmods;
|
||||
|
@ -445,7 +445,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
|
|||
static struct xkb_kt_map_entry *
|
||||
FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
struct xkb_kt_map_entry * entry;
|
||||
|
||||
for (i = 0, entry = type->entries; i < type->nEntries; i++, entry++)
|
||||
|
@ -459,7 +459,7 @@ FindMatchingMapEntry(KeyTypeInfo * type, unsigned mask, unsigned vmask)
|
|||
static void
|
||||
DeleteLevel1MapEntries(KeyTypeInfo * type)
|
||||
{
|
||||
int i, n;
|
||||
unsigned int i, n;
|
||||
|
||||
for (i = 0; i < type->nEntries; i++)
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ static int
|
|||
HandleKeyTypeDef(KeyTypeDef * def,
|
||||
struct xkb_desc * xkb, unsigned merge, KeyTypesInfo * info)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
KeyTypeInfo type;
|
||||
|
||||
if (def->merge != MergeDefault)
|
||||
|
@ -1070,7 +1070,7 @@ HandleKeyTypesFile(XkbFile * file,
|
|||
static Bool
|
||||
CopyDefToKeyType(struct xkb_desc * xkb, struct xkb_key_type * type, KeyTypeInfo * def)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
PreserveInfo *pre;
|
||||
|
||||
for (pre = def->preserve; pre != NULL;
|
||||
|
@ -1151,7 +1151,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_desc * xkb, unsigned merge)
|
|||
|
||||
if (info.errorCount == 0)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
KeyTypeInfo *def;
|
||||
struct xkb_key_type *type, *next;
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ Bool
|
|||
FindNamedKey(struct xkb_desc * xkb,
|
||||
unsigned long name,
|
||||
xkb_keycode_t *kc_rtrn,
|
||||
Bool use_aliases, Bool create, int start_from)
|
||||
Bool use_aliases, Bool create, xkb_keycode_t start_from)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
|
@ -318,7 +318,7 @@ Bool
|
|||
FindKeyNameForAlias(struct xkb_desc * xkb, unsigned long lname,
|
||||
unsigned long *real_name)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
char name[XkbKeyNameLength + 1];
|
||||
|
||||
if (xkb && xkb->names && xkb->names->key_aliases)
|
||||
|
|
|
@ -80,7 +80,7 @@ extern Bool FindNamedKey(struct xkb_desc * /* xkb */ ,
|
|||
xkb_keycode_t * /* kc_rtrn */ ,
|
||||
Bool /* use_aliases */ ,
|
||||
Bool /* create */ ,
|
||||
int /* start_from */
|
||||
xkb_keycode_t /* start_from */
|
||||
);
|
||||
|
||||
extern Bool FindKeyNameForAlias(struct xkb_desc * /* xkb */ ,
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct _KeyInfo
|
|||
unsigned char typesDefined;
|
||||
unsigned char symsDefined;
|
||||
unsigned char actsDefined;
|
||||
short numLevels[XkbNumKbdGroups];
|
||||
unsigned int numLevels[XkbNumKbdGroups];
|
||||
xkb_keysym_t *syms[XkbNumKbdGroups];
|
||||
union xkb_action *acts[XkbNumKbdGroups];
|
||||
xkb_atom_t types[XkbNumKbdGroups];
|
||||
|
@ -159,7 +159,7 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
|
|||
}
|
||||
else
|
||||
{
|
||||
int width;
|
||||
unsigned int width;
|
||||
for (i = 0; i < XkbNumKbdGroups; i++)
|
||||
{
|
||||
width = new->numLevels[i];
|
||||
|
@ -252,7 +252,7 @@ InitSymbolsInfo(SymbolsInfo * info, struct xkb_desc * xkb)
|
|||
static void
|
||||
FreeSymbolsInfo(SymbolsInfo * info)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
free(info->name);
|
||||
if (info->keys)
|
||||
|
@ -308,8 +308,8 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
{
|
||||
xkb_keysym_t *resultSyms;
|
||||
union xkb_action *resultActs;
|
||||
int resultWidth;
|
||||
int i;
|
||||
unsigned int resultWidth;
|
||||
unsigned int i;
|
||||
Bool report, clobber;
|
||||
|
||||
clobber = (from->defs.merge != MergeAugment);
|
||||
|
@ -576,7 +576,7 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from)
|
|||
static Bool
|
||||
AddKeySymbols(SymbolsInfo * info, KeyInfo * key, struct xkb_desc * xkb)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
unsigned long real_name;
|
||||
|
||||
for (i = 0; i < info->nKeys; i++)
|
||||
|
@ -688,7 +688,7 @@ static void
|
|||
MergeIncludedSymbols(SymbolsInfo * into, SymbolsInfo * from,
|
||||
unsigned merge, struct xkb_desc * xkb)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
KeyInfo *key;
|
||||
|
||||
if (from->errorCount > 0)
|
||||
|
@ -887,7 +887,8 @@ AddSymbolsToKey(KeyInfo * key,
|
|||
ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
|
||||
{
|
||||
unsigned ndx, nSyms;
|
||||
int i;
|
||||
unsigned int i;
|
||||
long j;
|
||||
|
||||
if (!GetGroupIndex(key, arrayNdx, SYMBOLS, &ndx))
|
||||
return False;
|
||||
|
@ -928,8 +929,8 @@ AddSymbolsToKey(KeyInfo * key,
|
|||
key->syms[ndx][i] = NoSymbol;
|
||||
}
|
||||
}
|
||||
for (i = key->numLevels[ndx] - 1;
|
||||
(i >= 0) && (key->syms[ndx][i] == NoSymbol); i--)
|
||||
for (j = key->numLevels[ndx] - 1;
|
||||
(j >= 0) && (key->syms[ndx][j] == NoSymbol); j--)
|
||||
{
|
||||
key->numLevels[ndx]--;
|
||||
}
|
||||
|
@ -942,7 +943,7 @@ AddActionsToKey(KeyInfo * key,
|
|||
char *field,
|
||||
ExprDef * arrayNdx, ExprDef * value, SymbolsInfo * info)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
unsigned ndx, nActs;
|
||||
ExprDef *act;
|
||||
struct xkb_any_action *toAct;
|
||||
|
@ -1738,7 +1739,7 @@ PrepareKeyDef(KeyInfo * key)
|
|||
static Bool
|
||||
CopySymbolsDef(struct xkb_desc * xkb, KeyInfo *key, int start_from)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
xkb_keycode_t kc;
|
||||
unsigned width, tmp, nGroups;
|
||||
struct xkb_key_type * type;
|
||||
|
@ -1966,7 +1967,7 @@ CopyModMapDef(struct xkb_desc * xkb, ModMapEntry *entry)
|
|||
Bool
|
||||
CompileSymbols(XkbFile *file, struct xkb_desc * xkb, unsigned merge)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
SymbolsInfo info;
|
||||
|
||||
InitSymbolsInfo(&info, xkb);
|
||||
|
|
|
@ -246,7 +246,7 @@ typedef struct _IndicatorMapDef
|
|||
typedef struct _XkbFile
|
||||
{
|
||||
ParseCommon common;
|
||||
int type;
|
||||
unsigned type;
|
||||
char *topName;
|
||||
char *name;
|
||||
ParseCommon *defs;
|
||||
|
|
|
@ -44,9 +44,9 @@
|
|||
|
||||
static Bool noDefaultPath = False;
|
||||
/* number of entries allocated for includePath */
|
||||
static int szPath;
|
||||
static size_t szPath;
|
||||
/* number of actual entries in includePath */
|
||||
static int nPathEntries;
|
||||
static size_t nPathEntries;
|
||||
/* Holds all directories we might be including data from */
|
||||
static char **includePath = NULL;
|
||||
|
||||
|
@ -184,7 +184,7 @@ XkbInitIncludePath(void)
|
|||
static void
|
||||
XkbClearIncludePath(void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if (szPath > 0)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ XkbAddDirectoryToPath(const char *dir)
|
|||
includePath[nPathEntries] = strdup(dir);
|
||||
if (includePath[nPathEntries] == NULL)
|
||||
{
|
||||
WSGO("Allocation failed (includePath[%d])\n", nPathEntries);
|
||||
WSGO("Allocation failed (includePath[%zd])\n", nPathEntries);
|
||||
return False;
|
||||
}
|
||||
nPathEntries++;
|
||||
|
@ -315,7 +315,8 @@ XkbDirectoryForInclude(unsigned type)
|
|||
FILE *
|
||||
XkbFindFileInPath(const char *name, unsigned type, char **pathRtrn)
|
||||
{
|
||||
int i, ret;
|
||||
size_t i;
|
||||
int ret;
|
||||
FILE *file = NULL;
|
||||
char buf[PATH_MAX];
|
||||
const char *typeDir;
|
||||
|
@ -331,7 +332,7 @@ XkbFindFileInPath(const char *name, unsigned type, char **pathRtrn)
|
|||
|
||||
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||
includePath[i], typeDir, name);
|
||||
if (ret >= sizeof(buf))
|
||||
if (ret >= (ssize_t)sizeof(buf))
|
||||
{
|
||||
ERROR("File name (%s/%s/%s) too long\n", includePath[i],
|
||||
typeDir, name);
|
||||
|
|
Loading…
Reference in New Issue