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 compile warnings



details:   https://anonhg.NetBSD.org/src/rev/8a5ea1e4f6b8
branches:  trunk
changeset: 764119:8a5ea1e4f6b8
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Apr 11 21:37:19 2011 +0000

description:
Clean up some compile warnings

diffstat:

 lib/libterminfo/compile.c |  18 ++++++++++--------
 lib/libterminfo/term.c    |   9 +++++----
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (103 lines):

diff -r 2db05e7fcba8 -r 8a5ea1e4f6b8 lib/libterminfo/compile.c
--- a/lib/libterminfo/compile.c Mon Apr 11 21:13:09 2011 +0000
+++ b/lib/libterminfo/compile.c Mon Apr 11 21:37:19 2011 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: compile.c,v 1.4 2010/03/02 14:11:11 roy Exp $ */
+/* $NetBSD: compile.c,v 1.5 2011/04/11 21:37:19 roy Exp $ */
 
 /*
- * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Roy Marples.
@@ -32,7 +32,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: compile.c,v 1.4 2010/03/02 14:11:11 roy Exp $");
+__RCSID("$NetBSD: compile.c,v 1.5 2011/04/11 21:37:19 roy Exp $");
 
 #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
 #include <sys/endian.h>
@@ -344,7 +344,7 @@
                                if (ch == '?')
                                        ch = '\177';
                                else if ((ch &= 037) == 0)
-                                       ch = 128;
+                                       ch = (char)128;
                        }
                        *p++ = ch;
                        last = ch;
@@ -452,7 +452,8 @@
 {
        char *token, *p, *e, *name, *desc, *alias;
        signed char flag;
-       long num;
+       long cnum;
+       short num;
        ssize_t ind;
        size_t len;
        TBUF buf;
@@ -564,17 +565,18 @@
                            _ti_find_cap(&tic->nums, 'n', ind) != NULL)
                                continue;
 
-                       num = strtol(p, &e, 0);
+                       cnum = strtol(p, &e, 0);
                        if (*e != '\0') {
                                dowarn(flags, "%s: %s: not a number",
                                    tic->name, token);
                                continue;
                        }
-                       if (!VALID_NUMERIC(num)) {
+                       if (!VALID_NUMERIC(cnum)) {
                                dowarn(flags, "%s: %s: number out of range",
                                    tic->name, token);
                                continue;
                        }
+                       num = (short)cnum;
                        if (ind == -1)
                                _ti_store_extra(tic, 1, token, 'n', -1,
                                    num, NULL, 0, flags);
@@ -608,7 +610,7 @@
                                le16enc(tic->nums.buf + tic->nums.bufpos, ind);
                                tic->nums.bufpos += sizeof(uint16_t);
                                le16enc(tic->nums.buf + tic->nums.bufpos,
-                                       CANCELLED_NUMERIC);
+                                       (uint16_t)CANCELLED_NUMERIC);
                                tic->nums.bufpos += sizeof(uint16_t);
                                tic->nums.entries++;
                                continue;
diff -r 2db05e7fcba8 -r 8a5ea1e4f6b8 lib/libterminfo/term.c
--- a/lib/libterminfo/term.c    Mon Apr 11 21:13:09 2011 +0000
+++ b/lib/libterminfo/term.c    Mon Apr 11 21:37:19 2011 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: term.c,v 1.11 2010/02/26 00:09:00 roy Exp $ */
+/* $NetBSD: term.c,v 1.12 2011/04/11 21:37:19 roy Exp $ */
 
 /*
- * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Roy Marples.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: term.c,v 1.11 2010/02/26 00:09:00 roy Exp $");
+__RCSID("$NetBSD: term.c,v 1.12 2011/04/11 21:37:19 roy Exp $");
 
 #include <sys/stat.h>
 
@@ -354,7 +354,8 @@
                if (tic != NULL && ticcmp(tic, name) == 0) {
                        len = _ti_flatten(&f, tic);
                        if (len != -1) {
-                               r = _ti_readterm(term, (char *)f, len, flags);
+                               r = _ti_readterm(term, (char *)f, (size_t)len,
+                                   flags);
                                free(f);
                        }
                }



Home | Main Index | Thread Index | Old Index