Asterisk - The Open Source Telephony Project
18.5.0
|
Conversion utility functions. More...
#include <stdint.h>
Go to the source code of this file.
Functions | |
int | ast_str_to_imax (const char *str, intmax_t *res) |
Convert the given string to a signed max size integer. More... | |
int | ast_str_to_int (const char *str, int *res) |
Convert the given string to a signed integer. More... | |
int | ast_str_to_long (const char *str, long *res) |
Convert the given string to a signed long. More... | |
int | ast_str_to_uint (const char *str, unsigned int *res) |
Convert the given string to an unsigned integer. More... | |
int | ast_str_to_ulong (const char *str, unsigned long *res) |
Convert the given string to an unsigned long. More... | |
int | ast_str_to_umax (const char *str, uintmax_t *res) |
Convert the given string to an unsigned max size integer. More... | |
Conversion utility functions.
Definition in file conversions.h.
int ast_str_to_imax | ( | const char * | str, |
intmax_t * | res | ||
) |
Convert the given string to a signed max size integer.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert contains non numeric values Once converted the number is out of range (less than INTMAX_MIN or greater than INTMAX_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 92 of file conversions.c.
Referenced by ast_str_to_int(), ast_str_to_long(), and AST_TEST_DEFINE().
int ast_str_to_int | ( | const char * | str, |
int * | res | ||
) |
Convert the given string to a signed integer.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert contains non numeric values Once converted the number is out of range (less than INT_MIN or greater than INT_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 44 of file conversions.c.
References ast_str_to_imax().
Referenced by AST_TEST_DEFINE(), category_set_sublevels(), detect_write(), dtmfstore_exec(), freq_parser(), read_sf_exec(), set_id_from_oli(), and wait_exec().
int ast_str_to_long | ( | const char * | str, |
long * | res | ||
) |
Convert the given string to a signed long.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert contains non numeric values Once converted the number is out of range (less than LONG_MIN or greater than LONG_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 68 of file conversions.c.
References ast_str_to_imax().
Referenced by AST_TEST_DEFINE().
int ast_str_to_uint | ( | const char * | str, |
unsigned int * | res | ||
) |
Convert the given string to an unsigned integer.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert is negative (starts with a '-') The given string to convert contains non numeric values Once converted the number is out of range (greater than UINT_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 56 of file conversions.c.
References ast_str_to_umax().
Referenced by AST_TEST_DEFINE(), func_get_parkingslot_channel(), handle_cli_rtp_drop_incoming_packets(), set_public_key_expiration(), stir_shaken_read(), and stream_echo_exec().
int ast_str_to_ulong | ( | const char * | str, |
unsigned long * | res | ||
) |
Convert the given string to an unsigned long.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert is negative (starts with a '-') The given string to convert contains non numeric values Once converted the number is out of range (greater than ULONG_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 80 of file conversions.c.
References ast_str_to_umax().
Referenced by AST_TEST_DEFINE(), and public_key_is_expired().
int ast_str_to_umax | ( | const char * | str, |
uintmax_t * | res | ||
) |
Convert the given string to an unsigned max size integer.
This function will return failure for the following reasons:
The given string to convert is NULL The given string to convert is empty. The given string to convert is negative (starts with a '-') The given string to convert contains non numeric values Once converted the number is out of range (greater than UINTMAX_MAX)
str | The string to convert |
res | [out] The converted value |
Definition at line 119 of file conversions.c.
References end, errno, and str_is_negative().
Referenced by ast_str_to_uint(), ast_str_to_ulong(), AST_TEST_DEFINE(), create_foo_type_message(), mailbox_to_num(), and validate_data().