[Sysfence-commit] sysfence/parseopt lex.c,1.10,1.11 parse.c,1.16,1.17
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-05-31 14:10:22
|
Update of /cvsroot/sysfence/sysfence/parseopt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9425/parseopt Modified Files: lex.c parse.c Log Message: * BUGFIX: using long long int to avoid type overflow Index: lex.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/parseopt/lex.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- lex.c 26 May 2004 17:54:53 -0000 1.10 +++ lex.c 31 May 2004 14:10:06 -0000 1.11 @@ -193,10 +193,11 @@ void * get_int () { - long int *res = (long int *) xalloc (NULL, sizeof (long int)); - char *endptr; + long long int *res = + (long long int *) xalloc (NULL, sizeof (long long int)); + char *endptr; - *res = strtol (lexptr, &endptr, 10); + *res = strtoll (lexptr, &endptr, 10); if (isdelim (*endptr) && (! errno)) { lexptr = endptr; return (void *) res; @@ -223,11 +224,11 @@ void * get_size () { - long int *res = (long int *) xalloc (NULL, sizeof (long int)); - long int mult; - char *endptr; + long long int *res = (long long int *) xalloc (NULL, sizeof (long long int)); + long int mult; + char *endptr; - *res = strtol (lexptr, &endptr, 10); + *res = strtoll (lexptr, &endptr, 10); if (errno) return NULL; /* size in bytes */ Index: parse.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/parseopt/parse.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- parse.c 28 May 2004 23:29:10 -0000 1.16 +++ parse.c 31 May 2004 14:10:06 -0000 1.17 @@ -402,7 +402,7 @@ /* long int 2 double */ val->type = VA_DBL; tmp = xalloc (NULL, sizeof (double)); - *tmp = (double) *((long int *) val->val); + *tmp = (double) *((long long int *) val->val); free (val->val); val->val = tmp; } |