GNU libmicrohttpd 1.0.2
Loading...
Searching...
No Matches
mhd_str.c File Reference

Functions implementations for string manipulating. More...

#include "mhd_str.h"
#include <string.h>
#include "mhd_assert.h"
#include "mhd_limits.h"
Include dependency graph for mhd_str.c:

Go to the source code of this file.

Macros

#define isasciilower(c)
 
#define isasciiupper(c)
 
#define isasciialpha(c)
 
#define isasciidigit(c)
 
#define isasciixdigit(c)
 
#define isasciialnum(c)
 
#define toasciilower(c)
 
#define toasciiupper(c)
 
#define todigitvalue(c)
 
#define toxdigitvalue(c)
 
#define charsequalcaseless(c1, c2)
 

Functions

int MHD_str_equal_caseless_ (const char *str1, const char *str2)
 
int MHD_str_equal_caseless_n_ (const char *const str1, const char *const str2, size_t maxlen)
 
bool MHD_str_equal_caseless_bin_n_ (const char *const str1, const char *const str2, size_t len)
 
bool MHD_str_has_token_caseless_ (const char *str, const char *const token, size_t token_len)
 
bool MHD_str_remove_token_caseless_ (const char *str, size_t str_len, const char *const token, const size_t token_len, char *buf, ssize_t *buf_size)
 
bool MHD_str_remove_tokens_caseless_ (char *str, size_t *str_len, const char *const tokens, const size_t tokens_len)
 
size_t MHD_str_to_uint64_ (const char *str, uint64_t *out_val)
 
size_t MHD_str_to_uint64_n_ (const char *str, size_t maxlen, uint64_t *out_val)
 
size_t MHD_strx_to_uint32_ (const char *str, uint32_t *out_val)
 
size_t MHD_strx_to_uint32_n_ (const char *str, size_t maxlen, uint32_t *out_val)
 
size_t MHD_strx_to_uint64_ (const char *str, uint64_t *out_val)
 
size_t MHD_strx_to_uint64_n_ (const char *str, size_t maxlen, uint64_t *out_val)
 
size_t MHD_uint32_to_strx (uint32_t val, char *buf, size_t buf_size)
 
size_t MHD_uint16_to_str (uint16_t val, char *buf, size_t buf_size)
 
size_t MHD_uint64_to_str (uint64_t val, char *buf, size_t buf_size)
 
size_t MHD_uint8_to_str_pad (uint8_t val, uint8_t min_digits, char *buf, size_t buf_size)
 
size_t MHD_bin_to_hex (const void *bin, size_t size, char *hex)
 
size_t MHD_bin_to_hex_z (const void *bin, size_t size, char *hex)
 
size_t MHD_hex_to_bin (const char *hex, size_t len, void *bin)
 
size_t MHD_str_pct_decode_strict_n_ (const char *pct_encoded, size_t pct_encoded_len, char *decoded, size_t buf_size)
 
size_t MHD_str_pct_decode_lenient_n_ (const char *pct_encoded, size_t pct_encoded_len, char *decoded, size_t buf_size, bool *broken_encoding)
 
size_t MHD_str_pct_decode_in_place_strict_ (char *str)
 
size_t MHD_str_pct_decode_in_place_lenient_ (char *str, bool *broken_encoding)
 

Detailed Description

Functions implementations for string manipulating.

Author
Karlson2k (Evgeny Grin)

Definition in file mhd_str.c.

Macro Definition Documentation

◆ charsequalcaseless

#define charsequalcaseless ( c1,
c2 )
Value:
( ((c1) == (c2)) || \
(isasciiupper (c1) ? \
(((c1) - 'A' + 'a') == (c2)) : \
(((c1) == ((c2) - 'A' + 'a')) && isasciiupper (c2))) )
#define isasciiupper(c)
Definition mhd_str.c:565

Caseless compare two characters.

Parameters
c1the first char to compare
c2the second char to compare
Returns
boolean 'true' if chars are caseless equal, false otherwise

Definition at line 665 of file mhd_str.c.

Referenced by MHD_str_equal_caseless_(), MHD_str_equal_caseless_bin_n_(), MHD_str_equal_caseless_n_(), MHD_str_has_token_caseless_(), and MHD_str_remove_token_caseless_().

