Android-cuttlefish cvd tool
Classes | Macros | Typedefs | Functions | Variables
nls_utf8.c File Reference
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <f2fs_fs.h>
#include "utf8data.h"
Include dependency graph for nls_utf8.c:

Classes

struct  utf8cursor
 
struct  utf8data
 

Macros

#define UNICODE_MAJ_SHIFT   (16)
 
#define UNICODE_MIN_SHIFT   (8)
 
#define UNICODE_AGE(MAJ, MIN, REV)
 
#define UTF8HANGULLEAF   (12)
 
#define __INCLUDED_FROM_UTF8NORM_C__
 
#define ARRAY_SIZE(array)    (sizeof(array) / sizeof(array[0]))
 
#define BITNUM   0x07
 
#define NEXTBYTE   0x08
 
#define OFFLEN   0x30
 
#define OFFLEN_SHIFT   4
 
#define RIGHTPATH   0x40
 
#define TRIENODE   0x80
 
#define RIGHTNODE   0x40
 
#define LEFTNODE   0x80
 
#define LEAF_GEN(LEAF)   ((LEAF)[0])
 
#define LEAF_CCC(LEAF)   ((LEAF)[1])
 
#define LEAF_STR(LEAF)   ((const char *)((LEAF) + 2))
 
#define MINCCC   (0)
 
#define MAXCCC   (254)
 
#define STOPPER   (0)
 
#define DECOMPOSE   (255)
 
#define HANGUL   ((char)(255))
 
#define UTF8HANGULLEAF   (12)
 
#define SB   (0xAC00)
 
#define LB   (0x1100)
 
#define VB   (0x1161)
 
#define TB   (0x11A7)
 
#define LC   (19)
 
#define VC   (21)
 
#define TC   (28)
 
#define NC   (VC * TC)
 
#define SC   (LC * NC)
 

Typedefs

typedef const unsigned char utf8trie_t
 
typedef const unsigned char utf8leaf_t
 

Functions

static int utf8clen (const char *s)
 
static unsigned int utf8decode3 (const char *str)
 
static int utf8encode3 (char *str, unsigned int val)
 
static utf8leaf_tutf8hangul (const char *str, unsigned char *hangul)
 
static utf8leaf_tutf8nlookup (const struct utf8data *data, unsigned char *hangul, const char *s, size_t len)
 
static utf8leaf_tutf8lookup (const struct utf8data *data, unsigned char *hangul, const char *s)
 
static int utf8ncursor (struct utf8cursor *u8c, const struct utf8data *data, const char *s, size_t len)
 
static int utf8byte (struct utf8cursor *u8c)
 
static const struct utf8datautf8nfdicf (unsigned int maxage)
 
static int utf8_casefold (const struct f2fs_nls_table *table, const unsigned char *str, size_t len, unsigned char *dest, size_t dlen)
 
const struct f2fs_nls_tablef2fs_load_nls_table (int encoding)
 

Variables

static const struct f2fs_nls_ops utf8_ops
 
static const struct f2fs_nls_table nls_utf8
 

Macro Definition Documentation

◆ __INCLUDED_FROM_UTF8NORM_C__

#define __INCLUDED_FROM_UTF8NORM_C__

◆ ARRAY_SIZE

#define ARRAY_SIZE (   array)     (sizeof(array) / sizeof(array[0]))

◆ BITNUM

#define BITNUM   0x07

◆ DECOMPOSE

#define DECOMPOSE   (255)

◆ HANGUL

#define HANGUL   ((char)(255))

◆ LB

#define LB   (0x1100)

◆ LC

#define LC   (19)

◆ LEAF_CCC

#define LEAF_CCC (   LEAF)    ((LEAF)[1])

◆ LEAF_GEN

#define LEAF_GEN (   LEAF)    ((LEAF)[0])

◆ LEAF_STR

#define LEAF_STR (   LEAF)    ((const char *)((LEAF) + 2))

◆ LEFTNODE

#define LEFTNODE   0x80

◆ MAXCCC

#define MAXCCC   (254)

