String utility module implementation file. More...
#include "mcl/mcl_common.h"
Go to the source code of this file.
Functions | |
mcl_size_t | string_util_strlen (const char *buffer) |
Standard library strlen wrapper. More... | |
mcl_size_t | string_util_strnlen (const char *buffer, mcl_size_t maximum_length) |
Standard library strnlen wrapper. More... | |
void | string_util_strncpy (char *destination, const char *source, mcl_size_t count) |
Standard library strncpy wrapper. Also sets the terminating null char at the end if source is not longer than count . More... | |
void | string_util_strncat (char *destination, const char *source, mcl_size_t count) |
Standard library strncat wrapper. More... | |
E_MCL_ERROR_CODE | string_util_strncmp (const char *string_1, const char *string_2, mcl_size_t count) |
Standard library strncmp wrapper. More... | |
E_MCL_ERROR_CODE | string_util_snprintf (char *string, mcl_size_t length, const char *format,...) |
Standard library snprintf wrapper. More... | |
mcl_bool_t | string_util_memcmp (const void *block_1, const void *block_2, mcl_size_t count) |
Standard library memcmp wrapper. More... | |
void | string_util_memcpy (void *destination, const void *source, mcl_size_t count) |
Standard library memcpy wrapper. More... | |
char * | string_util_strdup (const char *string) |
Standard library strdup wrapper. More... | |
mcl_bool_t | string_util_find (const char *source, const char *target, mcl_size_t *start_index) |
Finds the first occurence of target in source and puts it's first index to start_index . More... | |
mcl_bool_t | string_util_find_case_insensitive (const char *source, const char *target, mcl_size_t *start_index) |
Finds the first occurence of target in source and puts it's first index to start_index . More... | |
mcl_bool_t | string_util_is_space (char character) |
Checks if a character is whitespace. More... | |
long | string_util_strtol (const char *source, int base, char **end_pointer) |
Returns the first occurrence of an integral value in source string. More... | |
String utility module implementation file.
Definition in file string_util.h.
mcl_bool_t string_util_find | ( | const char * | source, |
const char * | target, | ||
mcl_size_t * | start_index | ||
) |
Finds the first occurence of target
in source
and puts it's first index to start_index
.
[in] | source | Null terminated string to be searched in. |
[in] | target | Null terminated string to be searched for. |
[out] | start_index | Index of the first character of target if source contains it. |
target
is found then MCL_TRUE, otherwise MCL_FALSE. Definition at line 156 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_FALSE, MCL_TRUE, and string_util_strlen().
Referenced by _is_valid_version(), _process_registration_response_rsa_3072(), and string_replace().
mcl_bool_t string_util_find_case_insensitive | ( | const char * | source, |
const char * | target, | ||
mcl_size_t * | start_index | ||
) |
Finds the first occurence of target
in source
and puts it's first index to start_index
.
[in] | source | Null terminated string to be searched in. |
[in] | target | Null terminated string to be searched for. |
[out] | start_index | Index of the first character of target if source contains it. |
target
is found then MCL_TRUE, otherwise MCL_FALSE. Definition at line 189 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, LOWERCASE, MCL_FALSE, MCL_TRUE, and string_util_strlen().
Referenced by http_response_get_header().
mcl_bool_t string_util_is_space | ( | char | character | ) |
Checks if a character is whitespace.
[in] | character | Character to be checked. |
character
is whitespace returns MCL_TRUE. Otherwise, MCL_FALSE. Definition at line 222 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
mcl_bool_t string_util_memcmp | ( | const void * | block_1, |
const void * | block_2, | ||
mcl_size_t | count | ||
) |
Standard library memcmp wrapper.
[in] | block_1 | Fist memory block to compare. |
[in] | block_2 | Second memory block to compare. |
[in] | count | Size of first memory block. |
Definition at line 121 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_FALSE, and MCL_TRUE.
void string_util_memcpy | ( | void * | destination, |
const void * | source, | ||
mcl_size_t | count | ||
) |
Standard library memcpy wrapper.
[in] | destination | Destination memory block. |
[in] | source | Source memory block. |
[in] | count | Count of bytes to be copied. Destination should have space for at least count bytes. |
Definition at line 131 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _add_blank_line(), _add_meta(), _get_payload_from_buffer(), _request_payload_callback_for_put(), _response_payload_callback(), hmac_sha256(), http_processor_get_access_token(), http_processor_register(), and http_request_finalize().
E_MCL_ERROR_CODE string_util_snprintf | ( | char * | string, |
mcl_size_t | length, | ||
const char * | format, | ||
... | |||
) |
Standard library snprintf wrapper.
[out] | string | String to be set. Must be a zero terminated C string. |
[in] | length | Specifies how many chars should be processed. |
[in] | format | Format string followed by format parameters. |
Definition at line 95 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_ERROR_RETURN, MCL_FAIL, and MCL_OK.
Referenced by _add_boundary(), _add_content_info(), _concatenate_host_and_endpoint(), _generate_correlation_id_string(), _process_registration_response_rsa_3072(), http_client_initialize(), http_processor_register(), http_request_add_header(), mcl_communication_get_last_access_token(), mcl_communication_get_last_token_time(), mcl_communication_initialize(), random_generate_guid(), string_concatenate(), and string_concatenate_cstr().
char* string_util_strdup | ( | const char * | string | ) |
Standard library strdup wrapper.
[in] | string | String to duplicate. |
string
. Definition at line 140 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by http_client_initialize(), and storage_load_rsa_registration_information().
mcl_size_t string_util_strlen | ( | const char * | buffer | ) |
Standard library strlen wrapper.
[in] | buffer | Buffer which length to be calculated. Must be a zero terminated C string. |
Definition at line 24 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _get_private_key(), _get_public_key(), _initialize(), _is_valid_version(), http_processor_update_security_information(), mcl_communication_initialize(), security_rsa_get_modulus_and_exponent(), security_rsa_sign(), storage_load_rsa_registration_information(), storage_load_shared_secret_registration_information(), string_compare_with_cstr(), string_concatenate_cstr(), string_replace(), string_util_find(), string_util_find_case_insensitive(), and time_util_validate_timestamp().
void string_util_strncat | ( | char * | destination, |
const char * | source, | ||
mcl_size_t | count | ||
) |
Standard library strncat wrapper.
[out] | destination | Destination string. Must be a zero terminated C string. |
[in] | source | Source string. Must be a zero terminated C string. |
[in] | count | Specifies how many chars from source will be added at the end of destination . |
Definition at line 61 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by string_array_to_string(), and string_replace().
E_MCL_ERROR_CODE string_util_strncmp | ( | const char * | string_1, |
const char * | string_2, | ||
mcl_size_t | count | ||
) |
Standard library strncmp wrapper.
[in] | string_1 | Fist string to be compared. Must be a zero terminated C string. |
[in] | string_2 | Second string to be compared. Must be a zero terminated C string. |
[in] | count | Specifies how many chars should be compared. |
Definition at line 74 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_FAIL, and MCL_OK.
Referenced by _get_private_key(), _get_public_key(), http_processor_update_security_information(), and string_compare_with_cstr().
void string_util_strncpy | ( | char * | destination, |
const char * | source, | ||
mcl_size_t | count | ||
) |
Standard library strncpy wrapper. Also sets the terminating null char at the end if source
is not longer than count
.
[out] | destination | Destination string. Must be a zero terminated C string. |
[in] | source | Source string. Must be a zero terminated C string. |
[in] | count | Specifies how many chars from source will be copied into the destination . |
Definition at line 48 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _initialize(), and _process_registration_response_rsa_3072().
mcl_size_t string_util_strnlen | ( | const char * | buffer, |
mcl_size_t | maximum_length | ||
) |
Standard library strnlen wrapper.
[in] | buffer | Buffer which length to be calculated. Must be a zero terminated C string. |
[in] | maximum_length | The maximum length to return. If string is not zero terminated this guarantees not accessing unwanted memory. |
Definition at line 34 of file string_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and MCL_NULL_CHAR.
Referenced by mcl_communication_initialize().
long string_util_strtol | ( | const char * | source, |
int | base, | ||
char ** | end_pointer | ||
) |
Returns the first occurrence of an integral value in source
string.
[in] | source | String that contains the integral value as string. |
[in] | base | The base that the number will be interpreted. |
[out] | end_pointer | The pointer that points to the one past the last index of integral value. |
Definition at line 232 of file string_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _process_registration_response_rsa_3072(), and time_util_validate_timestamp().