◆ isasciialnum

#define isasciialnum ( c)
Value:
#define isasciidigit(c)
Definition mhd_str.c:585
#define isasciialpha(c)
Definition mhd_str.c:575

Check whether character is decimal digit or letter in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is decimal digit or letter, boolean false otherwise

Definition at line 607 of file mhd_str.c.

◆ isasciialpha

#define isasciialpha ( c)
Value:
#define isasciilower(c)
Definition mhd_str.c:555

Checks whether character is letter in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is letter, boolean false otherwise

Definition at line 575 of file mhd_str.c.

◆ isasciidigit

#define isasciidigit ( c)
Value:
(((char) (c)) >= '0' && ((char) (c)) <= '9')

Check whether character is decimal digit in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is decimal digit, boolean false otherwise

Definition at line 585 of file mhd_str.c.

Referenced by MHD_str_to_uint64_(), and MHD_str_to_uint64_n_().

◆ isasciilower

#define isasciilower ( c)
Value:
(((char) (c)) >= 'a' && ((char) (c)) <= 'z')

Checks whether character is lower case letter in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is lower case letter, boolean false otherwise

Definition at line 555 of file mhd_str.c.

◆ isasciiupper

#define isasciiupper ( c)
Value:
(((char) (c)) >= 'A' && ((char) (c)) <= 'Z')

Checks whether character is upper case letter in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is upper case letter, boolean false otherwise

Definition at line 565 of file mhd_str.c.

◆ isasciixdigit

#define isasciixdigit ( c)
Value:
(isasciidigit ((c)) || \
(((char) (c)) >= 'A' && ((char) (c)) <= 'F') || \
(((char) (c)) >= 'a' && ((char) (c)) <= 'f') )

Check whether character is hexadecimal digit in US-ASCII

Parameters
ccharacter to check
Returns
boolean true if character is hexadecimal digit, boolean false otherwise

Definition at line 595 of file mhd_str.c.

◆ toasciilower

#define toasciilower ( c)
Value:
((isasciiupper (c)) ? (((char) (c)) - 'A' + 'a') : \
((char) (c)))

Convert US-ASCII character to lower case. If character is upper case letter in US-ASCII than it's converted to lower case analog. If character is NOT upper case letter than it's returned unmodified.

Parameters
ccharacter to convert
Returns
converted to lower case character

Definition at line 619 of file mhd_str.c.

◆ toasciiupper

#define toasciiupper ( c)
Value:
((isasciilower (c)) ? (((char) (c)) - 'a' + 'A') : \
((char) (c)))

Convert US-ASCII character to upper case. If character is lower case letter in US-ASCII than it's converted to upper case analog. If character is NOT lower case letter than it's returned unmodified.

Parameters
ccharacter to convert
Returns
converted to upper case character

Definition at line 632 of file mhd_str.c.

◆ todigitvalue

#define todigitvalue ( c)
Value:
(isasciidigit (c) ? (int) (((char) (c)) - '0') : \
(int) (-1))

Convert US-ASCII decimal digit to its value.

Parameters
ccharacter to convert
Returns
value of hexadecimal digit or -1 if @ c is not hexadecimal digit

Definition at line 642 of file mhd_str.c.

◆ toxdigitvalue

#define toxdigitvalue ( c)
Value:
(isasciidigit (c) ? (int) (((char) (c)) - '0') : \
( (((char) (c)) >= 'A' && ((char) (c)) <= 'F') ? \
(int) (((unsigned char) (c)) - 'A' + 10) : \
( (((char) (c)) >= 'a' && ((char) (c)) <= 'f') ? \
(int) (((unsigned char) (c)) - 'a' + 10) : \
(int) (-1) )))

Convert US-ASCII hexadecimal digit to its value.

Parameters
ccharacter to convert
Returns
value of hexadecimal digit or -1 if @ c is not hexadecimal digit

Definition at line 651 of file mhd_str.c.

