X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fedit_field.c;h=b2b2084593576ad08907c41a8777fab74b350303;hp=f1a2ced48421fbb78e40e03f584f0f1e90d4b66d;hb=0af9283ca273c267ee6036c3b88115d9ba6d55a6;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c diff --git a/test/edit_field.c b/test/edit_field.c index f1a2ced4..b2b20845 100644 --- a/test/edit_field.c +++ b/test/edit_field.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2003-2014,2017 Free Software Foundation, Inc. * + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2003-2014,2017 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 * @@ -26,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: edit_field.c,v 1.27 2017/04/15 17:57:40 tom Exp $ + * $Id: edit_field.c,v 1.31 2020/02/02 23:34:34 tom Exp $ * * A wrapper for form_driver() which keeps track of the user's editing changes * for each field, and makes the resulting length available as a @@ -178,7 +179,7 @@ help_edit_field(void) { int used = 0; unsigned n; - char **msgs = typeCalloc(char *, 2 + SIZEOF(commands)); + char **msgs = typeCalloc(char *, 3 + SIZEOF(commands)); msgs[used++] = strdup("Defined form edit/traversal keys:"); for (n = 0; n < SIZEOF(commands); ++n) { @@ -192,7 +193,7 @@ help_edit_field(void) name = commands[n].help; need = 5 + strlen(code) + strlen(name); msg = typeMalloc(char, need); - sprintf(msg, "%s -- %s", code, name); + _nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name); msgs[used++] = msg; } msgs[used++] = @@ -212,7 +213,7 @@ offset_in_field(FORM *form) int currow, curcol; form_getyx(form, currow, curcol); - return curcol + currow * field->dcols; + return curcol + currow * (int) field->dcols; } static void @@ -325,12 +326,12 @@ edit_field(FORM *form, int *result) if (before_col > 0) { --length; } else if (before_row > 0) { - length -= before->cols + before_col; + length -= (int) before->cols + before_col; } } break; case REQ_NEW_LINE: - length += before->cols; + length += (int) before->cols; break; #if 0 /* FIXME: finish these */