(parse_something): do not check the return value from strtod, it might
return != 0.0 when the string has no digits. just testing if it consumed any characters is enough and more resilient git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9758 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -84,7 +84,8 @@ parse_something (const char *s, const struct units *units,
|
||||
++p;
|
||||
|
||||
val = strtod (p, &next); /* strtol(p, &next, 0); */
|
||||
if (val == 0 && p == next) {
|
||||
if (p == next) {
|
||||
val = 0;
|
||||
if(!accept_no_val_p)
|
||||
return -1;
|
||||
no_val_p = 1;
|
||||
|
Reference in New Issue
Block a user