summaryrefslogtreecommitdiff
path: root/ncurses/base/lib_slkset.c
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/base/lib_slkset.c')
-rw-r--r--ncurses/base/lib_slkset.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ncurses/base/lib_slkset.c b/ncurses/base/lib_slkset.c
index 91483f1..9091e00 100644
--- a/ncurses/base/lib_slkset.c
+++ b/ncurses/base/lib_slkset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2010 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 *
@@ -44,13 +44,13 @@
#endif
#endif
-MODULE_ID("$Id: lib_slkset.c,v 1.21 2010/12/25 23:43:58 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.24 2012/12/08 23:09:25 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
{
SLK *slk;
- int offset;
+ int offset = 0;
int numchrs;
int numcols;
int limit;
@@ -111,13 +111,12 @@ NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
slk->ent[i].ent_text[numchrs] = '\0';
if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text,
- (unsigned) (limit +
- numchrs + 1))
+ (size_t) (limit +
+ numchrs + 1))
) == 0)
returnCode(ERR);
switch (format) {
- default:
case 0: /* left-justified */
offset = 0;
break;
@@ -131,16 +130,16 @@ NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
if (offset <= 0)
offset = 0;
else
- memset(slk->ent[i].form_text, ' ', (unsigned) offset);
+ memset(slk->ent[i].form_text, ' ', (size_t) offset);
memcpy(slk->ent[i].form_text + offset,
slk->ent[i].ent_text,
- (unsigned) numchrs);
+ (size_t) numchrs);
if (offset < limit) {
memset(slk->ent[i].form_text + offset + numchrs,
' ',
- (unsigned) (limit - (offset + numcols)));
+ (size_t) (limit - (offset + numcols)));
}
slk->ent[i].form_text[numchrs - numcols + limit] = 0;