#include <stdlib.h>
#include <string.h>
#include "stringprep.h"
Go to the source code of this file.
Defines | |
#define | INVERTED(x) ((x) & ((~0UL) >> 1)) |
#define | UNAPPLICAPLEFLAGS(flags, profileflags) |
Functions | |
int | stringprep_4i (uint32_t *ucs4, size_t *len, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile *profile) |
int | stringprep_4zi (uint32_t *ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile *profile) |
int | stringprep (char *in, size_t maxlen, Stringprep_profile_flags flags, const Stringprep_profile *profile) |
int | stringprep_profile (const char *in, char **out, const char *profile, Stringprep_profile_flags flags) |
#define INVERTED | ( | x | ) | ((x) & ((~0UL) >> 1)) |
Definition at line 101 of file stringprep.c.
#define UNAPPLICAPLEFLAGS | ( | flags, | |||
profileflags | ) |
Value:
((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \ ( INVERTED(profileflags) && (profileflags & flags)))
Definition at line 102 of file stringprep.c.
Referenced by stringprep_4i().
int stringprep | ( | char * | in, | |
size_t | maxlen, | |||
Stringprep_profile_flags | flags, | |||
const Stringprep_profile * | profile | |||
) |
stringprep - prepare internationalized string
in | input/ouput array with string to prepare. | |
maxlen | maximum length of input/output array. | |
flags | a Stringprep_profile_flags value, or 0. | |
profile | pointer to Stringprep_profile to use. |
Note that you must convert strings entered in the systems locale into UTF-8 before using this function, see stringprep_locale_to_utf8().
Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to characters outside that size.
The are one of Stringprep_profile_flags values, or 0.
The contain the Stringprep_profile instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.
Return value: Returns STRINGPREP_OK iff successful, or an error code.
Definition at line 359 of file stringprep.c.
References stringprep_4i(), STRINGPREP_MALLOC_ERROR, STRINGPREP_OK, STRINGPREP_TOO_SMALL_BUFFER, stringprep_ucs4_to_utf8(), stringprep_utf8_to_ucs4(), and uint32_t.
Referenced by stringprep_profile().
int stringprep_4i | ( | uint32_t * | ucs4, | |
size_t * | len, | |||
size_t | maxucs4len, | |||
Stringprep_profile_flags | flags, | |||
const Stringprep_profile * | profile | |||
) |
stringprep_4i - prepare internationalized string
ucs4 | input/output array with string to prepare. | |
len | on input, length of input array with Unicode code points, on exit, length of output array with Unicode code points. | |
maxucs4len | maximum length of input/output array. | |
flags | a Stringprep_profile_flags value, or 0. | |
profile | pointer to Stringprep_profile to use. |
The input is not required to be zero terminated ([] = 0). The output will not be zero terminated unless [] = 0. Instead, see stringprep_4zi() if your input is zero terminated or if you want the output to be.
Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to code points outside that size.
The are one of Stringprep_profile_flags values, or 0.
The contain the Stringprep_profile instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.
Return value: Returns STRINGPREP_OK iff successful, or an Stringprep_rc error code.
Definition at line 138 of file stringprep.c.
References Stringprep_table::operation, STRINGPREP_BIDI, STRINGPREP_BIDI_BOTH_L_AND_RAL, STRINGPREP_BIDI_CONTAINS_PROHIBITED, STRINGPREP_BIDI_L_TABLE, STRINGPREP_BIDI_LEADTRAIL_NOT_RAL, STRINGPREP_BIDI_PROHIBIT_TABLE, STRINGPREP_BIDI_RAL_TABLE, STRINGPREP_CONTAINS_PROHIBITED, STRINGPREP_CONTAINS_UNASSIGNED, STRINGPREP_FLAG_ERROR, STRINGPREP_MAP_TABLE, STRINGPREP_NFKC, STRINGPREP_NFKC_FAILED, STRINGPREP_NO_NFKC, STRINGPREP_NO_UNASSIGNED, STRINGPREP_OK, STRINGPREP_PROFILE_ERROR, STRINGPREP_PROHIBIT_TABLE, STRINGPREP_TOO_SMALL_BUFFER, stringprep_ucs4_nfkc_normalize(), STRINGPREP_UNASSIGNED_TABLE, uint32_t, and UNAPPLICAPLEFLAGS.
Referenced by stringprep().
int stringprep_4zi | ( | uint32_t * | ucs4, | |
size_t | maxucs4len, | |||
Stringprep_profile_flags | flags, | |||
const Stringprep_profile * | profile | |||
) |
stringprep_4zi - prepare internationalized string
ucs4 | input/output array with zero terminated string to prepare. | |
maxucs4len | maximum length of input/output array. | |
flags | a Stringprep_profile_flags value, or 0. | |
profile | pointer to Stringprep_profile to use. |
Since the stringprep operation can expand the string, indicate how large the buffer holding the string is. This function will not read or write to code points outside that size.
The are one of Stringprep_profile_flags values, or 0.
The contain the Stringprep_profile instructions to perform. Your application can define new profiles, possibly re-using the generic stringprep tables that always will be part of the library, or use one of the currently supported profiles.
Return value: Returns STRINGPREP_OK iff successful, or an Stringprep_rc error code.
Definition at line 319 of file stringprep.c.
int stringprep_profile | ( | const char * | in, | |
char ** | out, | |||
const char * | profile, | |||
Stringprep_profile_flags | flags | |||
) |
stringprep_profile - prepare internationalized string
in | input array with UTF-8 string to prepare. | |
out | output variable with pointer to newly allocate string. | |
profile | name of stringprep profile to use. | |
flags | a Stringprep_profile_flags value, or 0. |
Note that you must convert strings entered in the systems locale into UTF-8 before using this function, see stringprep_locale_to_utf8().
The output variable must be deallocated by the caller.
The are one of Stringprep_profile_flags values, or 0.
The specifies the name of the stringprep profile to use. It must be one of the internally supported stringprep profiles.
Return value: Returns STRINGPREP_OK iff successful, or an error code.
Definition at line 438 of file stringprep.c.
References Stringprep_profiles::name, stringprep(), STRINGPREP_MALLOC_ERROR, stringprep_profiles, STRINGPREP_UNKNOWN_PROFILE, and Stringprep_profiles::tables.