Displaying 9 results from an estimated 9 matches for "strtou".
Did you mean:
strtoul
2014 Dec 19
2
Replace atoi and atol with strtol strtoul:Need Help
...e nice to be a bit smarter about this - now we've decided to
require C++11 for trunk, we can now use uint32_t here. Prior to C++11
I think we'd have to generate the API header based on configure checks
and then install it to an architecture-dependent path.
But anyway, there's no "strtou()" so you have to converting to unsigned
long with strtoul() and then check for potential overflow from the cast
to Xapian::valueno.
> I think you?ve been looking at other uses of atoi/atol; if you?ve
> successfully updated code then you should make a pull request or email
> a patch...
2014 Dec 18
4
Replace atoi and atol with strtol strtoul:Need Help
...The code you refer to is actually parsing a decimal value (like &) -
> the hex case (like &) uses sscanf().
>
> > For extracting number atoi is used and value
> > returned by it is stored in variable "val" , I think so replacing atoi
> with
> > strtoul would be useful here as number can have larger value although the
> > variable "val" is unsigned int so i need to change the that definition of
> > "val" also. Is that ok to do so ? Just need to clarify .
>
> We ultimately pass val to Xapian::Unicode::nonascii...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...const char *str, int64_t *rp)
-{
- long long r;
- char *end;
-
- errno = 0;
- r = strtoll (str, &end, 0);
-#if INT64_MAX != LONGLONG_MAX
- if (r < INT64_MIN || r > INT64_MAX)
- errno = ERANGE;
-#endif
- PARSE_COMMON_TAIL;
-}
-
-/* Functions for parsing unsigned integers. */
-
-/* strtou* functions have surprising behaviour if the first character
- * (after whitespace) is '-', so reject this early.
- */
-#define PARSE_ERROR_IF_NEGATIVE \
- do { \
- while (isspace (*s...
2019 Sep 21
2
[PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...{
- char *end;
int r;
if (strcmp (key, "socket") == 0) {
@@ -145,12 +144,8 @@ nbd_config (const char *key, const char *value)
else if (strcmp (key, "export") == 0)
export = value;
else if (strcmp (key, "retry") == 0) {
- errno = 0;
- retry = strtoul (value, &end, 0);
- if (value == end || errno) {
- nbdkit_error ("could not parse retry as integer (%s)", value);
+ if (nbdkit_parse_unsigned ("retry", value, &retry) == -1)
return -1;
- }
}
else if (strcmp (key, "shared") == 0) {...
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...-1)
Assumes twos-complement, but that's sane enough for the platforms we target.
> +#endif
> + if (r < SSIZE_MIN || r > SSIZE_MAX)
> + errno = ERANGE;
> +#endif
> + PARSE_COMMON_TAIL;
> +}
> +
> +/* Functions for parsing unsigned integers. */
> +
> +/* strtou* functions have surprising behaviour if the first character
> + * (after whitespace) is '-', so deny this.
> + */
> +#define PARSE_ERROR_IF_NEGATIVE \
> + do { \
> + c...
2019 Sep 23
2
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...ook several rounds to get it right.
> > +#endif
> > + if (r < SSIZE_MIN || r > SSIZE_MAX)
> > + errno = ERANGE;
> > +#endif
> > + PARSE_COMMON_TAIL;
> > +}
> > +
> > +/* Functions for parsing unsigned integers. */
> > +
> > +/* strtou* functions have surprising behaviour if the first character
> > + * (after whitespace) is '-', so deny this.
> > + */
> > +#define PARSE_ERROR_IF_NEGATIVE \
> > + do {...
2020 Mar 26
9
[PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
This is the previous 5/9 patch posted earlier today, split into
reviewable chunks. This passes bisection with -x 'make && make
check', but I didn't work very hard on the commit messages, so I refer
you back to the original patch to explain how it works:
https://www.redhat.com/archives/libguestfs/2020-March/msg00248.html
Rich.
2019 Sep 23
2
[PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...{
- char *end;
int r;
if (strcmp (key, "socket") == 0) {
@@ -145,12 +144,8 @@ nbd_config (const char *key, const char *value)
else if (strcmp (key, "export") == 0)
export = value;
else if (strcmp (key, "retry") == 0) {
- errno = 0;
- retry = strtoul (value, &end, 0);
- if (value == end || errno) {
- nbdkit_error ("could not parse retry as integer (%s)", value);
+ if (nbdkit_parse_unsigned ("retry", value, &retry) == -1)
return -1;
- }
}
else if (strcmp (key, "shared") == 0) {...
2020 Mar 26
15
[PATCH nbdkit 0/9] Create libnbdkit.so
This creates libnbdkit.so as discussed in the following thread:
https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00203
test-delay-shutdown.sh fails for unclear reasons.
This series starts by reverting "tests: Don't strand hung nbdkit
processes" which is because several other tests fail randomly unless I
revert this patch. I didn't investigate this yet so it