Samba wrapper/stub for iconv character set conversion. More...
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <atalk/byteorder.h>
#include <atalk/logger.h>
#include <atalk/unicode.h>
#include <atalk/util.h>
Macros | |
#define | CHARSET_WIDECHAR 32 |
#define | UCS2ICONV "UCS-2" |
#define | DLIST_ADD(list, p) |
Functions | |
static size_t | ascii_pull (void *, char **, size_t *, char **, size_t *) |
static size_t | ascii_push (void *, char **, size_t *, char **, size_t *) |
static size_t | iconv_copy (void *, char **, size_t *, char **, size_t *) |
struct charset_functions * | find_charset_functions (const char *name) |
int | atalk_register_charset (struct charset_functions *funcs) |
static void | lazy_initialize_iconv (void) |
static size_t | sys_iconv (void *cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
size_t | atalk_iconv (atalk_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
atalk_iconv_t | atalk_iconv_open (const char *tocode, const char *fromcode) |
int | atalk_iconv_close (atalk_iconv_t cd) |
static size_t | ascii_pull (void *cd _U_, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
static size_t | ascii_push (void *cd _U_, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
static size_t | iconv_copy (void *cd _U_, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
Variables | |
struct charset_functions | charset_mac_roman |
struct charset_functions | charset_mac_hebrew |
struct charset_functions | charset_mac_centraleurope |
struct charset_functions | charset_mac_cyrillic |
struct charset_functions | charset_mac_greek |
struct charset_functions | charset_mac_turkish |
struct charset_functions | charset_utf8 |
struct charset_functions | charset_utf8_mac |
static struct charset_functions | builtin_functions [] |
static struct charset_functions * | charsets = NULL |
Samba wrapper/stub for iconv character set conversion.
iconv is the XPG2 interface for converting between character encodings. This file provides a Samba wrapper around it, and also a simple reimplementation that is used if the system does not implement iconv.
Samba only works with encodings that are supersets of ASCII: ascii characters like whitespace can be tested for directly, multibyte sequences start with a byte with the high bit set, and strings are terminated by a nul byte.
Note that the only function provided by iconv is conversion between characters. It doesn't directly support operations like uppercasing or comparison. We have to convert to UCS-2 and compare there.
#define CHARSET_WIDECHAR 32 |
#define UCS2ICONV "UCS-2" |
|
static |
|
static |
|
static |
|
static |
size_t atalk_iconv | ( | atalk_iconv_t | cd, |
const char ** | inbuf, | ||
size_t * | inbytesleft, | ||
char ** | outbuf, | ||
size_t * | outbytesleft ) |
This is a simple portable iconv() implementaion.
It only knows about a very small number of character sets - just enough that netatalk works on systems that don't have iconv.
int atalk_iconv_close | ( | atalk_iconv_t | cd | ) |
atalk_iconv_t atalk_iconv_open | ( | const char * | tocode, |
const char * | fromcode ) |
int atalk_register_charset | ( | struct charset_functions * | funcs | ) |
struct charset_functions * find_charset_functions | ( | const char * | name | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
static |