X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fedit_field.c;h=db917de175ef1eb1bb84e547f6bf0b4942979d1a;hp=f1a2ced48421fbb78e40e03f584f0f1e90d4b66d;hb=119b5a6788c26bf7dcc99fcfd54e072946352a93;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c diff --git a/test/edit_field.c b/test/edit_field.c index f1a2ced4..db917de1 100644 --- a/test/edit_field.c +++ b/test/edit_field.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2014,2017 Free Software Foundation, Inc. * + * Copyright (c) 2003-2017,2019 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 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: edit_field.c,v 1.27 2017/04/15 17:57:40 tom Exp $ + * $Id: edit_field.c,v 1.30 2019/01/21 20:18:18 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 +178,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 +192,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 +212,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 +325,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 */