Re: [RFC weston] Add strtoint() helper

2016-07-15 Thread Bryce Harrington
On Thu, Jul 14, 2016 at 05:35:55PM -0700, Thiago Macieira wrote: > On quinta-feira, 14 de julho de 2016 13:03:34 PDT Bryce Harrington wrote: > > + ret = strtol(str, &end, 10); > > Here you made a cast from long to int, which may be a loss of data. > > ret = strtol("4294967296", &end,

Re: [RFC weston] Add strtoint() helper

2016-07-15 Thread Bryce Harrington
On Fri, Jul 15, 2016 at 08:23:40AM +1000, Peter Hutterer wrote: > On Thu, Jul 14, 2016 at 01:03:34PM -0700, Bryce Harrington wrote: > > Adds a safe strtol helper function, modeled loosely after Wayland > > scanner's strtouint. This encapsulates the various quirks of strtol > > behavior, and stream

Re: [RFC weston] Add strtoint() helper

2016-07-14 Thread Thiago Macieira
On quinta-feira, 14 de julho de 2016 13:03:34 PDT Bryce Harrington wrote: > + ret = strtol(str, &end, 10); Here you made a cast from long to int, which may be a loss of data. ret = strtol("4294967296", &end, 10); Will produce no errno since it's in the valid range of long on LP64 s

Re: [RFC weston] Add strtoint() helper

2016-07-14 Thread Peter Hutterer
On Thu, Jul 14, 2016 at 01:03:34PM -0700, Bryce Harrington wrote: > Adds a safe strtol helper function, modeled loosely after Wayland > scanner's strtouint. This encapsulates the various quirks of strtol > behavior, and streamlines the interface to just handling base-10 numbers > with a simple tru

[RFC weston] Add strtoint() helper

2016-07-14 Thread Bryce Harrington
Adds a safe strtol helper function, modeled loosely after Wayland scanner's strtouint. This encapsulates the various quirks of strtol behavior, and streamlines the interface to just handling base-10 numbers with a simple true/false error indicator. Signed-off-by: Bryce Harrington --- Hi, With