Referenced by MHD_hex_to_bin(), MHD_str_pct_decode_in_place_lenient_(), MHD_str_pct_decode_in_place_strict_(), MHD_str_pct_decode_lenient_n_(), MHD_str_pct_decode_strict_n_(), MHD_strx_to_uint32_(), MHD_strx_to_uint32_n_(), MHD_strx_to_uint64_(), and MHD_strx_to_uint64_n_().

Function Documentation

◆ MHD_bin_to_hex()

size_t MHD_bin_to_hex ( const void * bin,
size_t size,
char * hex )

Convert size bytes from input binary data to lower case hexadecimal digits. Result is NOT zero-terminated

Parameters
binthe pointer to the binary data to convert
sizethe size in bytes of the binary data to convert
[out]hexthe output buffer, should be at least 2 * size
Returns
The number of characters written to the output buffer.

Definition at line 1676 of file mhd_str.c.

Referenced by calculate_nonce(), digest_auth_check_all_inner(), and MHD_bin_to_hex_z().

Here is the caller graph for this function:

◆ MHD_bin_to_hex_z()

size_t MHD_bin_to_hex_z ( const void * bin,
size_t size,
char * hex )

Convert size bytes from input binary data to lower case hexadecimal digits, zero-terminate the result.

Parameters
binthe pointer to the binary data to convert
sizethe size in bytes of the binary data to convert
[out]hexthe output buffer, should be at least 2 * size + 1
Returns
The number of characters written to the output buffer, not including terminating zero.

Definition at line 1696 of file mhd_str.c.

References MHD_bin_to_hex().

Referenced by MHD_digest_auth_calc_userhash_hex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_hex_to_bin()

size_t MHD_hex_to_bin ( const char * hex,
size_t len,
void * bin )

Convert hexadecimal digits to binary data.

The input decoded byte-by-byte (each byte is two hexadecimal digits). If length is an odd number, extra leading zero is assumed.

Parameters
hexthe input string with hexadecimal digits
lenthe length of the input string
[out]binthe output buffer, must be at least len/2 bytes long (or len/2 + 1 if len is not even number)
Returns
the number of bytes written to the output buffer, zero if found any character which is not hexadecimal digits

Definition at line 1710 of file mhd_str.c.

References mhd_assert, and toxdigitvalue.

Referenced by digest_auth_check_all_inner(), and get_rq_uname().

Here is the caller graph for this function:

◆ MHD_str_equal_caseless_()

int MHD_str_equal_caseless_ ( const char * str1,
const char * str2 )

Check two strings for equality, ignoring case of US-ASCII letters.

Parameters
str1first string to compare
str2second string to compare
Returns
non-zero if two strings are equal, zero otherwise.

Definition at line 683 of file mhd_str.c.

References charsequalcaseless.

Referenced by MHD_add_response_header(), MHD_queue_response(), need_100_continue(), and parse_connection_headers().

Here is the caller graph for this function:

◆ MHD_str_equal_caseless_bin_n_()

bool MHD_str_equal_caseless_bin_n_ ( const char *const str1,
const char *const str2,
size_t len )

Check two string for equality, ignoring case of US-ASCII letters and checking not more than len bytes. Compares not more first than len bytes, including binary zero characters. Comparison stops at first unmatched byte.

Parameters
str1first string to compare
str2second string to compare
lennumber of characters to compare
Returns
non-zero if len bytes are equal, zero otherwise.

Definition at line 749 of file mhd_str.c.

References charsequalcaseless.

Referenced by add_user_headers(), find_auth_rq_header_(), get_no_space_err_status_code(), get_rq_extended_uname_copy_z(), MHD_check_response_header_token_ci(), MHD_del_response_header(), MHD_get_response_element_n_(), MHD_get_response_header(), MHD_lookup_connection_value_n(), MHD_lookup_header_token_ci(), and MHD_str_remove_tokens_caseless_().

Here is the caller graph for this function:

◆ MHD_str_equal_caseless_n_()

int MHD_str_equal_caseless_n_ ( const char *const str1,
const char *const str2,
size_t maxlen )

Check two string for equality, ignoring case of US-ASCII letters and checking not more than maxlen characters. Compares up to first terminating null character, but not more than first maxlen characters.

