safec
3.2
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_str_lib.h"
Functions | |
int | iswfc (uint32_t wc) |
int | _towfc_single (wchar_t *restrict dest, const uint32_t src) |
int | towfc_s (wchar_t *restrict dest, rsize_t dmax, const uint32_t src) |
towfc_s() converts a wide character to fully fold-cased (lowercased with possible expansions), according to the Unicode 10.0 CaseFolding table. More... | |
Variables | |
struct { | |
unsigned short upper | |
unsigned short lower1 | |
unsigned short lower2 | |
} | tbl2 [] |
iswfc() checks the uppercase character for a mapping to foldcase, returning the number of new wide character codepoints needed. More... | |
struct { | |
unsigned short upper | |
unsigned short lower1 | |
unsigned short lower2 | |
unsigned short lower3 | |
} | tbl3 [] |
int iswfc | ( | uint32_t | wc | ) |
int _towfc_single | ( | wchar_t *restrict | dest, |
const uint32_t | src | ||
) |
int towfc_s | ( | wchar_t *restrict | dest, |
rsize_t | dmax, | ||
const uint32_t | src | ||
) |
towfc_s()
converts a wide character to fully fold-cased (lowercased with possible expansions), according to the Unicode 10.0 CaseFolding table.
Even in most the unsuccessul cases, just not with with ESNULLP and ESZEROL dest is being written to.
As of Unicode 10.0 there are no possible results as surrogate pairs with sizeof(wchar_t)==2
, all results are below U+FFFF.
[out] | dest | wide string buffer to store result |
[in] | dmax | maximum size of dest, should be 4. (3 + NULL) |
[in] | src | wide character to convert to lowercase |
>=0 | on successful operation, returns the number of converted wide characters: 0-3 |
-ESNULLP | when dest is NULL pointer |
-ESZEROL | when dmax = 0 |
-ESLEMIN | when dmax < 4 |
-ESLEMAX | when dmax > RSIZE_MAX_WSTR |
-ESNOTFND | when no mapping for src was found, iswfc is wrong. |
unsigned short upper |
unsigned short lower1 |
unsigned short lower2 |
const { ... } tbl2[] |
iswfc()
checks the uppercase character for a mapping to foldcase, returning the number of new wide character codepoints needed.
The usual iswupper(wc)
case returns 1, and the special 104 full folding cases as specified in Unicode 10.0 CaseFolding.txt
return either 2 or 3.
[in] | wc | unicode character codepoint |
0 | when there is no corresponding lowercase mapping. |
1 | when there is a corresponding common or simple foldcase mapping. |
2 | a full case-folding expands to 2 characters |
3 | a full case-folding expands to 3 characters |
unsigned short lower3 |
const { ... } tbl3[] |