X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftty%2Fhardscroll.c;h=af68c961728d4ac1453a575de4160810c226772f;hp=af0b66c42b933c1527ba5e1d6c38c5133fbf7074;hb=f79b52fddd95c7a6f1ead29ef9c39eb8cdf60795;hpb=7a6bbc8cf41c5186d46accc3d08622dc86526b34 diff --git a/ncurses/tty/hardscroll.c b/ncurses/tty/hardscroll.c index af0b66c4..af68c961 100644 --- a/ncurses/tty/hardscroll.c +++ b/ncurses/tty/hardscroll.c @@ -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 -MODULE_ID("$Id: hardscroll.c,v 1.43 2009/04/18 21:41:30 tom Exp $") +MODULE_ID("$Id: hardscroll.c,v 1.47 2010/04/24 23:46:47 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) @@ -174,7 +174,7 @@ NCURSES_EXPORT_VAR (int *) # define oldnums(sp) (sp)->_oldnum_list # define OLDNUM(sp,n) oldnums(sp)[n] # else /* !USE_HASHMAP */ -# define OLDNUM(sp,n) sp->_newscr->_line[n].oldindex +# define OLDNUM(sp,n) NewScreen(sp)->_line[n].oldindex # endif /* !USE_HASHMAP */ #define OLDNUM_SIZE(sp) (sp)->_oldnum_size @@ -188,13 +188,15 @@ NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_DCL0) int i; int start, end, shift; - TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize(%p)"), SP_PARM)); + TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize(%p)"), (void *) SP_PARM)); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) #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); } }