Parameters
str1first string to compare
str2second string to compare
maxlenmaximum number of characters to compare
Returns
non-zero if two strings are equal, zero otherwise.

Definition at line 717 of file mhd_str.c.

References charsequalcaseless.

Referenced by add_user_headers(), MHD_create_post_processor(), MHD_post_process(), post_process_multipart(), process_multipart_headers(), and try_match_header().

Here is the caller graph for this function:

◆ MHD_str_has_token_caseless_()

bool MHD_str_has_token_caseless_ ( const char * str,
const char *const token,
size_t token_len )

Check whether str has case-insensitive token. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs.

Warning
token must not contain null-characters except optional terminating null-character.
Parameters
strthe string to check
tokenthe token to find
token_lenlength of token, not including optional terminating null-character.
Returns
non-zero if two strings are equal, zero otherwise.

Definition at line 782 of file mhd_str.c.

References charsequalcaseless.

Referenced by MHD_check_response_header_token_ci(), and MHD_lookup_header_token_ci().

Here is the caller graph for this function:

◆ MHD_str_pct_decode_in_place_lenient_()

size_t MHD_str_pct_decode_in_place_lenient_ ( char * str,
bool * broken_encoding )

Decode string in-place with percent-encoded characters as defined by RFC 3986 #section-2.1.

This function decode string by converting percent-encoded characters to their decoded versions and copying back all other characters without extra processing.

Any invalid percent-encoding sequences ('' symbol not followed by two valid hexadecimal digits) are copied to the output string without decoding.

Parameters
[in,out]strthe string to be updated in-place, must be zero-terminated on input, the output is zero-terminated
[out]broken_encodingwill be set to true if any '' symbol is not followed by two valid hexadecimal digits, optional, can be NULL
Returns
the number of character in decoded string

Definition at line 1995 of file mhd_str.c.

References MHD_str_pct_decode_lenient_n_(), NULL, and toxdigitvalue.

Referenced by MHD_http_unescape(), MHD_str_pct_decode_in_place_strict_(), and unescape_wrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_str_pct_decode_in_place_strict_()

size_t MHD_str_pct_decode_in_place_strict_ ( char * str)

Decode string in-place with percent-encoded characters as defined by RFC 3986 #section-2.1.

This function decode string by converting percent-encoded characters to their decoded versions and copying back all other characters without extra processing.

Parameters
[in,out]strthe string to be updated in-place, must be zero-terminated on input, the output is zero-terminated; the string is truncated to zero length if broken encoding is found
Returns
the number of character in decoded string

Definition at line 1939 of file mhd_str.c.

References MHD_str_pct_decode_in_place_lenient_(), and toxdigitvalue.

Referenced by unescape_wrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_str_pct_decode_lenient_n_()

size_t MHD_str_pct_decode_lenient_n_ ( const char * pct_encoded,
size_t pct_encoded_len,
char * decoded,
size_t buf_size,
bool * broken_encoding )

Decode string with percent-encoded characters as defined by RFC 3986 #section-2.1.

This function decode string by converting percent-encoded characters to their decoded versions and copying all other characters without extra processing.

Any invalid percent-encoding sequences ('' symbol not followed by two valid hexadecimal digits) are copied to the output string without decoding.

Parameters
pct_encodedthe input string to be decoded
pct_encoded_lenthe length of the pct_encoded
[out]decodedthe output buffer, NOT zero-terminated, can point to the same buffer as pct_encoded
buf_sizethe size of the output buffer
[out]broken_encodingwill be set to true if any '' symbol is not followed by two valid hexadecimal digits, optional, can be NULL
Returns
the number of characters written to the output buffer or zero if output buffer is too small to hold the result

Definition at line 1836 of file mhd_str.c.

References NULL, and toxdigitvalue.

Referenced by MHD_str_pct_decode_in_place_lenient_(), and MHD_str_pct_decode_strict_n_().

Here is the caller graph for this function:

◆ MHD_str_pct_decode_strict_n_()

size_t MHD_str_pct_decode_strict_n_ ( const char * pct_encoded,
size_t pct_encoded_len,
char * decoded,
size_t buf_size )

Decode string with percent-encoded characters as defined by RFC 3986 #section-2.1.

