diff options
Diffstat (limited to 'lib/libform/fty_int.c')
-rw-r--r-- | lib/libform/fty_int.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/libform/fty_int.c b/lib/libform/fty_int.c index 8a713b45f74..e4238d8bc38 100644 --- a/lib/libform/fty_int.c +++ b/lib/libform/fty_int.c @@ -5,13 +5,20 @@ * If you develop a field type that might be of general use, please send * it back to the ncurses maintainers for inclusion in the next version. */ +/*************************************************************************** +* * +* Author : Juergen Pfeifer, Juergen.Pfeifer@T-Online.de * +* * +***************************************************************************/ #include "form.priv.h" +MODULE_ID("Id: fty_int.c,v 1.7 1997/04/19 15:22:40 juergen Exp $") + typedef struct { int precision; - int low; - int high; + long low; + long high; } integerARG; /*--------------------------------------------------------------------------- @@ -29,8 +36,8 @@ static void *Make_Integer_Type(va_list * ap) if (argp) { argp->precision = va_arg(*ap,int); - argp->low = va_arg(*ap,int); - argp->high = va_arg(*ap,int); + argp->low = va_arg(*ap,long); + argp->high = va_arg(*ap,long); } return (void *)argp; } @@ -45,7 +52,7 @@ static void *Make_Integer_Type(va_list * ap) +--------------------------------------------------------------------------*/ static void *Copy_Integer_Type(const void * argp) { - integerARG *ap = (integerARG *)argp; + const integerARG *ap = (const integerARG *)argp; integerARG *new = (integerARG *)0; if (argp) @@ -84,9 +91,9 @@ static void Free_Integer_Type(void * argp) +--------------------------------------------------------------------------*/ static bool Check_Integer_Field(FIELD * field, const void * argp) { - integerARG *argi = (integerARG *)argp; - int low = argi->low; - int high = argi->high; + const integerARG *argi = (const integerARG *)argp; + long low = argi->low; + long high = argi->high; int prec = argi->precision; unsigned char *bp = (unsigned char *)field_buffer(field,0); char *s = (char *)bp; @@ -110,7 +117,7 @@ static bool Check_Integer_Field(FIELD * field, const void * argp) { if (val<low || val>high) return FALSE; } - sprintf(buf,"%.*ld",prec,val); + sprintf(buf,"%.*ld",(prec>0?prec:0),val); set_field_buffer(field,0,buf); return TRUE; } @@ -129,7 +136,7 @@ static bool Check_Integer_Field(FIELD * field, const void * argp) | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_Integer_Character(int c, const void * argp) +static bool Check_Integer_Character(int c, const void * argp GCC_UNUSED) { return ((isdigit(c) || (c=='-')) ? TRUE : FALSE); } |