FreeRDP
StaticStrings

Functions

TRIO_PRIVATE_STRING char *internal_duplicate_max TRIO_ARGS2 ((source, size), TRIO_CONST char *source, size_t size)
 
TRIO_PRIVATE_STRING trio_string_t * internal_string_alloc (TRIO_NOARGS)
 
TRIO_PRIVATE_STRING BOOLEAN_T internal_string_grow TRIO_ARGS2 ((self, delta), trio_string_t *self, size_t delta)
 
TRIO_PRIVATE_STRING BOOLEAN_T internal_string_grow_to TRIO_ARGS2 ((self, length), trio_string_t *self, size_t length)
 
TRIO_PRIVATE_STRING TRIO_INLINE int internal_to_upper TRIO_ARGS1 ((source), int source)
 
TRIO_PUBLIC_STRING char *trio_create TRIO_ARGS1 ((size), size_t size)
 
TRIO_PUBLIC_STRING void trio_destroy TRIO_ARGS1 ((string), char *string)
 
TRIO_PUBLIC_STRING size_t trio_length TRIO_ARGS1 ((string), TRIO_CONST char *string)
 
TRIO_PUBLIC_STRING size_t trio_length_max TRIO_ARGS2 ((string, max), TRIO_CONST char *string, size_t max)
 
TRIO_PUBLIC_STRING int trio_append TRIO_ARGS2 ((target, source), char *target, TRIO_CONST char *source)
 
TRIO_PUBLIC_STRING int trio_append_max TRIO_ARGS3 ((target, max, source), char *target, size_t max, TRIO_CONST char *source)
 
TRIO_PUBLIC_STRING int trio_contains TRIO_ARGS2 ((string, substring), TRIO_CONST char *string, TRIO_CONST char *substring)
 
TRIO_PUBLIC_STRING char *trio_duplicate TRIO_ARGS1 ((source), TRIO_CONST char *source)
 
TRIO_PUBLIC_STRING char *trio_duplicate_max TRIO_ARGS2 ((source, max), TRIO_CONST char *source, size_t max)
 
TRIO_PUBLIC_STRING int trio_equal TRIO_ARGS2 ((first, second), TRIO_CONST char *first, TRIO_CONST char *second)
 
TRIO_PUBLIC_STRING int trio_equal_case_max TRIO_ARGS3 ((first, max, second), TRIO_CONST char *first, size_t max, TRIO_CONST char *second)
 
TRIO_PUBLIC_STRING TRIO_CONST char *trio_error TRIO_ARGS1 ((error_number), int error_number)
 
TRIO_PUBLIC_STRING size_t trio_format_date_max TRIO_ARGS4 ((target, max, format, datetime), char *target, size_t max, TRIO_CONST char *format, TRIO_CONST struct tm *datetime)
 
TRIO_PUBLIC_STRING unsigned long trio_hash TRIO_ARGS2 ((string, type), TRIO_CONST char *string, int type)
 
TRIO_PUBLIC_STRING char *trio_index TRIO_ARGS2 ((string, character), TRIO_CONST char *string, int character)
 
TRIO_PUBLIC_STRING int trio_lower TRIO_ARGS1 ((target), char *target)
 
TRIO_PUBLIC_STRING int trio_match TRIO_ARGS2 ((string, pattern), TRIO_CONST char *string, TRIO_CONST char *pattern)
 
TRIO_PUBLIC_STRING size_t trio_span_function TRIO_ARGS3 ((target, source, Function), char *target, TRIO_CONST char *source, int(*Function) TRIO_PROTO((int)))
 
TRIO_PUBLIC_STRING char *trio_substring_max TRIO_ARGS3 ((string, max, substring), TRIO_CONST char *string, size_t max, TRIO_CONST char *substring)
 
TRIO_PUBLIC_STRING char *trio_tokenize TRIO_ARGS2 ((string, delimiters), char *string, TRIO_CONST char *delimiters)
 
TRIO_PUBLIC_STRING trio_long_double_t trio_to_long_double TRIO_ARGS2 ((source, endp), TRIO_CONST char *source, char **endp)
 
TRIO_PUBLIC_STRING long trio_to_long TRIO_ARGS3 ((string, endp, base), TRIO_CONST char *string, char **endp, int base)
 

Detailed Description

Function Documentation

◆ internal_string_alloc()

