(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:
Assar Westerlund
2001-03-26 00:47:06 +00:00
parent 265769d177
commit 75ffa984b1

View File

@@ -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). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -84,7 +84,8 @@ parse_something (const char *s, const struct units *units,
++p; ++p;
val = strtod (p, &next); /* strtol(p, &next, 0); */ val = strtod (p, &next); /* strtol(p, &next, 0); */
if (val == 0 && p == next) { if (p == next) {
val = 0;
if(!accept_no_val_p) if(!accept_no_val_p)
return -1; return -1;
no_val_p = 1; no_val_p = 1;