myMPD
Internal API documentation
Loading...
Searching...
No Matches
utf8_wrapper.c File Reference

UTF8 wrapper functions. More...

#include "src/lib/mem.h"
#include "src/lib/utf8_wrapper.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for utf8_wrapper.c:

Typedefs

typedef int utf8proc_option_t

Functions

static char * normalize (const char *str, size_t len, size_t *newlen, utf8proc_option_t flags)
bool utf8_wrap_validate (const char *str, size_t str_len)
char * utf8_wrap_casefold (const char *str, size_t len, size_t *newlen)
char * utf8_wrap_normalize (const char *str, size_t len, size_t *newlen)
int utf8_wrap_casecmp (const char *str1, size_t str1_len, const char *str2, size_t str2_len)

Variables

static utf8proc_option_t normalize_flags = 0
static utf8proc_option_t casefold_flags = 0

Detailed Description

UTF8 wrapper functions.

Function Documentation

◆ normalize()

char * normalize ( const char * str,
size_t len,
size_t * newlen,
utf8proc_option_t flags )
static

Normalizes a string

Parameters
strString to normalize
lenString length
newlenPointer to size_t for the new string length
flagsNormalization flags
Returns
Newly allocated char, caller must free it.

◆ utf8_wrap_casecmp()

int utf8_wrap_casecmp ( const char * str1,
size_t str1_len,
const char * str2,
size_t str2_len )

Compares two strings case insensitive. Set's errno to EINVAL if one string is invalid utf8.

Parameters
str1String1
str1_lenString1 length
str2String2
str2_lenString2 length
Returns
Same as strcasecmp

◆ utf8_wrap_casefold()

char * utf8_wrap_casefold ( const char * str,
size_t len,
size_t * newlen )

Casefolds a string

Parameters
strString to normalize
lenString length
newlenPointer to size_t for the new string length
Returns
Newly allocated char, caller must free it.

◆ utf8_wrap_validate()

bool utf8_wrap_validate ( const char * str,
size_t str_len )

Checks if string is valid utf8

Parameters
strString to validate
str_lenString length
Returns
true if string is valid, else false