TRIO_PRIVATE_STRING trio_string_t* internal_string_alloc ( TRIO_NOARGS  )
Here is the caller graph for this function:

◆ TRIO_ARGS1() [1/7]

TRIO_PUBLIC_STRING TRIO_CONST char* trio_error TRIO_ARGS1 ( (error_number)  ,
int  error_number 
)

Provide a textual description of an error code (errno).

Parameters
error_numberError number.
Returns
Textual description of error_number.

◆ TRIO_ARGS1() [2/7]

TRIO_PUBLIC_STRING char* trio_create TRIO_ARGS1 ( (size)  ,
size_t  size 
)

Create new string.

Parameters
sizeSize of new string.
Returns
Pointer to string, or NULL if allocation failed.

◆ TRIO_ARGS1() [3/7]

TRIO_PUBLIC_STRING int trio_to_upper TRIO_ARGS1 ( (source)  ,
int  source 
)

Convert one alphabetic letter to lower-case.

Parameters
sourceThe letter to be converted.
Returns
The converted letter.

Convert one alphabetic letter to upper-case.

Parameters
sourceThe letter to be converted.
Returns
The converted letter.

◆ TRIO_ARGS1() [4/7]

TRIO_PUBLIC_STRING char* trio_duplicate TRIO_ARGS1 ( (source)  ,
TRIO_CONST char *  source 
)

Duplicate source.

Parameters
sourceSource string.
Returns
A copy of the source string.
Postcondition
target will be zero terminated.

◆ TRIO_ARGS1() [5/7]

TRIO_PUBLIC_STRING void trio_destroy TRIO_ARGS1 ( (string)  ,
char *  string 
)

Destroy string.

Parameters
stringString to be freed.

◆ TRIO_ARGS1() [6/7]

TRIO_PUBLIC_STRING size_t trio_length TRIO_ARGS1 ( (string)  ,
TRIO_CONST char *  string 
)

Count the number of characters in a string.

Parameters
stringString to measure.
Returns
Number of characters in string.

◆ TRIO_ARGS1() [7/7]

TRIO_PUBLIC_STRING int trio_upper TRIO_ARGS1 ( (target)  ,
char *  target 
)

Convert the alphabetic letters in the string to lower-case.

Parameters
targetString to be converted.
Returns
Number of processed characters (converted or not).

Convert the alphabetic letters in the string to upper-case.

Parameters
targetThe string to be converted.
Returns
The number of processed characters (converted or not).

◆ TRIO_ARGS2() [1/13]

TRIO_PUBLIC_STRING int trio_equal_locale TRIO_ARGS2 ( (first, second)  ,
TRIO_CONST char *  first,
TRIO_CONST char *  second 
)

Compare if two strings are equal.

Parameters
firstFirst string.
secondSecond string.
Returns
Boolean indicating whether the two strings are equal or not.

Case-insensitive comparison.

Compare if two strings are equal.

Parameters
firstFirst string.
secondSecond string.
Returns
Boolean indicating whether the two strings are equal or not.

Case-sensitive comparison.

Compare if two strings are equal.

Parameters
firstFirst string.
secondSecond string.
Returns
Boolean indicating whether the two strings are equal or not.

Collating characters are considered equal.

◆ TRIO_ARGS2() [2/13]

TRIO_PRIVATE_STRING BOOLEAN_T internal_string_grow TRIO_ARGS2 ( (self, delta)  ,
trio_string_t *  self,
size_t  delta 
)

◆ TRIO_ARGS2() [3/13]

TRIO_PRIVATE_STRING BOOLEAN_T internal_string_grow_to TRIO_ARGS2 ( (self, length)  ,
trio_string_t *  self,
size_t  length 
)

◆ TRIO_ARGS2() [4/13]

TRIO_PUBLIC_STRING float trio_to_float TRIO_ARGS2 ( (source, endp)  ,
TRIO_CONST char *  source,
char **  endp 
)

Convert string to floating-point number.

Parameters
sourceString to be converted.
endpPointer to end of the converted string.
Returns
A floating-point number.

The following Extended Backus-Naur form is used

double        ::= [ <sign> ]
                  ( <number> |
                    <number> <decimal_point> <number> |
                    <decimal_point> <number> )
                  [ <exponential> [ <sign> ] <number> ]
number        ::= 1*( <digit> )
digit         ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
exponential   ::= ( 'e' | 'E' )
sign          ::= ( '-' | '+' )
decimal_point ::= '.'

Convert string to floating-point number.

Parameters
sourceString to be converted.
endpPointer to end of the converted string.
Returns
A floating-point number.

See trio_to_long_double.

Here is the call graph for this function:

◆ TRIO_ARGS2() [5/13]

TRIO_PUBLIC_STRING char* trio_duplicate_max TRIO_ARGS2 ( (source, max)  ,
TRIO_CONST char *  source,
size_t  max 
)

Duplicate at most max characters of source.

Parameters
sourceSource string.
maxMaximum number of characters to duplicate.
Returns
A copy of the source string.
Postcondition
target will be zero terminated.

◆ TRIO_ARGS2() [6/13]

TRIO_PRIVATE_STRING char* internal_duplicate_max TRIO_ARGS2 ( (source, size)  ,
TRIO_CONST char *  source,
size_t  size 
)

◆ TRIO_ARGS2() [7/13]

TRIO_PUBLIC_STRING char *trio_index_last TRIO_ARGS2 ( (string, character)  ,
TRIO_CONST char *  string,
int  character 
)

Find first occurrence of a character in a string.

Parameters
stringString to be searched.
characterCharacter to be found.
Returns
A pointer to the found character, or NULL if character was not found.

Find last occurrence of a character in a string.

Parameters
stringString to be searched.
characterCharacter to be found.
Returns
A pointer to the found character, or NULL if character was not found.

◆ TRIO_ARGS2() [8/13]

TRIO_PUBLIC_STRING char* trio_tokenize TRIO_ARGS2 ( (string, delimiters)  ,
char *  string,
TRIO_CONST char *  delimiters 
)

Tokenize string.

Parameters
stringString to be tokenized.
delimitersString containing list of delimiting characters.
Returns
Start of new token.
Warning
string will be destroyed.

◆ TRIO_ARGS2() [9/13]

TRIO_PUBLIC_STRING size_t trio_length_max TRIO_ARGS2 ( (string, max)  ,
TRIO_CONST char *  string,
size_t  max 
)

Count at most max characters in a string.

Parameters
stringString to measure.
maxMaximum number of characters to count.
Returns
The maximum value of max and number of characters in string.

◆ TRIO_ARGS2() [10/13]

TRIO_PUBLIC_STRING int trio_match_case TRIO_ARGS2 ( (string, pattern)  ,
TRIO_CONST char *  string,
TRIO_CONST char *  pattern 
)

Compare two strings using wildcards.

Parameters
stringString to be searched.
patternPattern, including wildcards, to search for.
Returns
Boolean value indicating success or failure.

Case-insensitive comparison.

The following wildcards can be used

  • * Match any number of characters.
  • ? Match a single character.

Compare two strings using wildcards.

Parameters
stringString to be searched.
patternPattern, including wildcards, to search for.
Returns
Boolean value indicating success or failure.

Case-sensitive comparison.

The following wildcards can be used

  • * Match any number of characters.
  • ? Match a single character.

◆ TRIO_ARGS2() [11/13]

TRIO_PUBLIC_STRING char *trio_substring TRIO_ARGS2 ( (string, substring)  ,
TRIO_CONST char *  string,
TRIO_CONST char *  substring 
)

Determine if a string contains a substring.

Parameters
stringString to be searched.
substringString to be found.
Returns
Boolean value indicating success or failure.

Search for a substring in a string.

Parameters
stringString to be searched.
substringString to be found.
Returns
Pointer to first occurrence of substring in string, or NULL if no match was found.

◆ TRIO_ARGS2() [12/13]

TRIO_PUBLIC_STRING unsigned long trio_hash TRIO_ARGS2 ( (string, type)  ,
TRIO_CONST char *  string,
int  type 
)

Calculate a hash value for a string.

Parameters
stringString to be calculated on.
typeHash function.
Returns
Calculated hash value.

type can be one of the following

  • TRIO_HASH_PLAIN Plain hash function.
Here is the call graph for this function:

◆ TRIO_ARGS2() [13/13]

TRIO_PUBLIC_STRING int trio_copy TRIO_ARGS2 ( (target, source)  ,
char *  target,
TRIO_CONST char *  source 
)

Append source at the end of target.

Parameters
targetTarget string.
sourceSource string.
Returns
Boolean value indicating success or failure.
Precondition
target must point to a memory chunk with sufficient room to contain the target string and source string.
No boundary checking is performed, so insufficient memory will result in a buffer overrun.
Postcondition
target will be zero terminated.

Copy source to target.

Parameters
targetTarget string.
sourceSource string.
Returns
Boolean value indicating success or failure.
Precondition
target must point to a memory chunk with sufficient room to contain the source string.
No boundary checking is performed, so insufficient memory will result in a buffer overrun.
Postcondition
target will be zero terminated.

◆ TRIO_ARGS3() [1/5]

TRIO_PUBLIC_STRING int trio_equal_max TRIO_ARGS3 ( (first, max, second)  ,
TRIO_CONST char *  first,
size_t  max,
TRIO_CONST char *  second 
)

Compare if two strings up until the first max characters are equal.

Parameters
firstFirst string.
maxMaximum number of characters to compare.
secondSecond string.
Returns
Boolean indicating whether the two strings are equal or not.

Case-sensitive comparison.

Compare if two strings up until the first max characters are equal.

Parameters
firstFirst string.
maxMaximum number of characters to compare.
secondSecond string.
Returns
Boolean indicating whether the two strings are equal or not.

Case-insensitive comparison.

◆ TRIO_ARGS3() [2/5]

TRIO_PUBLIC_STRING unsigned long trio_to_unsigned_long TRIO_ARGS3 ( (string, endp, base)  ,
TRIO_CONST char *  string,
char **  endp,
int  base 
)

Convert string to signed integer.

Parameters
stringString to be converted.
endpPointer to end of converted string.
baseRadix number of number.

Convert string to unsigned integer.

Parameters
stringString to be converted.
endpPointer to end of converted string.
baseRadix number of number.

◆ TRIO_ARGS3() [3/5]

TRIO_PUBLIC_STRING char* trio_substring_max TRIO_ARGS3 ( (string, max, substring)  ,
TRIO_CONST char *  string,
size_t  max,
TRIO_CONST char *  substring 
)

Search for a substring in the first max characters of a string.

Parameters
stringString to be searched.
maxMaximum characters to be searched.
substringString to be found.
Returns
Pointer to first occurrence of substring in string, or NULL if no match was found.

◆ TRIO_ARGS3() [4/5]

TRIO_PUBLIC_STRING int trio_copy_max TRIO_ARGS3 ( (target, max, source)  ,
char *  target,
size_t  max,
TRIO_CONST char *  source 
)

Append at most max characters from source to target.

Parameters
targetTarget string.
maxMaximum number of characters to append.
sourceSource string.
Returns
Boolean value indicating success or failure.
Precondition
target must point to a memory chuck with sufficient room to contain the target string and the source string (at most max characters).
No boundary checking is performed, so insufficient memory will result in a buffer overrun.
Postcondition
target will be zero terminated.

Copy at most max - 1 characters from source to target.

Parameters
targetTarget string.
maxMaximum number of characters to append (one of which is a NUL terminator). In other words source must point to at least max - 1 bytes, but target must point to at least max bytes.
sourceSource string.
Returns
Boolean value indicating success or failure.
Precondition
target must point to a memory chunk with sufficient room to contain the source string and a NUL terminator (at most max bytes total).
No boundary checking is performed, so insufficient memory will result in a buffer overrun.
Postcondition
target will be zero terminated.

◆ TRIO_ARGS3() [5/5]

TRIO_PUBLIC_STRING size_t trio_span_function TRIO_ARGS3 ( (target, source, Function)  ,
char *  target,
TRIO_CONST char *  source,
int *Function   TRIO_PROTO(int) 
)

Execute a function on each character in string.

Parameters
targetTarget string.
sourceSource string.
FunctionFunction to be executed.
Returns
Number of processed characters.

◆ TRIO_ARGS4()

TRIO_PUBLIC_STRING size_t trio_format_date_max TRIO_ARGS4 ( (target, max, format, datetime)  ,
char *  target,
size_t  max,
TRIO_CONST char *  format,
TRIO_CONST struct tm *  datetime 
)

Format the date/time according to format.

Parameters
targetTarget string.
maxMaximum number of characters to format.
formatFormatting string.
datetimeDate/time structure.
Returns
Number of formatted characters.

The formatting string accepts the same specifiers as the standard C function strftime.