ncurses 5.7 - patch 20100424

+ fix some strict compiler warnings in ncurses library.
+ modify configure macro CF_HEADER_PATH to not look for variations in
  the predefined include directories.
+ improve configure macros CF_GCC_VERSION and CF_GCC_WARNINGS to work
  with gcc 4.x's c89 alias, which gives warning messages for cases
  where older versions would produce an error.
This commit is contained in:
Thomas E. Dickey 2010-04-25 01:40:39 +00:00
parent 614f0d6711
commit 11dead3981
22 changed files with 1214 additions and 1201 deletions

10
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.1531 2010/04/17 22:49:16 tom Exp $
-- $Id: NEWS,v 1.1533 2010/04/24 23:44:44 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,14 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
20100424
+ fix some strict compiler warnings in ncurses library.
+ modify configure macro CF_HEADER_PATH to not look for variations in
the predefined include directories.
+ improve configure macros CF_GCC_VERSION and CF_GCC_WARNINGS to work
with gcc 4.x's c89 alias, which gives warning messages for cases
where older versions would produce an error.
20100417
+ modify _nc_capcmp() to work with cancelled strings.
+ correct translation of "^" in _nc_infotocap(), used to transform

39
aclocal.m4 vendored
View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: aclocal.m4,v 1.513 2010/04/17 20:33:27 tom Exp $
dnl $Id: aclocal.m4,v 1.514 2010/04/24 15:44:15 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@ -1107,7 +1107,7 @@ AC_MSG_RESULT($cf_result)
CXXFLAGS="$cf_save_CXXFLAGS"
])
dnl ---------------------------------------------------------------------------
dnl CF_FIND_LINKAGE version: 15 updated: 2010/04/03 18:35:33
dnl CF_FIND_LINKAGE version: 16 updated: 2010/04/21 06:20:50
dnl ---------------
dnl Find a library (specifically the linkage used in the code fragment),
dnl searching for it if it is not already in the library path.
@ -1222,9 +1222,9 @@ AC_TRY_LINK([$1],[$2],[
if test "$cf_cv_find_linkage_$3" = yes ; then
ifelse([$4],,[
CF_ADD_INCDIR($cf_cv_header_path_$3)
CF_ADD_LIBDIR($cf_cv_library_path_$3)
LIBS="-l$3 $LIBS"
CF_ADD_INCDIR($cf_cv_header_path_$3)
CF_ADD_LIBDIR($cf_cv_library_path_$3)
LIBS="-l$3 $LIBS"
],[$4])
else
ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
@ -1572,7 +1572,7 @@ rm -rf conftest*
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
dnl --------------
dnl Find version of gcc
AC_DEFUN([CF_GCC_VERSION],[
@ -1580,13 +1580,13 @@ AC_REQUIRE([AC_PROG_CC])
GCC_VERSION=none
if test "$GCC" = yes ; then
AC_MSG_CHECKING(version of $CC)
GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
test -z "$GCC_VERSION" && GCC_VERSION=unknown
AC_MSG_RESULT($GCC_VERSION)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 24 updated: 2009/02/01 15:21:00
dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31
dnl ---------------
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
@ -1654,10 +1654,10 @@ elif test "$GCC" = yes
then
AC_CHECKING([for $CC warning options])
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-W -Wall"
EXTRA_CFLAGS=
cf_warn_CONST=""
test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
for cf_opt in \
for cf_opt in W Wall \
Wbad-function-cast \
Wcast-align \
Wcast-qual \
@ -2131,7 +2131,7 @@ done
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_HEADER_PATH version: 10 updated: 2010/01/17 20:36:17
dnl CF_HEADER_PATH version: 11 updated: 2010/04/21 06:20:50
dnl --------------
dnl Construct a search-list of directories for a nonstandard header-file
dnl
@ -2141,6 +2141,8 @@ dnl $2 = the package name
AC_DEFUN([CF_HEADER_PATH],
[
$1=
# collect the current set of include-directories from compiler flags
cf_header_path_list=""
if test -n "${CFLAGS}${CPPFLAGS}" ; then
for cf_header_path in $CPPFLAGS $CFLAGS
@ -2148,13 +2150,13 @@ if test -n "${CFLAGS}${CPPFLAGS}" ; then
case $cf_header_path in #(vi
-I*)
cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
cf_header_path_list="$cf_header_path_list [$]$1"
cf_header_path_list="$cf_header_path_list $cf_header_path"
;;
esac
done
fi
# add the variations for the package we are looking for
CF_SUBDIR_PATH($1,$2,include)
test "$includedir" != NONE && \
@ -2171,7 +2173,7 @@ test -d "$oldincludedir" && {
test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
}
$1="$cf_header_path_list [$]$1"
$1="[$]$1 $cf_header_path_list"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
@ -5209,14 +5211,15 @@ if test "$ac_cv_header_termios_h" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_SUBDIR_PATH version: 5 updated: 2007/07/29 09:55:12
dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
dnl --------------
dnl Construct a search-list for a nonstandard header/lib-file
dnl $1 = the variable to return as result
dnl $2 = the package name
dnl $3 = the subdirectory, e.g., bin, include or lib
AC_DEFUN([CF_SUBDIR_PATH],
[$1=""
[
$1=
CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
@ -5411,7 +5414,7 @@ AC_DEFUN([CF_UPPER],
$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_UTF8_LIB version: 5 updated: 2008/10/17 19:37:52
dnl CF_UTF8_LIB version: 6 updated: 2010/04/21 06:20:50
dnl -----------
dnl Check for multibyte support, and if not found, utf8 compatibility library
AC_DEFUN([CF_UTF8_LIB],
@ -5433,7 +5436,7 @@ if test "$cf_cv_utf8_lib" = "add-on" ; then
AC_DEFINE(HAVE_LIBUTF8_H)
CF_ADD_INCDIR($cf_cv_header_path_utf8)
CF_ADD_LIBDIR($cf_cv_library_path_utf8)
LIBS="-lutf8 $LIBS"
LIBS="$cf_cv_library_file_utf8 $LIBS"
fi
])dnl
dnl ---------------------------------------------------------------------------

2060
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.755 2010/04/17 15:59:31 tom Exp $
# $Id: dist.mk,v 1.756 2010/04/24 15:26:17 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@ -37,7 +37,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
NCURSES_PATCH = 20100417
NCURSES_PATCH = 20100424
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -36,7 +36,7 @@
#include <curses.priv.h>
#include <ctype.h>
MODULE_ID("$Id: lib_addch.c,v 1.123 2010/03/31 23:38:02 tom Exp $")
MODULE_ID("$Id: lib_addch.c,v 1.124 2010/04/24 22:41:05 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@ -125,7 +125,7 @@ newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T * ypos)
*ypos = win->_regbottom;
result = TRUE;
} else {
*ypos += 1;
*ypos = (NCURSES_SIZE_T) (*ypos + 1);
}
return result;
}
@ -170,8 +170,8 @@ fill_cells(WINDOW *win, int count)
if (waddch_literal(win, blank) == ERR)
break;
}
win->_curx = save_x;
win->_cury = save_y;
win->_curx = (NCURSES_SIZE_T) save_x;
win->_cury = (NCURSES_SIZE_T) save_y;
}
#endif
@ -207,9 +207,9 @@ _nc_build_wch(WINDOW *win, ARG_CH_T ch)
buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch));
WINDOW_EXT(win, addch_used) += 1;
buffer[WINDOW_EXT(win, addch_used)] = '\0';
if ((len = mbrtowc(&result,
buffer,
WINDOW_EXT(win, addch_used), &state)) > 0) {
if ((len = (int) mbrtowc(&result,
buffer,
WINDOW_EXT(win, addch_used), &state)) > 0) {
attr_t attrs = AttrOf(CHDEREF(ch));
if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
SetChar(CHDEREF(ch), result, attrs);
@ -396,7 +396,7 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch)
if (x > win->_maxx) {
return wrap_to_next_line(win);
}
win->_curx = x;
win->_curx = (NCURSES_SIZE_T) x;
return OK;
}
@ -405,7 +405,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
/* the workhorse function -- add a character to the given window */
{
NCURSES_SIZE_T x, y;
chtype t = CharOf(ch);
chtype t = (chtype) CharOf(ch);
#if USE_WIDEC_SUPPORT || NCURSES_SP_FUNCS || USE_REENTRANT
SCREEN *sp = _nc_screen_of(win);
#endif
@ -447,7 +447,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
#else
tabsize = TABSIZE;
#endif
x += (tabsize - (x % tabsize));
x = (NCURSES_SIZE_T) (x + (tabsize - (x % tabsize)));
/*
* Space-fill the tab on the bottom line so that we'll get the
* "correct" cursor position.

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -42,7 +42,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_box.c,v 1.23 2009/10/24 22:33:46 tom Exp $")
MODULE_ID("$Id: lib_box.c,v 1.24 2010/04/24 23:51:57 tom Exp $")
#if USE_WIDEC_SUPPORT
static NCURSES_INLINE chtype
@ -51,8 +51,9 @@ _my_render(WINDOW *win, chtype ch)
NCURSES_CH_T wch;
SetChar2(wch, ch);
wch = _nc_render(win, wch);
return CharOf(wch) | AttrOf(wch);
return ((attr_t) CharOf(wch)) | AttrOf(wch);
}
#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _my_render(win, (ch == 0) ? def : ch)
#else
#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _nc_render(win, (ch == 0) ? def : ch)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -45,7 +45,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_color.c,v 1.97 2009/11/07 20:36:44 tom Exp $")
MODULE_ID("$Id: lib_color.c,v 1.98 2010/04/24 22:57:53 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
@ -394,7 +394,7 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
max = b;
/* calculate lightness */
*l = (min + max) / 20;
*l = (short) ((min + max) / 20);
if (min == max) { /* black, white and all shades of gray */
*h = 0;
@ -404,17 +404,17 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s)
/* calculate saturation */
if (*l < 50)
*s = ((max - min) * 100) / (max + min);
*s = (short) (((max - min) * 100) / (max + min));
else
*s = ((max - min) * 100) / (2000 - max - min);
*s = (short) (((max - min) * 100) / (2000 - max - min));
/* calculate hue */
if (r == max)
t = 120 + ((g - b) * 60) / (max - min);
t = (short) (120 + ((g - b) * 60) / (max - min));
else if (g == max)
t = 240 + ((b - r) * 60) / (max - min);
t = (short) (240 + ((b - r) * 60) / (max - min));
else
t = 360 + ((r - g) * 60) / (max - min);
t = (short) (360 + ((r - g) * 60) / (max - min));
*h = t % 360;
}
@ -822,9 +822,9 @@ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
#if NCURSES_EXT_FUNCS
if (isDefaultColor(fg))
fg = default_fg(NCURSES_SP_ARG);
fg = (short) default_fg(NCURSES_SP_ARG);
if (isDefaultColor(bg))
bg = default_bg(NCURSES_SP_ARG);
bg = (short) default_bg(NCURSES_SP_ARG);
#endif
if (reverse) {

View File

@ -84,7 +84,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_mouse.c,v 1.113 2010/03/24 23:06:46 tom Exp $")
MODULE_ID("$Id: lib_mouse.c,v 1.115 2010/04/24 23:01:13 tom Exp $")
#include <tic.h>
@ -122,12 +122,12 @@ make an error
#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
#define MASK_RELEASE(x) NCURSES_MOUSE_MASK(x, 001)
#define MASK_PRESS(x) NCURSES_MOUSE_MASK(x, 002)
#define MASK_CLICK(x) NCURSES_MOUSE_MASK(x, 004)
#define MASK_DOUBLE_CLICK(x) NCURSES_MOUSE_MASK(x, 010)
#define MASK_TRIPLE_CLICK(x) NCURSES_MOUSE_MASK(x, 020)
#define MASK_RESERVED_EVENT(x) NCURSES_MOUSE_MASK(x, 040)
#define MASK_RELEASE(x) (mmask_t) NCURSES_MOUSE_MASK(x, 001)
#define MASK_PRESS(x) (mmask_t) NCURSES_MOUSE_MASK(x, 002)
#define MASK_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 004)
#define MASK_DOUBLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 010)
#define MASK_TRIPLE_CLICK(x) (mmask_t) NCURSES_MOUSE_MASK(x, 020)
#define MASK_RESERVED_EVENT(x) (mmask_t) NCURSES_MOUSE_MASK(x, 040)
#if NCURSES_MOUSE_VERSION == 1
#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED)
@ -189,7 +189,7 @@ _trace_slot(SCREEN *sp, const char *tag)
{
MEVENT *ep;
_tracef(tag);
_tracef("%s", tag);
for (ep = FirstEV(sp); ep <= LastEV(sp); ep++)
_tracef("mouse event queue slot %ld = %s",
@ -870,9 +870,9 @@ _nc_mouse_inline(SCREEN *sp)
/* For VIO mouse we add extra bit 64 to disambiguate button-up. */
#if USE_EMX_MOUSE
res = read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
res = (int) read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
#else
res = read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
res = (int) read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
#endif
if (res == -1)
break;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -52,7 +52,7 @@
#include <tic.h>
MODULE_ID("$Id: lib_newterm.c,v 1.84 2009/11/28 22:43:51 tom Exp $")
MODULE_ID("$Id: lib_newterm.c,v 1.85 2010/04/24 23:51:23 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
@ -85,9 +85,9 @@ _nc_initscr(NCURSES_SP_DCL0)
buf = term->Nttyb;
#ifdef TERMIOS
buf.c_lflag &= ~(ECHO | ECHONL);
buf.c_iflag &= ~(ICRNL | INLCR | IGNCR);
buf.c_oflag &= ~(ONLCR);
buf.c_lflag &= (unsigned) ~(ECHO | ECHONL);
buf.c_iflag &= (unsigned) ~(ICRNL | INLCR | IGNCR);
buf.c_oflag &= (unsigned) ~(ONLCR);
#elif HAVE_SGTTY_H
buf.sg_flags &= ~(ECHO | CRMOD);
#else

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -43,7 +43,7 @@
#include <curses.priv.h>
#include <stddef.h>
MODULE_ID("$Id: lib_newwin.c,v 1.65 2009/11/14 01:12:48 Nicholas.Marriott Exp $")
MODULE_ID("$Id: lib_newwin.c,v 1.66 2010/04/24 23:31:18 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
@ -244,7 +244,7 @@ subwin(WINDOW *w, int l, int c, int y, int x)
static bool
dimension_limit(int value)
{
NCURSES_SIZE_T test = value;
NCURSES_SIZE_T test = (NCURSES_SIZE_T) value;
return (test == value && value > 0);
}
@ -284,13 +284,13 @@ NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx
win->_curx = 0;
win->_cury = 0;
win->_maxy = num_lines - 1;
win->_maxx = num_columns - 1;
win->_begy = begy;
win->_begx = begx;
win->_maxy = (NCURSES_SIZE_T) (num_lines - 1);
win->_maxx = (NCURSES_SIZE_T) (num_columns - 1);
win->_begy = (NCURSES_SIZE_T) begy;
win->_begx = (NCURSES_SIZE_T) begx;
win->_yoffset = SP_PARM->_topstolen;
win->_flags = flags;
win->_flags = (short) flags;
WINDOW_ATTRS(win) = A_NORMAL;
SetChar(win->_nc_bkgd, BLANK_TEXT, BLANK_ATTR);
@ -311,7 +311,7 @@ NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx
win->_parent = 0;
win->_regtop = 0;
win->_regbottom = num_lines - 1;
win->_regbottom = (NCURSES_SIZE_T) (num_lines - 1);
win->_pad._pad_y = -1;
win->_pad._pad_x = -1;
@ -341,7 +341,7 @@ NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx
* So that's how we want ncurses to behave.
*/
win->_line[i].firstchar = 0;
win->_line[i].lastchar = num_columns - 1;
win->_line[i].lastchar = (NCURSES_SIZE_T) (num_columns - 1);
if_USE_SCROLL_HINTS(win->_line[i].oldindex = i);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -42,7 +42,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_pad.c,v 1.45 2009/10/24 22:07:03 tom Exp $")
MODULE_ID("$Id: lib_pad.c,v 1.46 2010/04/24 23:50:45 tom Exp $")
NCURSES_EXPORT(WINDOW *)
NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c)
@ -127,10 +127,10 @@ pnoutrefresh(WINDOW *win,
int smaxrow,
int smaxcol)
{
NCURSES_SIZE_T i, j;
NCURSES_SIZE_T m, n;
NCURSES_SIZE_T pmaxrow;
NCURSES_SIZE_T pmaxcol;
int i, j;
int m, n;
int pmaxrow;
int pmaxcol;
SCREEN *sp;
#if USE_SCROLL_HINTS
@ -279,8 +279,8 @@ pnoutrefresh(WINDOW *win,
win->_line[i].oldindex = _NEWINDEX;
#endif
win->_begx = smincol;
win->_begy = sminrow;
win->_begx = (NCURSES_SIZE_T) smincol;
win->_begy = (NCURSES_SIZE_T) sminrow;
if (win->_clear) {
win->_clear = FALSE;
@ -296,8 +296,10 @@ pnoutrefresh(WINDOW *win,
&& win->_curx >= pmincol
&& win->_cury <= pmaxrow
&& win->_curx <= pmaxcol) {
NewScreen(sp)->_cury = win->_cury - pminrow + win->_begy + win->_yoffset;
NewScreen(sp)->_curx = win->_curx - pmincol + win->_begx;
NewScreen(sp)->_cury = (NCURSES_SIZE_T) (win->_cury - pminrow
+ win->_begy + win->_yoffset);
NewScreen(sp)->_curx = (NCURSES_SIZE_T) (win->_curx - pmincol
+ win->_begx);
}
NewScreen(sp)->_leaveok = win->_leaveok;
win->_flags &= ~_HASMOVED;
@ -307,12 +309,12 @@ pnoutrefresh(WINDOW *win,
* We will use this on subsequent calls to this function to derive
* values to stuff into 'oldindex[]' -- for scrolling optimization.
*/
win->_pad._pad_y = pminrow;
win->_pad._pad_x = pmincol;
win->_pad._pad_top = sminrow;
win->_pad._pad_left = smincol;
win->_pad._pad_bottom = smaxrow;
win->_pad._pad_right = smaxcol;
win->_pad._pad_y = (NCURSES_SIZE_T) pminrow;
win->_pad._pad_x = (NCURSES_SIZE_T) pmincol;
win->_pad._pad_top = (NCURSES_SIZE_T) sminrow;
win->_pad._pad_left = (NCURSES_SIZE_T) smincol;
win->_pad._pad_bottom = (NCURSES_SIZE_T) smaxrow;
win->_pad._pad_right = (NCURSES_SIZE_T) smaxcol;
returnCode(OK);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -47,7 +47,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_set_term.c,v 1.135 2009/11/28 21:49:24 tom Exp $")
MODULE_ID("$Id: lib_set_term.c,v 1.136 2010/04/24 23:09:24 tom Exp $")
#ifdef USE_TERM_DRIVER
#define MaxColors InfoOf(sp).maxcolors
@ -380,9 +380,9 @@ NCURSES_SP_NAME(_nc_setupscreen) (
setmode(output, O_BINARY);
#endif
NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_ARGx output, TRUE);
sp->_lines = slines;
sp->_lines_avail = slines;
sp->_columns = scolumns;
sp->_lines = (NCURSES_SIZE_T) slines;
sp->_lines_avail = (NCURSES_SIZE_T) slines;
sp->_columns = (NCURSES_SIZE_T) scolumns;
sp->_ofp = output;
SP_PRE_INIT(sp);
SetNoPadding(sp);
@ -663,11 +663,12 @@ NCURSES_SP_NAME(_nc_setupscreen) (
} else {
ReturnScreenError();
}
if (rop->line < 0)
if (rop->line < 0) {
bottom_stolen += count;
else
sp->_topstolen += count;
sp->_lines_avail -= count;
} else {
sp->_topstolen = (NCURSES_SIZE_T) (sp->_topstolen + count);
}
sp->_lines_avail = (NCURSES_SIZE_T) (sp->_lines_avail - count);
}
}
/* reset the stack */

View File

@ -35,7 +35,7 @@
/*
* $Id: curses.priv.h,v 1.458 2010/04/10 19:12:32 tom Exp $
* $Id: curses.priv.h,v 1.459 2010/04/24 23:21:58 tom Exp $
*
* curses.priv.h
*
@ -365,7 +365,7 @@ color_t;
#define if_EXT_COLORS(stmt) stmt
#define SetPair(value,p) SetPair2((value).ext_color, AttrOf(value), p)
#define SetPair2(c,a,p) c = (p), \
a = unColor2(a) | (A_COLOR & ColorPair(oldColor(c)))
a = (unColor2(a) | (A_COLOR & ColorPair(oldColor(c))))
#define GetPair(value) GetPair2((value).ext_color, AttrOf(value))
#define GetPair2(c,a) ((c) ? (c) : PairNumber(a))
#define oldColor(p) (((p) > 255) ? 255 : (p))
@ -564,7 +564,7 @@ extern NCURSES_EXPORT(int) _nc_sigprocmask(int, const sigset_t *, sigset_t *);
typedef unsigned colorpair_t; /* type big enough to store PAIR_OF() */
#define C_SHIFT 9 /* we need more bits than there are colors */
#define C_MASK ((1 << C_SHIFT) - 1)
#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
#define PAIR_OF(fg, bg) (colorpair_t) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK))
#define FORE_OF(c) (((c) >> C_SHIFT) & C_MASK)
#define BACK_OF(c) ((c) & C_MASK)
#define isDefaultColor(c) ((c) >= COLOR_DEFAULT || (c) < 0)
@ -1249,6 +1249,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define RESET_OUTCHARS() COUNT_OUTCHARS(-_nc_outchars)
#define UChar(c) ((unsigned char)(c))
#define UShort(c) ((unsigned short)(c))
#define ChCharOf(c) ((c) & (chtype)A_CHARTEXT)
#define ChAttrOf(c) ((c) & (chtype)A_ATTRIBUTES)
@ -1341,7 +1342,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define isWidecBase(ch) (WidecExt(ch) == 1)
#define isWidecExt(ch) (WidecExt(ch) > 1 && WidecExt(ch) < 32)
#define SetWidecExt(dst, ext) AttrOf(dst) &= ~A_CHARTEXT, \
AttrOf(dst) |= (ext + 1)
AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
#define Charable(ch) ((SP_PARM != 0 && SP_PARM->_legacy_coding) \
@ -1394,11 +1395,11 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#define CHANGED_CELL(line,col) \
if (line->firstchar == _NOCHANGE) \
line->firstchar = line->lastchar = col; \
line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \
else if ((col) < line->firstchar) \
line->firstchar = col; \
line->firstchar = (NCURSES_SIZE_T) col; \
else if ((col) > line->lastchar) \
line->lastchar = col
line->lastchar = (NCURSES_SIZE_T) col
#define CHANGED_RANGE(line,start,end) \
if (line->firstchar == _NOCHANGE \

View File

@ -42,7 +42,7 @@
#include <tic.h>
MODULE_ID("$Id: alloc_ttype.c,v 1.19 2010/01/23 17:57:43 tom Exp $")
MODULE_ID("$Id: alloc_ttype.c,v 1.20 2010/04/24 23:49:43 tom Exp $")
#if NCURSES_XNAMES
/*
@ -111,7 +111,7 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Booleans[base + m] = FALSE;
}
}
to->ext_Booleans = ext_Booleans;
to->ext_Booleans = UShort(ext_Booleans);
}
if (to->ext_Numbers != ext_Numbers) {
to->num_Numbers += (ext_Numbers - to->ext_Numbers);
@ -125,7 +125,7 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Numbers[base + m] = ABSENT_NUMERIC;
}
}
to->ext_Numbers = ext_Numbers;
to->ext_Numbers = UShort(ext_Numbers);
}
if (to->ext_Strings != ext_Strings) {
to->num_Strings += (ext_Strings - to->ext_Strings);
@ -139,7 +139,7 @@ realign_data(TERMTYPE *to, char **ext_Names,
to->Strings[base + m] = ABSENT_STRING;
}
}
to->ext_Strings = ext_Strings;
to->ext_Strings = UShort(ext_Strings);
}
}
@ -302,32 +302,32 @@ _nc_ins_ext_name(TERMTYPE *tp, char *name, int token_type)
for (k = total - 1; k > j; k--)
tp->ext_Names[k] = tp->ext_Names[k - 1];
tp->ext_Names[j] = name;
j = _nc_ext_data_index(tp, (int) j, token_type);
j = (unsigned) _nc_ext_data_index(tp, (int) j, token_type);
switch (token_type) {
case BOOLEAN:
tp->ext_Booleans++;
tp->num_Booleans++;
tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
for (k = tp->num_Booleans - 1; k > j; k--)
for (k = (unsigned) (tp->num_Booleans - 1); k > j; k--)
tp->Booleans[k] = tp->Booleans[k - 1];
break;
case NUMBER:
tp->ext_Numbers++;
tp->num_Numbers++;
tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
for (k = tp->num_Numbers - 1; k > j; k--)
for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--)
tp->Numbers[k] = tp->Numbers[k - 1];
break;
case STRING:
tp->ext_Strings++;
tp->num_Strings++;
tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
for (k = tp->num_Strings - 1; k > j; k--)
for (k = (unsigned) (tp->num_Strings - 1); k > j; k--)
tp->Strings[k] = tp->Strings[k - 1];
break;
}
return j;
return (int) j;
}
/*
@ -385,8 +385,8 @@ adjust_cancels(TERMTYPE *to, TERMTYPE *from)
NCURSES_EXPORT(void)
_nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
{
int na = NUM_EXT_NAMES(to);
int nb = NUM_EXT_NAMES(from);
int na = (int) NUM_EXT_NAMES(to);
int nb = (int) NUM_EXT_NAMES(from);
int n;
bool same;
char **ext_Names;
@ -416,7 +416,7 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
* into it, updating to's counts for booleans, etc. Fortunately we do
* this only for the terminfo compiler (tic) and comparer (infocmp).
*/
ext_Names = typeMalloc(char *, na + nb);
ext_Names = typeMalloc(char *, (size_t)(na + nb));
if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers))
adjust_cancels(to, from);
@ -460,8 +460,8 @@ _nc_align_termtype(TERMTYPE *to, TERMTYPE *from)
if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) {
nb = (ext_Booleans + ext_Numbers + ext_Strings);
realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings);
from->ext_Names = typeRealloc(char *, nb, from->ext_Names);
memcpy(from->ext_Names, ext_Names, sizeof(char *) * nb);
from->ext_Names = typeRealloc(char *, (size_t) nb, from->ext_Names);
memcpy(from->ext_Names, ext_Names, sizeof(char *) * (size_t) nb);
DEBUG(2, ("realigned %d extended names for '%s' (from)",
NUM_EXT_NAMES(from), from->term_names));
}

View File

@ -29,7 +29,7 @@
#include <curses.priv.h>
#include <tic.h> /* struct tinfo_fkeys */
MODULE_ID("$Id: init_keytry.c,v 1.16 2010/01/23 17:10:47 tom Exp $")
MODULE_ID("$Id: init_keytry.c,v 1.17 2010/04/24 22:29:56 tom Exp $")
/*
** _nc_init_keytry()
@ -66,7 +66,7 @@ _nc_tinfo_fkeysf(void)
NCURSES_EXPORT(void)
_nc_init_keytry(SCREEN *sp)
{
size_t n;
unsigned n;
/* The sp->_keytry value is initialized in newterm(), where the sp
* structure is created, because we can not tell where keypad() or
@ -90,7 +90,7 @@ _nc_init_keytry(SCREEN *sp)
{
TERMTYPE *tp = &(sp->_term->type);
for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) {
const char *name = ExtStrname(tp, (size_t) n, strnames);
const char *name = ExtStrname(tp, (int) n, strnames);
char *value = tp->Strings[n];
if (name != 0
&& *name == 'k'

View File

@ -48,7 +48,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_kernel.c,v 1.29 2010/01/16 16:33:38 tom Exp $")
MODULE_ID("$Id: lib_kernel.c,v 1.30 2010/04/24 23:12:25 tom Exp $")
static int
_nc_vdisable(void)
@ -59,7 +59,7 @@ _nc_vdisable(void)
#endif
#if defined(_PC_VDISABLE)
if (value == -1) {
value = fpathconf(0, _PC_VDISABLE);
value = (int) fpathconf(0, _PC_VDISABLE);
if (value == -1) {
value = 0377;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -49,7 +49,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_raw.c,v 1.18 2009/10/24 21:56:15 tom Exp $")
MODULE_ID("$Id: lib_raw.c,v 1.19 2010/04/24 23:49:12 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@ -91,8 +91,8 @@ NCURSES_SP_NAME(raw) (NCURSES_SP_DCL0)
buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag &= ~(ICANON | ISIG | IEXTEN);
buf.c_iflag &= ~(COOKED_INPUT);
buf.c_lflag &= (unsigned) ~(ICANON | ISIG | IEXTEN);
buf.c_iflag &= (unsigned) ~(COOKED_INPUT);
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
#else
@ -132,8 +132,8 @@ NCURSES_SP_NAME(cbreak) (NCURSES_SP_DCL0)
buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag &= ~ICANON;
buf.c_iflag &= ~ICRNL;
buf.c_lflag &= (unsigned) ~ICANON;
buf.c_iflag &= (unsigned) ~ICRNL;
buf.c_lflag |= ISIG;
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
@ -175,7 +175,7 @@ NCURSES_SP_NAME(qiflush) (NCURSES_SP_DCL0)
BEFORE("qiflush");
buf = termp->Nttyb;
#ifdef TERMIOS
buf.c_lflag &= ~(NOFLSH);
buf.c_lflag &= (unsigned) ~(NOFLSH);
result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
#else
/* FIXME */
@ -330,7 +330,7 @@ NCURSES_SP_NAME(intrflush) (NCURSES_SP_DCLx WINDOW *win GCC_UNUSED, bool flag)
buf = termp->Nttyb;
#ifdef TERMIOS
if (flag)
buf.c_lflag &= ~(NOFLSH);
buf.c_lflag &= (unsigned) ~(NOFLSH);
else
buf.c_lflag |= (NOFLSH);
result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);

View File

@ -39,11 +39,11 @@
#define USE_TERMLIB 1
#include <curses.priv.h>
MODULE_ID("$Id: make_keys.c,v 1.15 2008/11/16 00:19:59 juergen Exp $")
MODULE_ID("$Id: make_keys.c,v 1.16 2010/04/24 22:20:53 tom Exp $")
#include <names.c>
#define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames))
#define UNKNOWN (unsigned) (SIZEOF(strnames) + SIZEOF(strfnames))
static unsigned
lookup(const char *name)
@ -89,7 +89,7 @@ make_keys(FILE *ifp, FILE *ofp)
if (code == UNKNOWN)
continue;
if (strlen(from) > maxlen)
maxlen = strlen(from);
maxlen = (unsigned) strlen(from);
fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n",
code,
maxlen, maxlen,

View File

@ -47,7 +47,7 @@
#include <ctype.h>
#include <tic.h>
MODULE_ID("$Id: parse_entry.c,v 1.73 2010/04/17 22:41:48 tom Exp $")
MODULE_ID("$Id: parse_entry.c,v 1.74 2010/04/24 21:19:18 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@ -668,7 +668,7 @@ postprocess_termcap(TERMTYPE *tp, bool has_base)
else if (PRESENT(backspace_if_not_bs))
cursor_left = backspace_if_not_bs;
}
/* vi doesn't use "do", but it does seems to use nl (or '\n') instead */
/* vi doesn't use "do", but it does seem to use nl (or '\n') instead */
if (WANTED(cursor_down)) {
if (PRESENT(linefeed_if_not_lf))
cursor_down = linefeed_if_not_lf;

View File

@ -41,7 +41,7 @@
#include <tic.h>
MODULE_ID("$Id: read_entry.c,v 1.106 2010/01/23 17:57:43 tom Exp $")
MODULE_ID("$Id: read_entry.c,v 1.107 2010/04/24 23:47:42 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
@ -56,7 +56,7 @@ convert_shorts(char *buf, short *Numbers, int count)
else if (IS_NEG2(buf + 2 * i))
Numbers[i] = CANCELLED_NUMERIC;
else
Numbers[i] = LOW_MSB(buf + 2 * i);
Numbers[i] = (short) LOW_MSB(buf + 2 * i);
TR(TRACE_DATABASE, ("get Numbers[%d]=%d", i, Numbers[i]));
}
}
@ -98,9 +98,9 @@ fake_read(char *src, int *offset, int limit, char *dst, unsigned want)
if (have > 0) {
if ((int) want > have)
want = have;
want = (unsigned) have;
memcpy(dst, src + *offset, want);
*offset += want;
*offset += (int) want;
} else {
want = 0;
}
@ -154,7 +154,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
return (TGETENT_NO);
}
want = str_size + name_size + 1;
want = (unsigned) (str_size + name_size + 1);
if (str_size) {
/* try to allocate space for the string table */
if (str_count * 2 >= (int) sizeof(buf)
@ -172,14 +172,14 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
want = min(MAX_NAME_SIZE, (unsigned) name_size);
ptr->str_table = string_table;
ptr->term_names = string_table;
if ((have = Read(ptr->term_names, want)) != want) {
if ((have = (unsigned) Read(ptr->term_names, want)) != want) {
memset(ptr->term_names + have, 0, want - have);
}
ptr->term_names[want] = '\0';
string_table += (want + 1);
if (have > MAX_NAME_SIZE)
offset = (have - MAX_NAME_SIZE);
offset = (int) (have - MAX_NAME_SIZE);
/* grab the booleans */
if ((ptr->Booleans = TYPE_CALLOC(NCURSES_SBOOL,
@ -233,7 +233,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
int ext_str_count = LOW_MSB(buf + 4);
int ext_str_size = LOW_MSB(buf + 6);
int ext_str_limit = LOW_MSB(buf + 8);
unsigned need = (ext_bool_count + ext_num_count + ext_str_count);
unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count);
int base = 0;
if (need >= sizeof(buf)
@ -246,9 +246,9 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
|| ext_str_limit < 0)
return (TGETENT_NO);
ptr->num_Booleans = BOOLCOUNT + ext_bool_count;
ptr->num_Numbers = NUMCOUNT + ext_num_count;
ptr->num_Strings = STRCOUNT + ext_str_count;
ptr->num_Booleans = UShort(BOOLCOUNT + ext_bool_count);
ptr->num_Numbers = UShort(NUMCOUNT + ext_num_count);
ptr->num_Strings = UShort(STRCOUNT + ext_str_count);
ptr->Booleans = typeRealloc(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans);
ptr->Numbers = typeRealloc(short, ptr->num_Numbers, ptr->Numbers);
@ -260,7 +260,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ %d extended-booleans @%d",
ext_bool_count, offset));
if ((ptr->ext_Booleans = ext_bool_count) != 0) {
if ((ptr->ext_Booleans = UShort(ext_bool_count)) != 0) {
if (Read(ptr->Booleans + BOOLCOUNT, (unsigned)
ext_bool_count) != ext_bool_count)
return (TGETENT_NO);
@ -269,7 +269,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ %d extended-numbers @%d",
ext_num_count, offset));
if ((ptr->ext_Numbers = ext_num_count) != 0) {
if ((ptr->ext_Numbers = UShort(ext_num_count)) != 0) {
if (!read_shorts(buf, ext_num_count))
return (TGETENT_NO);
TR(TRACE_DATABASE, ("Before converting extended-numbers"));
@ -278,21 +278,22 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset));
if ((ext_str_count || need)
&& !read_shorts(buf, ext_str_count + need))
&& !read_shorts(buf, ext_str_count + (int) need))
return (TGETENT_NO);
TR(TRACE_DATABASE, ("READ %d bytes of extended-strings @%d",
ext_str_limit, offset));
if (ext_str_limit) {
if ((ptr->ext_str_table = typeMalloc(char, ext_str_limit)) == 0)
return (TGETENT_NO);
ptr->ext_str_table = typeMalloc(char, (size_t) ext_str_limit);
if (ptr->ext_str_table == 0)
return (TGETENT_NO);
if (Read(ptr->ext_str_table, (unsigned) ext_str_limit) != ext_str_limit)
return (TGETENT_NO);
TR(TRACE_DATABASE, ("first extended-string is %s", _nc_visbuf(ptr->ext_str_table)));
}
if ((ptr->ext_Strings = ext_str_count) != 0) {
if ((ptr->ext_Strings = UShort(ext_str_count)) != 0) {
TR(TRACE_DATABASE,
("Before computing extended-string capabilities str_count=%d, ext_str_count=%d",
str_count, ext_str_count));
@ -304,7 +305,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
_nc_visbuf(ptr->Strings[i + str_count])));
ptr->Strings[i + STRCOUNT] = ptr->Strings[i + str_count];
if (VALID_STRING(ptr->Strings[i + STRCOUNT]))
base += (strlen(ptr->Strings[i + STRCOUNT]) + 1);
base += (int) (strlen(ptr->Strings[i + STRCOUNT]) + 1);
TR(TRACE_DATABASE, ("... to [%d] %s",
i + STRCOUNT,
_nc_visbuf(ptr->Strings[i + STRCOUNT])));
@ -372,7 +373,7 @@ _nc_read_file_entry(const char *const filename, TERMTYPE *ptr)
T(("cannot open terminfo %s (errno=%d)", filename, errno));
code = TGETENT_NO;
} else {
if ((limit = read(fd, buffer, sizeof(buffer))) > 0) {
if ((limit = (int) read(fd, buffer, sizeof(buffer))) > 0) {
T(("read terminfo %s", filename));
if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) {
@ -404,7 +405,7 @@ _nc_read_tic_entry(char *filename,
* If we are looking in a directory, assume the entry is a file under that,
* according to the normal rules.
*/
unsigned need = LEAF_LEN + 3 + strlen(path) + strlen(name);
unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name));
if (need <= limit)
(void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -147,7 +147,7 @@ AUTHOR
#include <curses.priv.h>
MODULE_ID("$Id: hardscroll.c,v 1.45 2009/11/07 16:06:42 tom Exp $")
MODULE_ID("$Id: hardscroll.c,v 1.47 2010/04/24 23:46:47 tom Exp $")
#if defined(SCROLLDEBUG) || defined(HASHDEBUG)
@ -194,7 +194,9 @@ NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_DCL0)
#if USE_HASHMAP
/* get enough storage */
if (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) {
int *new_oldnums = typeRealloc(int, screen_lines(SP_PARM), oldnums(SP_PARM));
int *new_oldnums = typeRealloc(int,
(size_t) screen_lines(SP_PARM),
oldnums(SP_PARM));
if (!new_oldnums)
return;
oldnums(SP_PARM) = new_oldnums;
@ -294,14 +296,14 @@ NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_DCL0)
{
int n;
char *buf = 0;
size_t want = (screen_lines(SP_PARM) + 1) * 4;
size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4;
if ((buf = typeMalloc(char, want)) != 0) {
(void) strcpy(buf, "virt");
*buf = '\0';
for (n = 0; n < screen_lines(SP_PARM); n++)
(void) sprintf(buf + strlen(buf), " %02d", OLDNUM(SP_PARM, n));
TR(TRACE_UPDATE | TRACE_MOVE, (buf));
TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf));
free(buf);
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -73,7 +73,7 @@ AUTHOR
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: hashmap.c,v 1.61 2009/11/07 16:07:55 tom Exp $")
MODULE_ID("$Id: hashmap.c,v 1.62 2010/04/24 23:46:07 tom Exp $")
#ifdef HASHDEBUG
@ -122,7 +122,7 @@ hash(SCREEN *sp, NCURSES_CH_T * text)
unsigned long result = 0;
for (i = TEXTWIDTH(sp); i > 0; i--) {
ch = *text++;
result += (result << 5) + HASH_VAL(ch);
result += (result << 5) + (unsigned long) HASH_VAL(ch);
}
return result;
}
@ -282,7 +282,8 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0)
if (screen_lines(SP_PARM) > lines_alloc(SP_PARM)) {
if (hashtab(SP_PARM))
free(hashtab(SP_PARM));
hashtab(SP_PARM) = typeMalloc(HASHMAP, (screen_lines(SP_PARM) + 1) * 2);
hashtab(SP_PARM) = typeMalloc(HASHMAP,
((size_t) screen_lines(SP_PARM) + 1) * 2);
if (!hashtab(SP_PARM)) {
if (oldhash(SP_PARM)) {
FreeAndNull(oldhash(SP_PARM));
@ -303,10 +304,10 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0)
/* re-hash all */
if (oldhash(SP_PARM) == 0)
oldhash(SP_PARM) = typeCalloc(unsigned long,
(unsigned) screen_lines(SP_PARM));
(size_t) screen_lines(SP_PARM));
if (newhash(SP_PARM) == 0)
newhash(SP_PARM) = typeCalloc(unsigned long,
(unsigned) screen_lines(SP_PARM));
(size_t) screen_lines(SP_PARM));
if (!oldhash(SP_PARM) || !newhash(SP_PARM))
return; /* malloc failure */
for (i = 0; i < screen_lines(SP_PARM); i++) {
@ -328,7 +329,8 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0)
* Set up and count line-hash values.
*/
memset(hashtab(SP_PARM), '\0',
sizeof(*(hashtab(SP_PARM))) * (screen_lines(SP_PARM) + 1) * 2);
sizeof(*(hashtab(SP_PARM)))
* ((size_t) screen_lines(SP_PARM) + 1) * 2);
for (i = 0; i < screen_lines(SP_PARM); i++) {
unsigned long hashval = oldhash(SP_PARM)[i];
@ -433,7 +435,7 @@ NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_DCLx int n, int top, int bot)
if (!oldhash(SP_PARM))
return;
size = sizeof(*(oldhash(SP_PARM))) * (bot - top + 1 - abs(n));
size = sizeof(*(oldhash(SP_PARM))) * (size_t) (bot - top + 1 - abs(n));
if (n > 0) {
memmove(oldhash(SP_PARM) + top, oldhash(SP_PARM) + top + n, size);
for (i = bot; i > bot - n; i--)