◆ MINCCC

#define MINCCC   (0)

◆ NC

#define NC   (VC * TC)

◆ NEXTBYTE

#define NEXTBYTE   0x08

◆ OFFLEN

#define OFFLEN   0x30

◆ OFFLEN_SHIFT

#define OFFLEN_SHIFT   4

◆ RIGHTNODE

#define RIGHTNODE   0x40

◆ RIGHTPATH

#define RIGHTPATH   0x40

◆ SB

#define SB   (0xAC00)

◆ SC

#define SC   (LC * NC)

◆ STOPPER

#define STOPPER   (0)

◆ TB

#define TB   (0x11A7)

◆ TC

#define TC   (28)

◆ TRIENODE

#define TRIENODE   0x80

◆ UNICODE_AGE

#define UNICODE_AGE (   MAJ,
  MIN,
  REV 
)
Value:
(((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) | \
((unsigned int)(MIN) << UNICODE_MIN_SHIFT) | \
((unsigned int)(REV)))
#define UNICODE_MIN_SHIFT
Definition: nls_utf8.c:33
#define UNICODE_MAJ_SHIFT
Definition: nls_utf8.c:32
#define MIN(x, y)
Definition: sha512.c:223

◆ UNICODE_MAJ_SHIFT

#define UNICODE_MAJ_SHIFT   (16)

◆ UNICODE_MIN_SHIFT

#define UNICODE_MIN_SHIFT   (8)

◆ UTF8HANGULLEAF [1/2]

#define UTF8HANGULLEAF   (12)

◆ UTF8HANGULLEAF [2/2]

#define UTF8HANGULLEAF   (12)

◆ VB

#define VB   (0x1161)

◆ VC

#define VC   (21)

Typedef Documentation

◆ utf8leaf_t

typedef const unsigned char utf8leaf_t

◆ utf8trie_t

typedef const unsigned char utf8trie_t

Function Documentation

◆ f2fs_load_nls_table()

const struct f2fs_nls_table * f2fs_load_nls_table ( int  encoding)

◆ utf8_casefold()

static int utf8_casefold ( const struct f2fs_nls_table table,
const unsigned char *  str,
size_t  len,
unsigned char *  dest,
size_t  dlen 
)
static

◆ utf8byte()

static int utf8byte ( struct utf8cursor u8c)
static

◆ utf8clen()

static int utf8clen ( const char *  s)
inlinestatic

◆ utf8decode3()

static unsigned int utf8decode3 ( const char *  str)
static

◆ utf8encode3()

static int utf8encode3 ( char *  str,
unsigned int  val 
)
static

◆ utf8hangul()

static utf8leaf_t * utf8hangul ( const char *  str,
unsigned char *  hangul 
)
static

◆ utf8lookup()

static utf8leaf_t * utf8lookup ( const struct utf8data data,
unsigned char *  hangul,
const char *  s 
)
static

◆ utf8ncursor()

static int utf8ncursor ( struct utf8cursor u8c,
const struct utf8data data,
const char *  s,
size_t  len 
)
static

◆ utf8nfdicf()

static const struct utf8data * utf8nfdicf ( unsigned int  maxage)
static

◆ utf8nlookup()

static utf8leaf_t * utf8nlookup ( const struct utf8data data,
unsigned char *  hangul,
const char *  s,
size_t  len 
)
static

Variable Documentation

◆ nls_utf8

const struct f2fs_nls_table nls_utf8
static
Initial value:
= {
.ops = &utf8_ops,
.version = UNICODE_AGE(12, 1, 0),
}
#define UNICODE_AGE(MAJ, MIN, REV)
Definition: nls_utf8.c:35
static const struct f2fs_nls_ops utf8_ops
Definition: nls_utf8.c:920

◆ utf8_ops

const struct f2fs_nls_ops utf8_ops
static
Initial value:
= {
.casefold = utf8_casefold,
}
static int utf8_casefold(const struct f2fs_nls_table *table, const unsigned char *str, size_t len, unsigned char *dest, size_t dlen)
Definition: nls_utf8.c:889