This function decode string by converting percent-encoded characters to their decoded versions and copying all other characters without extra processing.

Parameters
pct_encodedthe input string to be decoded
pct_encoded_lenthe length of the pct_encoded
[out]decodedthe output buffer, NOT zero-terminated, can point to the same buffer as pct_encoded
buf_sizethe size of the output buffer
Returns
the number of characters written to the output buffer or zero if any percent-encoded characters is broken ('' followed by less than two hexadecimal digits) or output buffer is too small to hold the result

Definition at line 1749 of file mhd_str.c.

References MHD_str_pct_decode_lenient_n_(), and toxdigitvalue.

Referenced by get_rq_extended_uname_copy_z().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_str_remove_token_caseless_()

bool MHD_str_remove_token_caseless_ ( const char * str,
size_t str_len,
const char *const token,
const size_t token_len,
char * buf,
ssize_t * buf_size )

Remove case-insensitive token from the str and put result to the output buf.

Tokens in str could be surrounded by spaces and tabs and delimited by comma. The token match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs. The quoted strings and comments are not supported by this function.

The output string is normalised: empty tokens and repeated whitespaces are removed, no whitespaces before commas, exactly one space is used after each comma.

Parameters
strthe string to process
str_lenthe length of the str, not including optional terminating null-character.
tokenthe token to find
token_lenthe length of token, not including optional terminating null-character.
[out]bufthe output buffer, not null-terminated.
[in,out]buf_sizepointer to the size variable, at input it is the size of allocated buffer, at output it is the size of the resulting string (can be up to 50% larger than input) or negative value if there is not enough space for the result
Returns
'true' if token has been removed, 'false' otherwise.

< the "input" string / character

< the "output" string / character

< position of matched character in the token

< the first char of current token

Definition at line 857 of file mhd_str.c.

References charsequalcaseless, mhd_assert, NULL, and SSIZE_MAX.

Referenced by add_response_header_connection().

Here is the caller graph for this function:

◆ MHD_str_remove_tokens_caseless_()

bool MHD_str_remove_tokens_caseless_ ( char * str,
size_t * str_len,
const char *const tokens,
const size_t tokens_len )

Perform in-place case-insensitive removal of tokens from the str.

Token could be surrounded by spaces and tabs and delimited by comma. The token match succeed if substring between start, end (of the string), or comma contains only case-insensitive token and optional spaces and tabs. The quoted strings and comments are not supported by this function.

The input string must be normalised: empty tokens and repeated whitespaces are removed, no whitespaces before commas, exactly one space is used after each comma. The string is updated in-place.

Behavior is undefined is the input string in not normalised.

Parameters
[in,out]strthe string to update
[in,out]str_lenthe length of the str, not including optional terminating null-character, not null-terminated
tokensthe token to find
tokens_lenthe length of tokens, not including optional terminating null-character.
Returns
'true' if any token has been removed, 'false' otherwise.

< a short alias for tokens

< position in tokens

< the current token

< the 'read' position in the str

< the 'write' position in the str

Definition at line 1033 of file mhd_str.c.

References mhd_assert, MHD_str_equal_caseless_bin_n_(), and NULL.

Referenced by add_response_header_connection(), and del_response_header_connection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_str_to_uint64_()

size_t MHD_str_to_uint64_ ( const char * str,
uint64_t * out_val )

Convert decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.

Parameters
strstring to convert
[out]out_valpointer to uint64_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL

Definition at line 1196 of file mhd_str.c.

References isasciidigit, and UINT64_MAX.

◆ MHD_str_to_uint64_n_()

size_t MHD_str_to_uint64_n_ ( const char * str,
size_t maxlen,
uint64_t * out_val )

Convert not more then maxlen decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.

Parameters
strstring to convert
maxlenmaximum number of characters to process
[out]out_valpointer to uint64_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL

Definition at line 1238 of file mhd_str.c.

References isasciidigit, and UINT64_MAX.

Referenced by parse_connection_headers().

Here is the caller graph for this function:

◆ MHD_strx_to_uint32_()

size_t MHD_strx_to_uint32_ ( const char * str,
uint32_t * out_val )

Convert hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character.

