|
Tor
0.4.7.0-alpha-dev
|
Convert strings into the integers they encode, with bounds checking. More...
#include "lib/string/parse_int.h"#include "lib/cc/compat_compiler.h"#include <errno.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | CHECK_STRTOX_RESULT() |
Functions | |
| long | tor_parse_long (const char *s, int base, long min, long max, int *ok, char **next) |
| unsigned long | tor_parse_ulong (const char *s, int base, unsigned long min, unsigned long max, int *ok, char **next) |
| double | tor_parse_double (const char *s, double min, double max, int *ok, char **next) |
| uint64_t | tor_parse_uint64 (const char *s, int base, uint64_t min, uint64_t max, int *ok, char **next) |
Convert strings into the integers they encode, with bounds checking.
Definition in file parse_int.c.
| #define CHECK_STRTOX_RESULT | ( | ) |
Definition at line 20 of file parse_int.c.
| double tor_parse_double | ( | const char * | s, |
| double | min, | ||
| double | max, | ||
| int * | ok, | ||
| char ** | next | ||
| ) |
As tor_parse_long(), but return a double.
Definition at line 97 of file parse_int.c.
| long tor_parse_long | ( | const char * | s, |
| int | base, | ||
| long | min, | ||
| long | max, | ||
| int * | ok, | ||
| char ** | next | ||
| ) |
Extract a long from the start of s, in the given numeric base. If base is 0, s is parsed as a decimal, octal, or hex number in the syntax of a C integer literal. If there is unconverted data and next is provided, set *next to the first unconverted character. An error has occurred if no characters are converted; or if there are unconverted characters and next is NULL; or if the parsed value is not between min and max. When no error occurs, return the parsed value and set *ok (if provided) to
Definition at line 59 of file parse_int.c.
Referenced by cmp_int_strings_(), dirvote_get_intermediate_param_value(), extract_param_buggy(), handle_control_protocolinfo(), parse_port_range(), and parse_process_specifier().
| uint64_t tor_parse_uint64 | ( | const char * | s, |
| int | base, | ||
| uint64_t | min, | ||
| uint64_t | max, | ||
| int * | ok, | ||
| char ** | next | ||
| ) |
As tor_parse_long, but return a uint64_t. Only base 10 is guaranteed to work for now.
Definition at line 110 of file parse_int.c.
Referenced by get_stream().
| unsigned long tor_parse_ulong | ( | const char * | s, |
| int | base, | ||
| unsigned long | min, | ||
| unsigned long | max, | ||
| int * | ok, | ||
| char ** | next | ||
| ) |
As tor_parse_long(), but return an unsigned long.
Definition at line 78 of file parse_int.c.
Referenced by get_circ().