From: Thomas E. Dickey Date: Sun, 11 Mar 2012 01:59:25 +0000 (+0000) Subject: ncurses 5.9 - patch 20120310 X-Git-Tag: v6.0~163 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=ba39fbc2e0cee4681395df4079d9e61c27262132;hp=b0916ab669030bac5c8590c0d66e36e1b9b34e9b ncurses 5.9 - patch 20120310 + fix some strict compiler warnings for abi6 and 64-bits. + use begin_va_copy/end_va_copy macros in lib_printw.c (cf: 20120303). + improve a limit-check in infocmp.c (Werner Fink): --- diff --git a/NEWS b/NEWS index bd9a03a7..ec3a1e2f 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1873 2012/03/01 09:53:21 tom Exp $ +-- $Id: NEWS,v 1.1876 2012/03/11 00:35:40 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,11 @@ 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. +20120310 + + fix some strict compiler warnings for abi6 and 64-bits. + + use begin_va_copy/end_va_copy macros in lib_printw.c (cf: 20120303). + + improve a limit-check in infocmp.c (Werner Fink): + 20120303 + minor tidying of terminfo.tail, clarify reason for limitation regarding mapping of \0 to \200 diff --git a/dist.mk b/dist.mk index 77d627d4..3f54946f 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.862 2012/02/29 10:02:11 tom Exp $ +# $Id: dist.mk,v 1.863 2012/03/10 19:42:38 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 = 9 -NCURSES_PATCH = 20120303 +NCURSES_PATCH = 20120310 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/form/fld_def.c b/form/fld_def.c index 604e0189..681a3713 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.39 2011/07/16 22:26:11 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.40 2012/03/11 00:37:16 tom Exp $") /* this can't be readonly */ static FIELD default_field = @@ -294,14 +294,14 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = default_field; - New_Field->rows = rows; - New_Field->cols = cols; + New_Field->rows = (short) rows; + New_Field->cols = (short) cols; New_Field->drows = rows + nrow; New_Field->dcols = cols; - New_Field->frow = frow; - New_Field->fcol = fcol; + New_Field->frow = (short) frow; + New_Field->fcol = (short) fcol; New_Field->nrow = nrow; - New_Field->nbuf = nbuf; + New_Field->nbuf = (short) nbuf; New_Field->link = New_Field; #if USE_WIDEC_SUPPORT diff --git a/form/fld_dup.c b/form/fld_dup.c index b8e501b3..2df40ee0 100644 --- a/form/fld_dup.c +++ b/form/fld_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.13 2010/01/23 21:14:35 tom Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -60,8 +60,8 @@ dup_field(FIELD *field, int frow, int fcol) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = *_nc_Default_Field; - New_Field->frow = frow; - New_Field->fcol = fcol; + New_Field->frow = (short) frow; + New_Field->fcol = (short) fcol; New_Field->link = New_Field; New_Field->rows = field->rows; New_Field->cols = field->cols; diff --git a/form/fld_just.c b/form/fld_just.c index 58a1750c..dea20b79 100644 --- a/form/fld_just.c +++ b/form/fld_just.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_just.c,v 1.12 2010/01/23 21:14:35 tom Exp $") +MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -59,7 +59,7 @@ set_field_just(FIELD *field, int just) Normalize_Field(field); if (field->just != just) { - field->just = just; + field->just = (short) just; res = _nc_Synchronize_Attributes(field); } else diff --git a/form/fld_link.c b/form/fld_link.c index 18103bee..b6c47680 100644 --- a/form/fld_link.c +++ b/form/fld_link.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_link.c,v 1.12 2010/01/23 21:14:35 tom Exp $") +MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -61,8 +61,8 @@ link_field(FIELD *field, int frow, int fcol) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = *_nc_Default_Field; - New_Field->frow = frow; - New_Field->fcol = fcol; + New_Field->frow = (short) frow; + New_Field->fcol = (short) fcol; New_Field->link = field->link; field->link = New_Field; diff --git a/form/fld_max.c b/form/fld_max.c index 5ce918e4..6f72a388 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_max.c,v 1.11 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -62,7 +62,7 @@ set_max_field(FIELD *field, int maxgrow) RETURN(E_BAD_ARGUMENT); } field->maxgrow = maxgrow; - field->status &= ~_MAY_GROW; + field->status &= (unsigned short) (~_MAY_GROW); if (!(field->opts & O_STATIC)) { if ((maxgrow == 0) || diff --git a/form/fld_move.c b/form/fld_move.c index dfba22d7..99f54904 100644 --- a/form/fld_move.c +++ b/form/fld_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_move.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -56,8 +56,8 @@ move_field(FIELD *field, int frow, int fcol) if (field->form) RETURN(E_CONNECTED); - field->frow = frow; - field->fcol = fcol; + field->frow = (short) frow; + field->fcol = (short) fcol; RETURN(E_OK); } diff --git a/form/fld_page.c b/form/fld_page.c index e4d18c55..8d5c8cbf 100644 --- a/form/fld_page.c +++ b/form/fld_page.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_page.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_page.c,v 1.11 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -56,7 +56,7 @@ set_new_page(FIELD *field, bool new_page_flag) if (new_page_flag) field->status |= _NEWPAGE; else - field->status &= ~_NEWPAGE; + field->status &= (unsigned short) (~_NEWPAGE); RETURN(E_OK); } diff --git a/form/fld_stat.c b/form/fld_stat.c index 46f89e67..3e6f1921 100644 --- a/form/fld_stat.c +++ b/form/fld_stat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.12 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_stat.c,v 1.13 2012/03/11 00:37:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -53,7 +53,7 @@ set_field_status(FIELD *field, bool status) if (status) field->status |= _CHANGED; else - field->status &= ~_CHANGED; + field->status &= (unsigned short)(~_CHANGED); RETURN(E_OK); } diff --git a/form/form.priv.h b/form/form.priv.h index 49250b4e..38dd8caa 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2012 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 * @@ -30,11 +30,11 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.32 2009/11/07 21:26:43 tom Exp $ */ +/* $Id: form.priv.h,v 0.33 2012/03/11 00:37:46 tom Exp $ */ #ifndef FORM_PRIV_H #define FORM_PRIV_H 1 - +/* *INDENT-OFF*/ #include "curses.priv.h" #include "mf_common.h" @@ -119,7 +119,7 @@ extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; /* Calculate the total size of all buffers for this field */ #define Total_Buffer_Size(field) \ - ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) * sizeof(FIELD_CELL) ) + ( (size_t)(Buffer_Length(field) + 1) * (size_t)(1+(field)->nbuf) * sizeof(FIELD_CELL) ) /* Logic to determine whether or not a field is single lined */ #define Single_Line_Field(field) \ @@ -293,5 +293,6 @@ extern NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); result = ((*buffer || (l < width)) ? FALSE : TRUE); \ } #endif +/* *INDENT-ON*/ #endif /* FORM_PRIV_H */ diff --git a/form/frm_def.c b/form/frm_def.c index 86500f23..fd7b56a4 100644 --- a/form/frm_def.c +++ b/form/frm_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.25 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $") /* this can't be readonly */ static FORM default_form = @@ -199,14 +199,14 @@ Connect_Fields(FORM *form, FIELD **fields) for (j = 0; j < field_cnt; j++) { if (j == 0) - pg->pmin = j; + pg->pmin = (short) j; else { if (fields[j]->status & _NEWPAGE) { - pg->pmax = j - 1; + pg->pmax = (short) (j - 1); pg++; - pg->pmin = j; + pg->pmin = (short) j; } } @@ -214,14 +214,14 @@ Connect_Fields(FORM *form, FIELD **fields) maximum_col_in_field = fields[j]->fcol + fields[j]->cols; if (form->rows < maximum_row_in_field) - form->rows = maximum_row_in_field; + form->rows = (short) maximum_row_in_field; if (form->cols < maximum_col_in_field) - form->cols = maximum_col_in_field; + form->cols = (short) maximum_col_in_field; } - pg->pmax = field_cnt - 1; - form->maxfield = field_cnt; - form->maxpage = page_nr; + pg->pmax = (short) (field_cnt - 1); + form->maxfield = (short) field_cnt; + form->maxpage = (short) page_nr; /* Sort fields on form pages */ for (page_nr = 0; page_nr < form->maxpage; page_nr++) @@ -230,8 +230,8 @@ Connect_Fields(FORM *form, FIELD **fields) for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++) { - fields[j]->index = j; - fields[j]->page = page_nr; + fields[j]->index = (short) j; + fields[j]->page = (short) page_nr; fld = Insert_Field_By_Position(fields[j], fld); } if (fld) diff --git a/form/frm_driver.c b/form/frm_driver.c index f335ed26..549ce805 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 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 * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.99 2011/09/17 22:12:10 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.100 2012/03/11 00:37:16 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -172,7 +172,7 @@ static int FE_Delete_Previous(FORM *); instead of a derived window because it contains invisible parts. This is true for non-public fields and for scrollable fields. */ #define Has_Invisible_Parts(field) \ - (!((field)->opts & O_PUBLIC) || \ + (!((unsigned)(field)->opts & O_PUBLIC) || \ Is_Scroll_Field(field)) /* Logic to decide whether or not a field needs justification */ @@ -180,7 +180,7 @@ static int FE_Delete_Previous(FORM *); (((field)->just != NO_JUSTIFICATION) && \ (Single_Line_Field(field)) && \ (((field)->dcols == (field)->cols) && \ - ((field)->opts & O_STATIC)) ) + ((unsigned)(field)->opts & O_STATIC))) /* Logic to determine whether or not a dynamic field may still grow */ #define Growable(field) ((field)->status & _MAY_GROW) @@ -188,13 +188,13 @@ static int FE_Delete_Previous(FORM *); /* Macro to set the attributes for a fields window */ #define Set_Field_Window_Attributes(field,win) \ ( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \ - (void) wattrset((win),(field)->fore) ) + (void) wattrset((win), (int)(field)->fore) ) /* Logic to decide whether or not a field really appears on the form */ #define Field_Really_Appears(field) \ ((field->form) &&\ (field->form->status & _POSTED) &&\ - (field->opts & O_VISIBLE) &&\ + ((unsigned)field->opts & O_VISIBLE) &&\ (field->page == field->form->curpage)) /* Logic to determine whether or not we are on the first position in the @@ -601,7 +601,7 @@ Synchronize_Buffer(FORM *form) { if (form->status & _WINDOW_MODIFIED) { - form->status &= ~_WINDOW_MODIFIED; + form->status &= (unsigned short) (~_WINDOW_MODIFIED); form->status |= _FCHECK_REQUIRED; Window_To_Buffer(form, form->current); wmove(form->w, form->currow, form->curcol); @@ -653,7 +653,7 @@ Field_Grown(FIELD *field, int amount) growth = Minimum(field->maxgrow - field->dcols, growth); field->dcols += growth; if (field->dcols == field->maxgrow) - field->status &= ~_MAY_GROW; + field->status &= (unsigned short) (~_MAY_GROW); } else { @@ -662,7 +662,7 @@ Field_Grown(FIELD *field, int amount) growth = Minimum(field->maxgrow - field->drows, growth); field->drows += growth; if (field->drows == field->maxgrow) - field->status &= ~_MAY_GROW; + field->status &= (unsigned short) (~_MAY_GROW); } /* drows, dcols changed, so we get really the new buffer length */ new_buflen = Buffer_Length(field); @@ -860,7 +860,7 @@ _nc_Refresh_Current_Field(FORM *form) field = form->current; formwin = Get_Form_Window(form); - if (field->opts & O_PUBLIC) + if ((unsigned)field->opts & O_PUBLIC) { if (Is_Scroll_Field(field)) { @@ -909,7 +909,7 @@ _nc_Refresh_Current_Field(FORM *form) /* means we have to copy whole range */ first_modified_row = form->toprow; first_unmodified_row = first_modified_row + field->rows; - field->status &= ~_NEWTOP; + field->status &= (unsigned short)(~_NEWTOP); } else { @@ -1111,27 +1111,27 @@ Display_Or_Erase_Field(FIELD *field, bool bEraseFlag) return E_SYSTEM_ERROR; else { - if (field->opts & O_VISIBLE) + if ((unsigned)field->opts & O_VISIBLE) { Set_Field_Window_Attributes(field, win); } else { - (void)wattrset(win, WINDOW_ATTRS(fwin)); + (void)wattrset(win, (int)WINDOW_ATTRS(fwin)); } werase(win); } if (!bEraseFlag) { - if (field->opts & O_PUBLIC) + if ((unsigned)field->opts & O_PUBLIC) { if (Justification_Allowed(field)) Perform_Justification(field, win); else Buffer_To_Window(field, win); } - field->status &= ~_NEWTOP; + field->status &= (unsigned short)(~_NEWTOP); } wsyncup(win); delwin(win); @@ -1170,7 +1170,7 @@ Synchronize_Field(FIELD *field) form->currow = form->curcol = form->toprow = form->begincol = 0; werase(form->w); - if ((field->opts & O_PUBLIC) && Justification_Allowed(field)) + if (((unsigned)field->opts & O_PUBLIC) && Justification_Allowed(field)) Undo_Justification(field, form->w); else Buffer_To_Window(field, form->w); @@ -1256,7 +1256,7 @@ _nc_Synchronize_Attributes(FIELD *field) werase(form->w); wmove(form->w, form->currow, form->curcol); - if (field->opts & O_PUBLIC) + if ((unsigned)field->opts & O_PUBLIC) { if (Justification_Allowed(field)) Undo_Justification(field, form->w); @@ -1328,32 +1328,32 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts) } if (form->curpage == field->page) { - if (changed_opts & O_VISIBLE) + if ((unsigned) changed_opts & O_VISIBLE) { - if (newopts & O_VISIBLE) + if ((unsigned) newopts & O_VISIBLE) res = Display_Field(field); else res = Erase_Field(field); } else { - if ((changed_opts & O_PUBLIC) && - (newopts & O_VISIBLE)) + if (((unsigned) changed_opts & O_PUBLIC) && + ((unsigned) newopts & O_VISIBLE)) res = Display_Field(field); } } } } - if (changed_opts & O_STATIC) + if ((unsigned) changed_opts & O_STATIC) { bool single_line_field = Single_Line_Field(field); int res2 = E_OK; - if (newopts & O_STATIC) + if ((unsigned) newopts & O_STATIC) { /* the field becomes now static */ - field->status &= ~_MAY_GROW; + field->status &= (unsigned short)(~_MAY_GROW); /* if actually we have no hidden columns, justification may occur again */ if (single_line_field && @@ -1424,16 +1424,16 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) !(form->status & _POSTED)) { if ((form->w) && - (field->opts & O_VISIBLE) && + ((unsigned)field->opts & O_VISIBLE) && (field->form->curpage == field->page)) { _nc_Refresh_Current_Field(form); - if (field->opts & O_PUBLIC) + if ((unsigned)field->opts & O_PUBLIC) { if (field->drows > field->rows) { if (form->toprow == 0) - field->status &= ~_NEWTOP; + field->status &= (unsigned short)(~_NEWTOP); else field->status |= _NEWTOP; } @@ -1469,7 +1469,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) delwin(form->w); form->w = new_window; - form->status &= ~_WINDOW_MODIFIED; + form->status &= (unsigned short)(~_WINDOW_MODIFIED); Set_Field_Window_Attributes(field, form->w); if (Has_Invisible_Parts(field)) @@ -2430,7 +2430,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form) int result = E_REQUEST_DENIED; bool Last_Row = ((field->drows - 1) == form->currow); - if ((field->opts & O_WRAP) && /* wrapping wanted */ + if (((unsigned)field->opts & O_WRAP) && /* wrapping wanted */ (!Single_Line_Field(field)) && /* must be multi-line */ (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ (!Last_Row || Growable(field))) /* there are more lines */ @@ -2513,7 +2513,7 @@ Field_Editing(int (*const fct) (FORM *), FORM *form) editable fields. */ if ((fct == FE_Delete_Previous) && - (form->opts & O_BS_OVERLOAD) && + ((unsigned)form->opts & O_BS_OVERLOAD) && First_Position_In_Current_Field(form)) { res = Inter_Field_Navigation(FN_Previous_Field, form); @@ -2522,7 +2522,7 @@ Field_Editing(int (*const fct) (FORM *), FORM *form) { if (fct == FE_New_Line) { - if ((form->opts & O_NL_OVERLOAD) && + if (((unsigned)form->opts & O_NL_OVERLOAD) && First_Position_In_Current_Field(form)) { res = Inter_Field_Navigation(FN_Next_Field, form); @@ -2534,7 +2534,7 @@ Field_Editing(int (*const fct) (FORM *), FORM *form) else { /* From now on, everything must be editable */ - if (form->current->opts & O_EDIT) + if ((unsigned)form->current->opts & O_EDIT) { res = fct(form); if (res == E_OK) @@ -2571,7 +2571,7 @@ FE_New_Line(FORM *form) if (Last_Row && (!(Growable(field) && !Single_Line_Field(field)))) { - if (!(form->opts & O_NL_OVERLOAD)) + if (!((unsigned)form->opts & O_NL_OVERLOAD)) returnCode(E_REQUEST_DENIED); wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); @@ -2605,7 +2605,7 @@ FE_New_Line(FORM *form) if (Last_Row && !(Growable(field) && !Single_Line_Field(field))) { - if (!(form->opts & O_NL_OVERLOAD)) + if (!((unsigned)form->opts & O_NL_OVERLOAD)) returnCode(E_REQUEST_DENIED); returnCode(Inter_Field_Navigation(FN_Next_Field, form)); } @@ -2942,7 +2942,7 @@ static int EM_Insert_Mode(FORM *form) { T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form)); - form->status &= ~_OVLMODE; + form->status &= (unsigned short)(~_OVLMODE); returnCode(E_OK); } @@ -3111,7 +3111,7 @@ Check_Field(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp) { if (typ) { - if (field->opts & O_NULLOK) + if ((unsigned)field->opts & O_NULLOK) { FIELD_CELL *bp = field->buf; @@ -3168,11 +3168,11 @@ _nc_Internal_Validation(FORM *form) Synchronize_Buffer(form); if ((form->status & _FCHECK_REQUIRED) || - (!(field->opts & O_PASSOK))) + (!((unsigned)field->opts & O_PASSOK))) { if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg))) return FALSE; - form->status &= ~_FCHECK_REQUIRED; + form->status &= (unsigned short)(~_FCHECK_REQUIRED); field->status |= _CHANGED; Synchronize_Linked_Fields(field); } @@ -3273,14 +3273,15 @@ _nc_First_Active_Field(FORM *form) do { field = (field == last_on_page) ? first : field + 1; - if (((*field)->opts & O_VISIBLE)) + if (((unsigned)(*field)->opts & O_VISIBLE)) break; } while (proposed != (*field)); proposed = *field; - if ((proposed == *last_on_page) && !(proposed->opts & O_VISIBLE)) + if ((proposed == *last_on_page) && + !((unsigned)proposed->opts & O_VISIBLE)) { /* This means, there is also no visible field on the page. So we propose the first one and hope the very best... @@ -3816,11 +3817,11 @@ _nc_Set_Form_Page(FORM *form, int page, FIELD *field) FIELD *last_field, *field_on_page; werase(Get_Form_Window(form)); - form->curpage = page; + form->curpage = (short)page; last_field = field_on_page = form->field[form->page[page].smin]; do { - if (field_on_page->opts & O_VISIBLE) + if ((unsigned)field_on_page->opts & O_VISIBLE) if ((res = Display_Field(field_on_page)) != E_OK) return (res); field_on_page = field_on_page->snext; @@ -3999,13 +4000,13 @@ Data_Entry(FORM *form, int c) int result = E_REQUEST_DENIED; T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c))); - if ((field->opts & O_EDIT) + if (((unsigned) field->opts & O_EDIT) #if FIX_FORM_INACTIVE_BUG - && (field->opts & O_ACTIVE) + && ((unsigned) field->opts & O_ACTIVE) #endif ) { - if ((field->opts & O_BLANK) && + if (((unsigned) field->opts & O_BLANK) && First_Position_In_Current_Field(form) && !(form->status & _FCHECK_REQUIRED) && !(form->status & _WINDOW_MODIFIED)) @@ -4036,7 +4037,7 @@ Data_Entry(FORM *form, int c) ((field->dcols - 1) == form->curcol)); form->status |= _WINDOW_MODIFIED; - if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP)) + if (End_Of_Field && !Growable(field) && ((unsigned) field->opts & O_AUTOSKIP)) result = Inter_Field_Navigation(FN_Next_Field, form); else { @@ -4246,7 +4247,7 @@ form_driver(FORM *form, int c) NULL /* Choice Request is generic */ }; size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0])); - size_t method = (BI->keycode >> ID_Shft) & 0xffff; /* see ID_Mask */ + size_t method = (size_t)((BI->keycode >> ID_Shft) & 0xffff); /* see ID_Mask */ if ((method >= nMethods) || !(BI->cmd)) res = E_SYSTEM_ERROR; @@ -4401,14 +4402,14 @@ set_field_buffer(FIELD *field, int buffer, const char *value) if (!field || !value || ((buffer < 0) || (buffer > field->nbuf))) RETURN(E_BAD_ARGUMENT); - len = Buffer_Length(field); + len = (unsigned) Buffer_Length(field); if (Growable(field)) { /* for a growable field we must assume zero terminated strings, because somehow we have to detect the length of what should be copied. */ - unsigned int vlen = strlen(value); + unsigned vlen = (unsigned) strlen(value); if (vlen > len) { @@ -4438,7 +4439,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) delwin(field->working); field->working = newpad(1, Buffer_Length(field) + 1); } - len = Buffer_Length(field); + len = (unsigned)Buffer_Length(field); wclear(field->working); (void)mvwaddstr(field->working, 0, 0, value); @@ -4450,8 +4451,8 @@ set_field_buffer(FIELD *field, int buffer, const char *value) { for (i = 0; i < (unsigned)field->drows; ++i) { - (void)mvwin_wchnstr(field->working, 0, i * field->dcols, - widevalue + (i * field->dcols), + (void)mvwin_wchnstr(field->working, 0, (int)i * field->dcols, + widevalue + ((int)i * field->dcols), field->dcols); } for (i = 0; i < len; ++i) @@ -4512,7 +4513,7 @@ field_buffer(const FIELD *field, int buffer) { #if USE_WIDEC_SUPPORT FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer); - unsigned need = 0; + size_t need = 0; int size = Buffer_Length(field); int n; @@ -4613,7 +4614,7 @@ _nc_Widen_String(char *source, int *lengthp) { result[need] = wch; } - passed += status; + passed += (size_t) status; ++need; } else @@ -4633,7 +4634,7 @@ _nc_Widen_String(char *source, int *lengthp) break; result = typeCalloc(wchar_t, need); - *lengthp = need; + *lengthp = (int) need; if (result == 0) break; } diff --git a/form/frm_hook.c b/form/frm_hook.c index 7daa396b..23850bfd 100644 --- a/form/frm_hook.c +++ b/form/frm_hook.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -32,13 +32,13 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.15 2010/01/23 21:12:08 tom Exp $") +MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ {\ - T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\ + T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\ (Normalize_Form( form ) -> typ ## name) = func ;\ RETURN(E_OK);\ } diff --git a/menu/m_attribs.c b/menu/m_attribs.c index c41d558e..eff90d60 100644 --- a/menu/m_attribs.c +++ b/menu/m_attribs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_attribs.c,v 1.16 2010/01/23 21:16:54 tom Exp $") +MODULE_ID("$Id: m_attribs.c,v 1.17 2012/03/10 23:43:41 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -51,7 +51,7 @@ MODULE_ID("$Id: m_attribs.c,v 1.16 2010/01/23 21:16:54 tom Exp $") #define GEN_MENU_ATTR_SET_FCT( name ) \ NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU* menu, chtype attr) \ {\ - T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr))); \ + T((T_CALLED("set_menu_" #name "(%p,%s)"), (void *) menu, _traceattr(attr))); \ if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ RETURN(E_BAD_ARGUMENT);\ if (menu && ( menu -> name != attr))\ diff --git a/menu/m_driver.c b/menu/m_driver.c index dcc1c55d..1a7a3911 100644 --- a/menu/m_driver.c +++ b/menu/m_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.30 2011/05/21 18:56:41 tom Exp $") +MODULE_ID("$Id: m_driver.c,v 1.31 2012/03/10 23:43:41 tom Exp $") /* Macros */ @@ -47,7 +47,7 @@ MODULE_ID("$Id: m_driver.c,v 1.30 2011/05/21 18:56:41 tom Exp $") /* Add a new character to the match pattern buffer */ #define Add_Character_To_Pattern(menu,ch) \ - { (menu)->pattern[((menu)->pindex)++] = (ch);\ + { (menu)->pattern[((menu)->pindex)++] = (char) (ch);\ (menu)->pattern[(menu)->pindex] = '\0'; } /*--------------------------------------------------------------------------- diff --git a/menu/m_format.c b/menu/m_format.c index 8e68a036..e13ddc5a 100644 --- a/menu/m_format.c +++ b/menu/m_format.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_format.c,v 1.16 2010/01/23 21:20:10 tom Exp $") +MODULE_ID("$Id: m_format.c,v 1.17 2012/03/10 23:43:41 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) @@ -81,8 +81,8 @@ set_menu_format(MENU * menu, int rows, int cols) if (menu->pattern) Reset_Pattern(menu); - menu->frows = rows; - menu->fcols = cols; + menu->frows = (short)rows; + menu->fcols = (short)cols; assert(rows > 0 && cols > 0); total_rows = (menu->nitems - 1) / cols + 1; @@ -90,9 +90,9 @@ set_menu_format(MENU * menu, int rows, int cols) minimum(menu->nitems, cols) : (menu->nitems - 1) / total_rows + 1; - menu->rows = total_rows; - menu->cols = total_cols; - menu->arows = minimum(total_rows, rows); + menu->rows = (short)total_rows; + menu->cols = (short)total_cols; + menu->arows = (short)minimum(total_rows, rows); menu->toprow = 0; menu->curitem = *(menu->items); assert(menu->curitem); @@ -102,9 +102,9 @@ set_menu_format(MENU * menu, int rows, int cols) else { if (rows > 0) - _nc_Default_Menu.frows = rows; + _nc_Default_Menu.frows = (short)rows; if (cols > 0) - _nc_Default_Menu.fcols = cols; + _nc_Default_Menu.fcols = (short)cols; } RETURN(E_OK); diff --git a/menu/m_global.c b/menu/m_global.c index 90f6f259..dbd58652 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.25 2010/01/23 21:20:10 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.26 2012/03/10 23:43:41 tom Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ @@ -117,17 +117,17 @@ ComputeMaximum_NameDesc_Lengths(MENU * menu) assert(menu && menu->items); for (items = menu->items; *items; items++) { - check = _nc_Calculate_Text_Width(&((*items)->name)); + check = (unsigned) _nc_Calculate_Text_Width(&((*items)->name)); if (check > MaximumNameLength) MaximumNameLength = check; - check = _nc_Calculate_Text_Width(&((*items)->description)); + check = (unsigned) _nc_Calculate_Text_Width(&((*items)->description)); if (check > MaximumDescriptionLength) MaximumDescriptionLength = check; } - menu->namelen = MaximumNameLength; - menu->desclen = MaximumDescriptionLength; + menu->namelen = (short) MaximumNameLength; + menu->desclen = (short) MaximumDescriptionLength; T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen)); } @@ -195,7 +195,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) { (*item)->value = FALSE; } - (*item)->index = ItemCount++; + (*item)->index = (short) ItemCount++; (*item)->imenu = menu; } } @@ -206,7 +206,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) if (ItemCount != 0) { menu->items = items; - menu->nitems = ItemCount; + menu->nitems = (short) ItemCount; ComputeMaximum_NameDesc_Lengths(menu); if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen)))) { @@ -256,7 +256,7 @@ _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item)); if (result != 0 && item->str != 0) { - int count = mbstowcs(0, item->str, 0); + int count = (int) mbstowcs(0, item->str, 0); wchar_t *temp = 0; if (count > 0 @@ -343,7 +343,7 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) assert(menu); - menu->height = 1 + menu->spc_rows * (menu->arows - 1); + menu->height = (short) (1 + menu->spc_rows * (menu->arows - 1)); l = calculate_actual_width(menu, TRUE); l += menu->marklen; @@ -354,10 +354,10 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) l += menu->spc_desc; } - menu->itemlen = l; + menu->itemlen = (short) l; l *= menu->cols; l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */ - menu->width = l; + menu->width = (short) l; T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d", menu->cols, @@ -388,7 +388,7 @@ _nc_Link_Items(MENU * menu) int Last_in_Column; bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE; - menu->status &= ~_LINK_NEEDED; + menu->status &= (unsigned short) (~_LINK_NEEDED); if (menu->opt & O_ROWMAJOR) { @@ -431,8 +431,8 @@ _nc_Link_Items(MENU * menu) (cycle ? menu->items[(row + 1) < menu->rows ? Number_Of_Items - 1 : col] : (ITEM *) 0); - item->x = col; - item->y = row; + item->x = (short) col; + item->y = (short) row; if (++col == Number_Of_Columns) { row++; @@ -482,8 +482,8 @@ _nc_Link_Items(MENU * menu) (ITEM *) 0 ); - item->x = col; - item->y = row; + item->x = (short) col; + item->y = (short) row; if ((++row) == Number_Of_Rows) { col++; @@ -568,7 +568,7 @@ _nc_New_TopRow_and_CurrentItem( cur_item = menu->curitem; assert(cur_item); - menu->toprow = new_toprow; + menu->toprow = (short) new_toprow; menu->curitem = new_current_item; if (mterm_called) @@ -590,7 +590,7 @@ _nc_New_TopRow_and_CurrentItem( } else { /* if we are not posted, this is quite simple */ - menu->toprow = new_toprow; + menu->toprow = (short) new_toprow; menu->curitem = new_current_item; } } diff --git a/menu/m_hook.c b/menu/m_hook.c index 6125d052..671fab65 100644 --- a/menu/m_hook.c +++ b/menu/m_hook.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,13 +37,13 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_hook.c,v 1.15 2010/01/23 21:16:54 tom Exp $") +MODULE_ID("$Id: m_hook.c,v 1.16 2012/03/10 23:43:41 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ {\ - T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\ + T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), (void *) menu, func));\ (Normalize_Menu(menu) -> typ ## name = func );\ RETURN(E_OK);\ } diff --git a/menu/m_item_new.c b/menu/m_item_new.c index f218d3ef..7f5daa9d 100644 --- a/menu/m_item_new.c +++ b/menu/m_item_new.c @@ -44,7 +44,7 @@ #endif #endif -MODULE_ID("$Id: m_item_new.c,v 1.31 2012/02/23 10:02:15 tom Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.32 2012/03/10 23:41:36 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -62,7 +62,7 @@ Is_Printable_String(const char *s) int result = TRUE; #if USE_WIDEC_SUPPORT - int count = mbstowcs(0, s, 0); + int count = (int)mbstowcs(0, s, 0); wchar_t *temp = 0; assert(s); @@ -127,13 +127,13 @@ new_item(const char *name, const char *description) { *item = _nc_Default_Item; /* hope we have struct assignment */ - item->name.length = strlen(name); + item->name.length = (unsigned short)strlen(name); item->name.str = name; if (description && (*description != '\0') && Is_Printable_String(description)) { - item->description.length = strlen(description); + item->description.length = (unsigned short)strlen(description); item->description.str = description; } else @@ -195,12 +195,12 @@ free_item(ITEM * item) NCURSES_EXPORT(int) set_menu_mark(MENU * menu, const char *mark) { - unsigned l; + short l; T((T_CALLED("set_menu_mark(%p,%s)"), (void *)menu, _nc_visbuf(mark))); if (mark && (*mark != '\0') && Is_Printable_String(mark)) - l = strlen(mark); + l = (short)strlen(mark); else l = 0; @@ -213,7 +213,7 @@ set_menu_mark(MENU * menu, const char *mark) { /* If the menu is already posted, the geometry is fixed. Then we can only accept a mark with exactly the same length */ - if (menu->marklen != (int)l) + if (menu->marklen != l) RETURN(E_BAD_ARGUMENT); } menu->marklen = l; @@ -228,7 +228,7 @@ set_menu_mark(MENU * menu, const char *mark) else { menu->mark = old_mark; - menu->marklen = (old_mark != 0) ? strlen(old_mark) : 0; + menu->marklen = (short)((old_mark != 0) ? strlen(old_mark) : 0); RETURN(E_SYSTEM_ERROR); } } diff --git a/menu/m_pad.c b/menu/m_pad.c index caa2f9e2..0abaf67a 100644 --- a/menu/m_pad.c +++ b/menu/m_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pad.c,v 1.12 2010/01/23 21:20:10 tom Exp $") +MODULE_ID("$Id: m_pad.c,v 1.13 2012/03/10 23:43:41 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -69,7 +69,7 @@ set_menu_pad(MENU * menu, int pad) RETURN(E_BAD_ARGUMENT); Normalize_Menu(menu); - menu->pad = pad; + menu->pad = (unsigned char)pad; if (do_refresh) Refresh_Menu(menu); diff --git a/menu/m_post.c b/menu/m_post.c index 1f0b623e..bfe6ebb3 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.29 2010/05/01 19:18:27 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.30 2012/03/10 23:43:41 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -67,7 +67,7 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) - it is a onevalued menu and it is the current item - or it has a selection value */ - wattron(menu->win, menu->back); + wattron(menu->win, (int)menu->back); if (item->value || (item == menu->curitem)) { if (menu->marklen) @@ -79,13 +79,13 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) item. */ if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem) { - wattron(menu->win, menu->fore); + wattron(menu->win, (int)menu->fore); isfore = TRUE; } waddstr(menu->win, menu->mark); if (isfore) { - wattron(menu->win, menu->fore); + wattron(menu->win, (int)menu->fore); isfore = FALSE; } } @@ -93,7 +93,7 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) else /* otherwise we have to wipe out the marker area */ for (ch = ' ', i = menu->marklen; i > 0; i--) waddch(menu->win, ch); - wattroff(menu->win, menu->back); + wattroff(menu->win, (int)menu->back); count += menu->marklen; /* First we have to calculate the attribute depending on selectability @@ -101,19 +101,19 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) */ if (!(item->opt & O_SELECTABLE)) { - wattron(menu->win, menu->grey); + wattron(menu->win, (int)menu->grey); isgrey = TRUE; } else { if (item->value || item == menu->curitem) { - wattron(menu->win, menu->fore); + wattron(menu->win, (int)menu->fore); isfore = TRUE; } else { - wattron(menu->win, menu->back); + wattron(menu->win, (int)menu->back); isback = TRUE; } } @@ -158,10 +158,10 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) assert(cx >= 0 && cy >= 0); getyx(menu->win, ncy, ncx); if (isgrey) - wattroff(menu->win, menu->grey); + wattroff(menu->win, (int)menu->grey); else if (isfore) - wattroff(menu->win, menu->fore); - wattron(menu->win, menu->back); + wattroff(menu->win, (int)menu->fore); + wattron(menu->win, (int)menu->back); for (j = 1; j < menu->spc_rows; j++) { if ((item_y + j) < getmaxy(menu->win)) @@ -175,17 +175,17 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) } wmove(menu->win, ncy, ncx); if (!isback) - wattroff(menu->win, menu->back); + wattroff(menu->win, (int)menu->back); } } /* Remove attributes */ if (isfore) - wattroff(menu->win, menu->fore); + wattroff(menu->win, (int)menu->fore); if (isback) - wattroff(menu->win, menu->back); + wattroff(menu->win, (int)menu->back); if (isgrey) - wattroff(menu->win, menu->grey); + wattroff(menu->win, (int)menu->grey); } /*--------------------------------------------------------------------------- @@ -225,7 +225,7 @@ _nc_Draw_Menu(const MENU * menu) { _nc_Post_Item(menu, hitem); - wattron(menu->win, menu->back); + wattron(menu->win, (int)menu->back); if (((hitem = hitem->right) != lasthor) && hitem) { int i, j, cy, cx; @@ -244,7 +244,7 @@ _nc_Draw_Menu(const MENU * menu) } } while (hitem && (hitem != lasthor)); - wattroff(menu->win, menu->back); + wattroff(menu->win, (int)menu->back); item = item->down; y += menu->spc_rows; @@ -369,7 +369,7 @@ unpost_menu(MENU * menu) delwin(menu->win); menu->win = (WINDOW *)0; - menu->status &= ~_POSTED; + menu->status &= (unsigned short)(~_POSTED); RETURN(E_OK); } diff --git a/menu/m_spacing.c b/menu/m_spacing.c index 1cfa2e16..01941f56 100644 --- a/menu/m_spacing.c +++ b/menu/m_spacing.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_spacing.c,v 1.18 2010/01/23 21:20:10 tom Exp $") +MODULE_ID("$Id: m_spacing.c,v 1.19 2012/03/10 23:43:41 tom Exp $") #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) @@ -70,9 +70,9 @@ set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col) ((s_col < 0) || (s_col > MAX_SPC_COLS))) RETURN(E_BAD_ARGUMENT); - m->spc_desc = s_desc ? s_desc : 1; - m->spc_rows = s_row ? s_row : 1; - m->spc_cols = s_col ? s_col : 1; + m->spc_desc = (short)(s_desc ? s_desc : 1); + m->spc_rows = (short)(s_row ? s_row : 1); + m->spc_cols = (short)(s_col ? s_col : 1); _nc_Calculate_Item_Length_and_Width(m); RETURN(E_OK); diff --git a/menu/menu.priv.h b/menu/menu.priv.h index 99580a38..763ca4a6 100644 --- a/menu/menu.priv.h +++ b/menu/menu.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2009,2012 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 * @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.priv.h,v 1.23 2009/02/28 21:02:57 juergen Exp $ */ +/* $Id: menu.priv.h,v 1.24 2012/03/10 23:43:41 tom Exp $ */ /*************************************************************************** * Module menu.priv.h * @@ -39,6 +39,7 @@ #ifndef MENU_PRIV_H_incl #define MENU_PRIV_H_incl 1 +/* *INDENT-OFF* */ #include "curses.priv.h" #include "mf_common.h" @@ -99,10 +100,11 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; */ #define Adjust_Current_Item(menu,row,item) \ { if ((item)->y < row) \ - row = (item)->y;\ - if ( (item)->y >= (row + (menu)->arows) )\ - row = ( (item)->y < ((menu)->rows - row) ) ? \ - (item)->y : (menu)->rows - (menu)->arows;\ + row = (short) (item)->y; \ + if ( (item)->y >= (row + (menu)->arows) ) \ + row = (short) (( (item)->y < ((menu)->rows - row) ) \ + ? (item)->y \ + : (menu)->rows - (menu)->arows); \ _nc_New_TopRow_and_CurrentItem(menu,row,item); } /* Reset the match pattern buffer */ @@ -152,5 +154,6 @@ extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options); #define returnMenuOpts(code) return code #endif /* TRACE/!TRACE */ +/* *INDENT-ON* */ #endif /* MENU_PRIV_H_incl */ diff --git a/menu/mf_common.h b/menu/mf_common.h index 681672dc..115d6a81 100644 --- a/menu/mf_common.h +++ b/menu/mf_common.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2012 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 * @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: mf_common.h,v 0.22 2005/11/26 15:26:52 tom Exp $ */ +/* $Id: mf_common.h,v 0.23 2012/03/10 23:43:41 tom Exp $ */ /* Common internal header for menu and form library */ @@ -63,10 +63,9 @@ extern int errno; #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing*/ +#define MODULE_ID(id) /*nothing */ #endif - /* Maximum regular 8-bit character code */ #define MAX_REGULAR_CHARACTER (0xff) @@ -80,16 +79,16 @@ extern int errno; #endif /* The few common values in the status fields for menus and forms */ -#define _POSTED (0x01U) /* menu or form is posted */ -#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ +#define _POSTED (0x01U) /* menu or form is posted */ +#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ /* Call object hook */ #define Call_Hook( object, handler ) \ if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ {\ - (object)->status |= _IN_DRIVER;\ + (object)->status |= (unsigned short) (_IN_DRIVER);\ (object)->handler(object);\ - (object)->status &= ~_IN_DRIVER;\ + (object)->status &= (unsigned short) (~_IN_DRIVER);\ } #endif /* MF_COMMON_H_incl */ diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c index ac0cbcb0..2150279f 100644 --- a/ncurses/base/lib_bkgd.c +++ b/ncurses/base/lib_bkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 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 * @@ -36,7 +36,7 @@ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.44 2011/05/28 20:44:22 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.45 2012/03/10 21:20:18 tom Exp $") /* * Set the window's background information. @@ -127,7 +127,7 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch) wgetbkgrnd(win, &old_bkgrnd); (void) wbkgrndset(win, CHREF(new_bkgd)); - (void) wattrset(win, AttrOf(win->_nc_bkgd)); + (void) wattrset(win, (int) AttrOf(win->_nc_bkgd)); for (y = 0; y <= win->_maxy; y++) { for (x = 0; x <= win->_maxx; x++) { diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c index 530e7134..3064c260 100644 --- a/ncurses/base/lib_printw.c +++ b/ncurses/base/lib_printw.c @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_printw.c,v 1.21 2012/02/29 10:11:53 Werner.Fink Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.22 2012/03/10 20:47:33 tom Exp $") NCURSES_EXPORT(int) printw(const char *fmt,...) @@ -49,11 +49,11 @@ printw(const char *fmt,...) #ifdef TRACE va_list argq; - va_copy(argq, argp); + begin_va_copy(argq, argp); va_start(argq, fmt); T((T_CALLED("printw(%s%s)"), _nc_visbuf(fmt), _nc_varargs(fmt, argq))); - va_end(argq); + end_va_copy(argq); #endif va_start(argp, fmt); @@ -71,11 +71,11 @@ wprintw(WINDOW *win, const char *fmt,...) #ifdef TRACE va_list argq; - va_copy(argq, argp); + begin_va_copy(argq, argp); va_start(argq, fmt); T((T_CALLED("wprintw(%p,%s%s)"), (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); - va_end(argq); + end_va_copy(argq); #endif va_start(argp, fmt); @@ -93,11 +93,11 @@ mvprintw(int y, int x, const char *fmt,...) #ifdef TRACE va_list argq; - va_copy(argq, argp); + begin_va_copy(argq, argp); va_start(argq, fmt); T((T_CALLED("mvprintw(%d,%d,%s%s)"), y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); - va_end(argq); + end_va_copy(argq); #endif if ((code = move(y, x)) != ERR) { @@ -116,11 +116,11 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...) #ifdef TRACE va_list argq; - va_copy(argq, argp); + begin_va_copy(argq, argp); va_start(argq, fmt); T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"), y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq))); - va_end(argq); + end_va_copy(argq); #endif if ((code = wmove(win, y, x)) != ERR) { diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index e535a494..5fbb7b9a 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.498 2012/02/29 10:38:18 tom Exp $ + * $Id: curses.priv.h,v 1.499 2012/03/10 21:16:32 tom Exp $ * * curses.priv.h * @@ -398,7 +398,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 & (unsigned) 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)) @@ -407,9 +407,9 @@ color_t; #define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b)) #if NCURSES_SP_FUNCS -#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0) +#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, (short) pair, 0) #else -#define VIDATTR(sp,attr,pair) vid_attr(attr, pair, 0) +#define VIDATTR(sp,attr,pair) vid_attr(attr, (short) pair, 0) #endif #else /* !NCURSES_EXT_COLORS */ diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c index ac1b8eca..7fac5c50 100644 --- a/ncurses/widechar/lib_cchar.c +++ b/ncurses/widechar/lib_cchar.c @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: lib_cchar.c,v 1.24 2011/10/22 15:52:36 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.25 2012/03/10 20:52:21 tom Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch @@ -60,7 +60,7 @@ setcchar(cchar_t *wcval, if (opts != NULL || wch == NULL - || ((len = wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) { + || ((len = (unsigned) wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) { code = ERR; } else { if (len > CCHARW_MAX) diff --git a/panel/p_above.c b/panel/p_above.c index 8bbf1bc2..76209fe8 100644 --- a/panel/p_above.c +++ b/panel/p_above.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -36,13 +36,13 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_above.c,v 1.8 2010/01/23 21:22:15 tom Exp $") +MODULE_ID("$Id: p_above.c,v 1.9 2012/03/10 23:43:41 tom Exp $") #if NCURSES_SP_FUNCS NCURSES_EXPORT(PANEL *) ground_panel(SCREEN * sp) { - T((T_CALLED("ground_panel(%p)"), sp)); + T((T_CALLED("ground_panel(%p)"), (void *)sp)); if (sp) { struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); diff --git a/panel/p_below.c b/panel/p_below.c index f276ef95..913efa91 100644 --- a/panel/p_below.c +++ b/panel/p_below.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2012 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 * @@ -36,13 +36,13 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.8 2010/01/23 21:22:15 tom Exp $") +MODULE_ID("$Id: p_below.c,v 1.9 2012/03/10 23:43:41 tom Exp $") #if NCURSES_SP_FUNCS NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN * sp) { - T((T_CALLED("ceiling_panel(%p)"), sp)); + T((T_CALLED("ceiling_panel(%p)"), (void *)sp)); if (sp) { struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 6d6efc11..354901eb 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.98 2012/02/29 01:04:17 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.99 2012/03/10 23:20:35 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -1195,11 +1195,11 @@ show_entry(void) if (ch == '\n') { ; } else if (isspace(UChar(ch))) { - outbuf.used = j; + outbuf.used = (size_t) j; } else if (!infodump && ch == '\\') { - outbuf.used = j; + outbuf.used = (size_t) j; } else if (ch == delim && (j == 0 || outbuf.text[j - 1] != '\\')) { - outbuf.used = (j + 1); + outbuf.used = (size_t) (j + 1); } else { break; } diff --git a/progs/infocmp.c b/progs/infocmp.c index 021d8011..4f0323aa 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.112 2012/02/22 23:59:53 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.114 2012/03/11 00:10:57 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -1089,9 +1089,10 @@ dump_initializers(TERMTYPE *term) if (VALID_STRING(term->Strings[n])) { tp = buf; +#define TP_LIMIT ((MAX_STRING - 5) - (size_t)(tp - buf)) *tp++ = '"'; for (sp = term->Strings[n]; - *sp != 0 && (tp - buf) < MAX_STRING - 6; + *sp != 0 && TP_LIMIT > 2; sp++) { if (isascii(UChar(*sp)) && isprint(UChar(*sp)) @@ -1099,7 +1100,7 @@ dump_initializers(TERMTYPE *term) && *sp != '"') *tp++ = *sp; else { - _nc_SPRINTF(tp, _nc_SLIMIT(MAX_STRING) "\\%03o", UChar(*sp)); + _nc_SPRINTF(tp, _nc_SLIMIT(TP_LIMIT) "\\%03o", UChar(*sp)); tp += 4; } } diff --git a/progs/toe.c b/progs/toe.c index a5cf8bb8..f1b836fe 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -44,7 +44,7 @@ #include #endif -MODULE_ID("$Id: toe.c,v 1.66 2012/02/22 23:57:44 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.67 2012/03/10 23:22:21 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -295,10 +295,10 @@ checksum_of(TERMTYPE *tp) unsigned i; for (i = 0; i < NUM_BOOLEANS(tp); i++) { - result += (tp->Booleans[i]); + result += (unsigned long) (tp->Booleans[i]); } for (i = 0; i < NUM_NUMBERS(tp); i++) { - result += (tp->Numbers[i]); + result += (unsigned long) (tp->Numbers[i]); } for (i = 0; i < NUM_STRINGS(tp); i++) { result += string_sum(tp->Strings[i]);