Parameters
strstring to convert
[out]out_valpointer to uint32_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint32_t or out_val is NULL

Definition at line 1281 of file mhd_str.c.

References toxdigitvalue, and UINT32_MAX.

◆ MHD_strx_to_uint32_n_()

size_t MHD_strx_to_uint32_n_ ( const char * str,
size_t maxlen,
uint32_t * out_val )

Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character or after maxlen digits.

Parameters
strstring to convert
maxlenmaximum number of characters to process
[out]out_valpointer to uint32_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint32_t or out_val is NULL

Definition at line 1328 of file mhd_str.c.

References toxdigitvalue, and UINT32_MAX.

◆ MHD_strx_to_uint64_()

size_t MHD_strx_to_uint64_ ( const char * str,
uint64_t * out_val )

Convert hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.

Parameters
strstring to convert
[out]out_valpointer to uint64_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL

Definition at line 1369 of file mhd_str.c.

References toxdigitvalue, and UINT64_MAX.

◆ MHD_strx_to_uint64_n_()

size_t MHD_strx_to_uint64_n_ ( const char * str,
size_t maxlen,
uint64_t * out_val )

Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.

Parameters
strstring to convert
maxlenmaximum number of characters to process
[out]out_valpointer to uint64_t to store result of conversion
Returns
non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL

Definition at line 1415 of file mhd_str.c.

References toxdigitvalue, and UINT64_MAX.

Referenced by digest_auth_check_all_inner(), get_nonce_timestamp(), get_rq_nc(), and process_request_body().

Here is the caller graph for this function:

◆ MHD_uint16_to_str()

size_t MHD_uint16_to_str ( uint16_t val,
char * buf,
size_t buf_size )

Convert uint16_t value to decimal US-ASCII string.

Note
: result is NOT zero-terminated.
Parameters
valthe value to convert
bufthe buffer to result to
buf_sizesize of the buffer
Returns
number of characters has been put to the buf, zero if buffer is too small (buffer may be modified).

< pointer to the current printed digit

Definition at line 1550 of file mhd_str.c.

References mhd_assert.

Referenced by build_header_response(), and get_date_str().

Here is the caller graph for this function:

◆ MHD_uint32_to_strx()

size_t MHD_uint32_to_strx ( uint32_t val,
char * buf,
size_t buf_size )

Convert uint32_t value to hexdecimal US-ASCII string.

Note
: result is NOT zero-terminated.
Parameters
valthe value to convert
bufthe buffer to result to
buf_sizesize of the buffer
Returns
number of characters has been put to the buf, zero if buffer is too small (buffer may be modified).

< position of the output character

zero-based, digit position in 'val'

Definition at line 1516 of file mhd_str.c.

Referenced by try_ready_chunked_body().

Here is the caller graph for this function:

◆ MHD_uint64_to_str()

size_t MHD_uint64_to_str ( uint64_t val,
char * buf,
size_t buf_size )

Convert uint64_t value to decimal US-ASCII string.

Note
: result is NOT zero-terminated.
Parameters
valthe value to convert
bufthe buffer to result to
buf_sizesize of the buffer
Returns
number of characters has been put to the buf, zero if buffer is too small (buffer may be modified).

< pointer to the current printed digit

Definition at line 1591 of file mhd_str.c.

References mhd_assert.

Referenced by build_header_response().

Here is the caller graph for this function:

◆ MHD_uint8_to_str_pad()

size_t MHD_uint8_to_str_pad ( uint8_t val,
uint8_t min_digits,
char * buf,
size_t buf_size )

Convert uint16_t value to decimal US-ASCII string padded with zeros on the left side.

Note
: result is NOT zero-terminated.
Parameters
valthe value to convert
min_digitsthe minimal number of digits to print, output padded with zeros on the left side, 'zero' value is interpreted as 'one', valid values are 3, 2, 1, 0
bufthe buffer to result to
buf_sizesize of the buffer
Returns
number of characters has been put to the buf, zero if buffer is too small (buffer may be modified).

< the position of the current printed digit

Definition at line 1629 of file mhd_str.c.

References mhd_assert.

Referenced by get_date_str().

Here is the caller graph for this function: