$darkmode
netatalk  4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
buniutil.c File Reference
#include "bstrlib.h"
#include "buniutil.h"

Macros

#define UNICODE__CODE_POINT__REPLACEMENT_CHARACTER   (0xFFFDL)
 
#define endSwap(cs, mode)    ((mode) ? ((((cs) & 0xFF) << 8) | (((cs) >> 8) & 0xFF)) : (cs))
 
#define TEMP_UCS4_BUFFER_SIZE   (64)
 

Functions

int buIsUTF8Content (const bstring bu)
 
int buGetBlkUTF16 (cpUcs2 *ucs2, int len, cpUcs4 errCh, const bstring bu, int pos)
 
int buAppendBlkUcs4 (bstring b, const cpUcs4 *bu, int len, cpUcs4 errCh)
 
int buAppendBlkUTF16 (bstring bu, const cpUcs2 *utf16, int len, cpUcs2 *bom, cpUcs4 errCh)
 

Macro Definition Documentation

◆ endSwap

#define endSwap (   cs,
  mode 
)     ((mode) ? ((((cs) & 0xFF) << 8) | (((cs) >> 8) & 0xFF)) : (cs))

◆ TEMP_UCS4_BUFFER_SIZE

#define TEMP_UCS4_BUFFER_SIZE   (64)

◆ UNICODE__CODE_POINT__REPLACEMENT_CHARACTER

#define UNICODE__CODE_POINT__REPLACEMENT_CHARACTER   (0xFFFDL)

Function Documentation

◆ buAppendBlkUcs4()

int buAppendBlkUcs4 ( bstring  b,
const cpUcs4 *  bu,
int  len,
cpUcs4  errCh 
)

Convert an array of UCS-4 code points (bu, len elements) to UTF-8 and append the result to the bstring b.

Any invalid code point is replaced by errCh. If errCh is itself not a valid code point, translation halts on the first error and BSTR_ERR is returned. Otherwise BSTR_OK is returned.

◆ buAppendBlkUTF16()

int buAppendBlkUTF16 ( bstring  bu,
const cpUcs2 *  utf16,
int  len,
cpUcs2 *  bom,
cpUcs4  errCh 
)

Append an array of UTF-16 code units (utf16, len elements) to the UTF-8 bstring bu.

Any invalid code point is replaced by errCh. If errCh is itself not a valid code point, translation halts on the first error and BSTR_ERR is returned. Otherwise BSTR_OK is returned. If a byte order mark has been previously read it may be passed in via bom; if *bom is 0 it will be filled in from the first character if it is a BOM.

◆ buGetBlkUTF16()

int buGetBlkUTF16 ( cpUcs2 *  ucs2,
int  len,
cpUcs4  errCh,
const bstring  bu,
int  pos 
)

Convert the UTF-8 bstring bu (starting at code-point offset pos) to a sequence of UTF-16 encoded code units written to ucs2 (at most len units).

Returns the number of UCS-2 16-bit words written. Any unparsable code point is translated to errCh.

◆ buIsUTF8Content()

int buIsUTF8Content ( const bstring  bu)

Scan a bstring and return 1 if its entire content consists of valid UTF-8 encoded code points, otherwise return 0.