Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libterminfo Clean up some more warnings.
details: https://anonhg.NetBSD.org/src/rev/168ffa9bad59
branches: trunk
changeset: 353410:168ffa9bad59
user: roy <roy%NetBSD.org@localhost>
date: Thu May 04 09:46:30 2017 +0000
description:
Clean up some more warnings.
diffstat:
lib/libterminfo/compile.c | 75 ++++++++++++++++++++++++----------------------
1 files changed, 39 insertions(+), 36 deletions(-)
diffs (249 lines):
diff -r bfaf1e63f6f3 -r 168ffa9bad59 lib/libterminfo/compile.c
--- a/lib/libterminfo/compile.c Thu May 04 09:42:23 2017 +0000
+++ b/lib/libterminfo/compile.c Thu May 04 09:46:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compile.c,v 1.11 2017/02/11 15:13:17 roy Exp $ */
+/* $NetBSD: compile.c,v 1.12 2017/05/04 09:46:30 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: compile.c,v 1.11 2017/02/11 15:13:17 roy Exp $");
+__RCSID("$NetBSD: compile.c,v 1.12 2017/05/04 09:46:30 roy Exp $");
#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
@@ -90,7 +90,7 @@
_ti_find_cap(TBUF *tbuf, char type, short ind)
{
size_t n;
- short num;
+ uint16_t num;
char *cap;
_DIAGASSERT(tbuf != NULL);
@@ -99,7 +99,7 @@
for (n = tbuf->entries; n > 0; n--) {
num = le16dec(cap);
cap += sizeof(uint16_t);
- if (num == ind)
+ if ((short)num == ind)
return cap;
switch (type) {
case 'f':
@@ -124,7 +124,7 @@
_ti_find_extra(TBUF *tbuf, const char *code)
{
size_t n;
- short num;
+ uint16_t num;
char *cap;
_DIAGASSERT(tbuf != NULL);
@@ -184,7 +184,7 @@
if (!_ti_grow_tbuf(&tic->extras,
l + strl + (sizeof(uint16_t) * 2) + 1))
return 0;
- le16enc(tic->extras.buf + tic->extras.bufpos, l);
+ le16enc(tic->extras.buf + tic->extras.bufpos, (uint16_t)l);
tic->extras.bufpos += sizeof(uint16_t);
memcpy(tic->extras.buf + tic->extras.bufpos, id, l);
tic->extras.bufpos += l;
@@ -194,11 +194,11 @@
tic->extras.buf[tic->extras.bufpos++] = flag;
break;
case 'n':
- le16enc(tic->extras.buf + tic->extras.bufpos, num);
+ le16enc(tic->extras.buf + tic->extras.bufpos, (uint16_t)num);
tic->extras.bufpos += sizeof(uint16_t);
break;
case 's':
- le16enc(tic->extras.buf + tic->extras.bufpos, strl);
+ le16enc(tic->extras.buf + tic->extras.bufpos, (uint16_t)strl);
tic->extras.bufpos += sizeof(uint16_t);
memcpy(tic->extras.buf + tic->extras.bufpos, str, strl);
tic->extras.bufpos += strl;
@@ -240,18 +240,18 @@
cap = *buf;
*cap++ = 1;
- le16enc(cap, len);
+ le16enc(cap, (uint16_t)len);
cap += sizeof(uint16_t);
memcpy(cap, tic->name, len);
cap += len;
- le16enc(cap, alen);
+ le16enc(cap, (uint16_t)alen);
cap += sizeof(uint16_t);
if (tic->alias != NULL) {
memcpy(cap, tic->alias, alen);
cap += alen;
}
- le16enc(cap, dlen);
+ le16enc(cap, (uint16_t)dlen);
cap += sizeof(uint16_t);
if (tic->desc != NULL) {
memcpy(cap, tic->desc, dlen);
@@ -262,9 +262,9 @@
le16enc(cap, 0);
cap += sizeof(uint16_t);
} else {
- le16enc(cap, (tic->flags.bufpos + sizeof(uint16_t)));
+ le16enc(cap, (uint16_t)(tic->flags.bufpos + sizeof(uint16_t)));
cap += sizeof(uint16_t);
- le16enc(cap, tic->flags.entries);
+ le16enc(cap, (uint16_t)tic->flags.entries);
cap += sizeof(uint16_t);
memcpy(cap, tic->flags.buf, tic->flags.bufpos);
cap += tic->flags.bufpos;
@@ -274,9 +274,9 @@
le16enc(cap, 0);
cap += sizeof(uint16_t);
} else {
- le16enc(cap, (tic->nums.bufpos + sizeof(uint16_t)));
+ le16enc(cap, (uint16_t)(tic->nums.bufpos + sizeof(uint16_t)));
cap += sizeof(uint16_t);
- le16enc(cap, tic->nums.entries);
+ le16enc(cap, (uint16_t)tic->nums.entries);
cap += sizeof(uint16_t);
memcpy(cap, tic->nums.buf, tic->nums.bufpos);
cap += tic->nums.bufpos;
@@ -286,9 +286,9 @@
le16enc(cap, 0);
cap += sizeof(uint16_t);
} else {
- le16enc(cap, (tic->strs.bufpos + sizeof(uint16_t)));
+ le16enc(cap, (uint16_t)(tic->strs.bufpos + sizeof(uint16_t)));
cap += sizeof(uint16_t);
- le16enc(cap, tic->strs.entries);
+ le16enc(cap, (uint16_t)tic->strs.entries);
cap += sizeof(uint16_t);
memcpy(cap, tic->strs.buf, tic->strs.bufpos);
cap += tic->strs.bufpos;
@@ -298,9 +298,9 @@
le16enc(cap, 0);
cap += sizeof(uint16_t);
} else {
- le16enc(cap, (tic->extras.bufpos + sizeof(uint16_t)));
+ le16enc(cap, (uint16_t)(tic->extras.bufpos + sizeof(uint16_t)));
cap += sizeof(uint16_t);
- le16enc(cap, tic->extras.entries);
+ le16enc(cap, (uint16_t)tic->extras.entries);
cap += sizeof(uint16_t);
memcpy(cap, tic->extras.buf, tic->extras.bufpos);
cap += tic->extras.bufpos;
@@ -413,7 +413,7 @@
last = ch;
}
*p++ = '\0';
- tbuf->bufpos += p - s;
+ tbuf->bufpos += (size_t)(p - s);
return 0;
}
@@ -457,8 +457,7 @@
char *token, *p, *e, *name, *desc, *alias;
signed char flag;
long cnum;
- short num;
- ssize_t ind;
+ short ind, num;
size_t len;
TBUF buf;
TIC *tic;
@@ -518,7 +517,7 @@
if (p != NULL) {
*p++ = '\0';
/* Don't use the string if we already have it */
- ind = _ti_strindex(token);
+ ind = (short)_ti_strindex(token);
if (ind != -1 &&
_ti_find_cap(&tic->strs, 's', ind) != NULL)
continue;
@@ -546,10 +545,10 @@
if (!_ti_grow_tbuf(&tic->strs,
(sizeof(uint16_t) * 2) + buf.bufpos))
goto error;
- le16enc(tic->strs.buf + tic->strs.bufpos, ind);
+ le16enc(tic->strs.buf + tic->strs.bufpos, (uint16_t)ind);
tic->strs.bufpos += sizeof(uint16_t);
le16enc(tic->strs.buf + tic->strs.bufpos,
- buf.bufpos);
+ (uint16_t)buf.bufpos);
tic->strs.bufpos += sizeof(uint16_t);
memcpy(tic->strs.buf + tic->strs.bufpos,
buf.buf, buf.bufpos);
@@ -564,7 +563,7 @@
if (p != NULL) {
*p++ = '\0';
/* Don't use the number if we already have it */
- ind = _ti_numindex(token);
+ ind = (short)_ti_numindex(token);
if (ind != -1 &&
_ti_find_cap(&tic->nums, 'n', ind) != NULL)
continue;
@@ -588,9 +587,11 @@
if (_ti_grow_tbuf(&tic->nums,
sizeof(uint16_t) * 2) == NULL)
goto error;
- le16enc(tic->nums.buf + tic->nums.bufpos, ind);
+ le16enc(tic->nums.buf + tic->nums.bufpos,
+ (uint16_t)ind);
tic->nums.bufpos += sizeof(uint16_t);
- le16enc(tic->nums.buf + tic->nums.bufpos, num);
+ le16enc(tic->nums.buf + tic->nums.bufpos,
+ (uint16_t)num);
tic->nums.bufpos += sizeof(uint16_t);
tic->nums.entries++;
}
@@ -603,28 +604,29 @@
flag = CANCELLED_BOOLEAN;
token[len] = '\0';
}
- ind = _ti_flagindex(token);
+ ind = (short)_ti_flagindex(token);
if (ind == -1 && flag == CANCELLED_BOOLEAN) {
- if ((ind = _ti_numindex(token)) != -1) {
+ if ((ind = (short)_ti_numindex(token)) != -1) {
if (_ti_find_cap(&tic->nums, 'n', ind) != NULL)
continue;
if (_ti_grow_tbuf(&tic->nums,
sizeof(uint16_t) * 2) == NULL)
goto error;
- le16enc(tic->nums.buf + tic->nums.bufpos, ind);
+ le16enc(tic->nums.buf + tic->nums.bufpos,
+ (uint16_t)ind);
tic->nums.bufpos += sizeof(uint16_t);
le16enc(tic->nums.buf + tic->nums.bufpos,
- (uint16_t)CANCELLED_NUMERIC);
+ (uint16_t)CANCELLED_NUMERIC);
tic->nums.bufpos += sizeof(uint16_t);
tic->nums.entries++;
continue;
- } else if ((ind = _ti_strindex(token)) != -1) {
+ } else if ((ind = (short)_ti_strindex(token)) != -1) {
if (_ti_find_cap(&tic->strs, 's', ind) != NULL)
continue;
if (_ti_grow_tbuf(&tic->strs,
- (sizeof(uint16_t) * 2) + 1) == NULL)
+ (sizeof(uint16_t) * 2) + 1) == NULL)
goto error;
- le16enc(tic->strs.buf + tic->strs.bufpos, ind);
+ le16enc(tic->strs.buf + tic->strs.bufpos, (uint16_t)ind);
tic->strs.bufpos += sizeof(uint16_t);
le16enc(tic->strs.buf + tic->strs.bufpos, 0);
tic->strs.bufpos += sizeof(uint16_t);
@@ -639,7 +641,8 @@
if (_ti_grow_tbuf(&tic->flags, sizeof(uint16_t) + 1)
== NULL)
goto error;
- le16enc(tic->flags.buf + tic->flags.bufpos, ind);
+ le16enc(tic->flags.buf + tic->flags.bufpos,
+ (uint16_t)ind);
tic->flags.bufpos += sizeof(uint16_t);
tic->flags.buf[tic->flags.bufpos++] = flag;
tic->flags.entries++;
Home |
Main Index |
Thread Index |
Old Index