netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
util_unistr.c File Reference
`#include <arpa/inet.h>`
`#include <atalk/logger.h>`
`#include <errno.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/param.h>`
`#include <sys/stat.h>`
`#include <atalk/unicode.h>`
`#include <atalk/byteorder.h>`
`#include "precompose.h"`

## Functions
int | strlower_w (ucs2_t *s)
| Convert a string to lower case.
int | strupper_w (ucs2_t *s)
| Convert a string to upper case.
size_t | strlen_w (const ucs2_t *src)
| wide strlen()
size_t | strnlen_w (const ucs2_t *src, size_t max)
| wide strnlen()
ucs2_t * | strchr_w (const ucs2_t *s, ucs2_t c)
| wide strchr()
ucs2_t * | strcasechr_w (const ucs2_t *s, ucs2_t c)
| wide strcasechr()
ucs2_t * | strcasechr_sp (const ucs2_t *s, uint32_t c_sp)
| sp strcasechr()
int | strcmp_w (const ucs2_t *a, const ucs2_t *b)
| wide strcmp()
int | strncmp_w (const ucs2_t *a, const ucs2_t *b, size_t len)
| wide strncmp()
ucs2_t * | strstr_w (const ucs2_t *s, const ucs2_t *ins)
| wide strstr()
ucs2_t * | strcasestr_w (const ucs2_t *s, const ucs2_t *ins)
| wide strcasestr()
int | strcasecmp_w (const ucs2_t *a, const ucs2_t *b)
| wide strcasecmp()
int | strncasecmp_w (const ucs2_t *a, const ucs2_t *b, size_t len)
| wide strncasecmp()
ucs2_t * | strndup_w (const ucs2_t *src, size_t len)
| wide strndup()
ucs2_t * | strdup_w (const ucs2_t *src)
| wide strdup()
static ucs2_t | do_precomposition (unsigned int base, unsigned int comb)
static uint32_t | do_precomposition_sp (unsigned int base_sp, unsigned int comb_sp)
static uint32_t | do_decomposition (ucs2_t base)
static uint64_t | do_decomposition_sp (unsigned int base_sp)
size_t | precompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen)
| pre|decomposition
size_t | decompose_w (ucs2_t *name, size_t inplen, ucs2_t *comp, size_t *outlen)

## Function Documentation

## ◆ decompose_w()

size_t decompose_w | ( | ucs2_t * | name,
|  | size_t | inplen,
|  | ucs2_t * | comp,
|  | size_t * | outlen )

## ◆ do_decomposition()

uint32_t do_decomposition | ( | ucs2_t | base | ) |
| static

## ◆ do_decomposition_sp()

uint64_t do_decomposition_sp | ( | unsigned int | base_sp | ) |
| static

## ◆ do_precomposition()

ucs2_t do_precomposition | ( | unsigned int | base,
|  | unsigned int | comb )
| static

binary search for pre|decomposition

## ◆ do_precomposition_sp()

uint32_t do_precomposition_sp | ( | unsigned int | base_sp,
|  | unsigned int | comb_sp )
| static

## ◆ precompose_w()

size_t precompose_w | ( | ucs2_t * | name,
|  | size_t | inplen,
|  | ucs2_t * | comp,
|  | size_t * | outlen )

pre|decomposition

we can't use static, this stuff needs to be reentrant static char comp[MAXPATHLEN +1];

We don't implement Singleton and Canonical Ordering. We ignore CompositionExclusions.txt because they cause the problem of the roundtrip such as Dancing Icon.

exclude U2000-U2FFF, UFE30-UFE4F and U2F800-U2FA1F ranges in precompose.h from composition according to AFP 3.x spec

## ◆ strcasechr_sp()

ucs2_t * strcasechr_sp | ( | const ucs2_t * | s,
|  | uint32_t | c_sp )

sp strcasechr()

Note
  separately process BMP and surrogate pair

## ◆ strcasechr_w()

ucs2_t * strcasechr_w | ( | const ucs2_t * | s,
|  | ucs2_t | c )

wide strcasechr()

Note
  separately process BMP and surrogate pair

## ◆ strcasecmp_w()

int strcasecmp_w | ( | const ucs2_t * | a,
|  | const ucs2_t * | b )

wide strcasecmp()

case insensitive string comparison

Note
  surrogate pair support

## ◆ strcasestr_w()

ucs2_t * strcasestr_w | ( | const ucs2_t * | s,
|  | const ucs2_t * | ins )

wide strcasestr()

Note
  surrogate pair support

## ◆ strchr_w()

ucs2_t * strchr_w | ( | const ucs2_t * | s,
|  | ucs2_t | c )

wide strchr()

Note
  hi and lo of surrogate pair are separately processed.

## ◆ strcmp_w()

int strcmp_w | ( | const ucs2_t * | a,
|  | const ucs2_t * | b )

wide strcmp()

Note
  no problem of surrogate pair

## ◆ strdup_w()

ucs2_t * strdup_w | ( | const ucs2_t * | src | ) |

wide strdup()

duplicate string

Note
  no problem of surrogate pair

## ◆ strlen_w()

size_t strlen_w | ( | const ucs2_t * | src | ) |

wide strlen()

Count the number of characters in a UTF-16 string.

Note
  one surrogate pair is two characters.

## ◆ strlower_w()

int strlower_w | ( | ucs2_t * | s | ) |

Convert a string to lower case.

Returns
  True if any char is converted

Note
  surrogate pair support

## ◆ strncasecmp_w()

int strncasecmp_w | ( | const ucs2_t * | a,
|  | const ucs2_t * | b,
|  | size_t | len )

wide strncasecmp()

case insensitive string comparison, length limited

Note
  compare up to 'len+1' if 'len' isolate surrogate pair

## ◆ strncmp_w()

int strncmp_w | ( | const ucs2_t * | a,
|  | const ucs2_t * | b,
|  | size_t | len )

wide strncmp()

Note
  no problem of surrogate pair

## ◆ strndup_w()

ucs2_t * strndup_w | ( | const ucs2_t * | src,
|  | size_t | len )

wide strndup()

duplicate string

Note
  not check isolation of surrogate pair
  if len == 0 then duplicate the whole string

## ◆ strnlen_w()

size_t strnlen_w | ( | const ucs2_t * | src,
|  | size_t | max )

wide strnlen()

Count up to max number of characters in a UTF-16 string.

Note
  one surrogate pair is two characters.

## ◆ strstr_w()

ucs2_t * strstr_w | ( | const ucs2_t * | s,
|  | const ucs2_t * | ins )

wide strstr()

Note
  no problem of surrogate pair

## ◆ strupper_w()

int strupper_w | ( | ucs2_t * | s | ) |

Convert a string to upper case.

Returns
  True if any char is converted

Note
  surrogate pair support