This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Handle 0 result from sscanf when parsing fp values.


dje@google.com (Doug Evans) writes:

> Index: objc-exp.y
> ===================================================================
> RCS file: /cvs/src/src/gdb/objc-exp.y,v
> retrieving revision 1.38
> diff -u -p -u -p -r1.38 objc-exp.y
> --- objc-exp.y	5 Mar 2010 20:18:14 -0000	1.38
> +++ objc-exp.y	17 Aug 2010 00:17:29 -0000
> @@ -1016,8 +1016,9 @@ parse_number (p, len, parsed_float, puti
>  
>        /* It's a float since it contains a point or an exponent.  */
>  
> -      sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
> -	      &putithere->typed_val_float.dval, &c);
> +      if (sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
> +		  &putithere->typed_val_float.dval, &c) != 1)

Shouldn't that be "< 1" since there can be two conversions?

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]