X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_screen.c;h=6afba6611c6178f13c15105a290a2573577b472e;hp=d2f430225a2c3ffc7d89a8d7884dcc048b92a47d;hb=1f7a36fe16b11bb4aab51be89bbc1b0f75936b78;hpb=88e7914acafc37f84af25b80f403eb4290e423d4 diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c index d2f43022..6afba661 100644 --- a/ncurses/base/lib_screen.c +++ b/ncurses/base/lib_screen.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2017,2018 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 * @@ -41,7 +42,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_screen.c,v 1.95 2019/05/04 20:31:31 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.100 2020/05/25 22:48:41 tom Exp $") #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ @@ -57,7 +58,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.95 2019/05/04 20:31:31 tom Exp $") #define ARG_SLIMIT(name) /* nothing */ #endif -#define CUR_SLIMIT _nc_SLIMIT(limit - (target - base)) +#define CUR_SLIMIT _nc_SLIMIT(limit - (size_t) (target - base)) #define TOP_SLIMIT _nc_SLIMIT(sizeof(buffer)) /* @@ -66,7 +67,7 @@ MODULE_ID("$Id: lib_screen.c,v 1.95 2019/05/04 20:31:31 tom Exp $") * format. It happens to be unused in the file 5.22 database (2015/03/07). */ static const char my_magic[] = -{'\210', '\210', '\210', '\210'}; +{'\210', '\210', '\210', '\210', 0}; #if NCURSES_EXT_PUTWIN typedef enum { @@ -440,7 +441,7 @@ read_win(WINDOW *win, FILE *fp) } static int -read_row(char *source, NCURSES_CH_T * prior, NCURSES_CH_T * target, int length) +read_row(char *source, NCURSES_CH_T *prior, NCURSES_CH_T *target, int length) { while (*source != '\0' && length > 0) { #if NCURSES_WIDECHAR @@ -514,13 +515,13 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep) * Read the first 4 bytes to determine first if this is an old-format * screen-dump, or new-format. */ - if (read_block(&tmp, 4, filep) < 0) { + if (read_block(&tmp, (size_t) 4, filep) < 0) { returnWin(0); } /* * If this is a new-format file, and we do not support it, give up. */ - if (!memcmp(&tmp, my_magic, 4)) { + if (!memcmp(&tmp, my_magic, (size_t) 4)) { #if NCURSES_EXT_PUTWIN if (read_win(&tmp, filep) < 0) #endif @@ -823,7 +824,7 @@ putwin(WINDOW *win, FILE *filep) attr_t attr; *buffer = '\0'; - if (!strncmp(name, "_pad.", 5) && !(win->_flags & _ISPAD)) { + if (!strncmp(name, "_pad.", (size_t) 5) && !(win->_flags & _ISPAD)) { continue; } switch (scr_params[y].type) {