netatalk: iconv.c File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
iconv.c File Reference

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 <iconv.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-2LE"
#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)
| This is a simple portable iconv() implementaion.
atalk_iconv_t | atalk_iconv_open (const char *tocode, const char *fromcode)
int | atalk_iconv_close (atalk_iconv_t cd)

## 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
struct charset_functions | charset_mac_japanese
struct charset_functions | charset_mac_chinese_trad
struct charset_functions | charset_mac_korean
struct charset_functions | charset_mac_chinese_simp
static struct charset_functions | builtin_functions []
static struct charset_functions * | charsets = NULL

## Detailed Description

wrapper/stub for iconv character set conversion.

iconv is an interface for converting between character encodings. This file, forked from samba, provides a wrapper around it, and also a simple reimplementation that is used if the system does not implement iconv.

Note
  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.

## Macro Definition Documentation

## ◆ CHARSET_WIDECHAR

#define CHARSET_WIDECHAR 32

## ◆ DLIST_ADD

#define DLIST_ADD | ( |  | list,
|  |  | p )

Value:
{ \
if (!(list)) { \
(list) = (p); \
(p)->next = (p)->prev = NULL; \
} else { \
(list)->prev = (p); \
(p)->next = (list); \
(p)->prev = NULL; \
(list) = (p); \
}\
}
p
size_t p
Definition dircache.c:256
next
#define next
Definition hash.c:36
list
Definition etc/atalkd/list.h:6
NULL
#define NULL
Definition utf8util.c:47

## ◆ UCS2ICONV

#define UCS2ICONV "UCS-2LE"

## Function Documentation

## ◆ ascii_pull()

size_t ascii_pull | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

## ◆ ascii_push()

size_t ascii_push | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

## ◆ atalk_iconv()

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.

## ◆ atalk_iconv_close()

int atalk_iconv_close | ( | atalk_iconv_t | cd | ) |

simple iconv_close() wrapper

## ◆ atalk_iconv_open()

atalk_iconv_t atalk_iconv_open | ( | const char * | tocode,
|  | const char * | fromcode )

simple iconv_open() wrapper

## ◆ atalk_register_charset()

int atalk_register_charset | ( | struct charset_functions * | funcs | ) |

## ◆ find_charset_functions()

struct charset_functions * find_charset_functions | ( | const char * | name | ) |

## ◆ iconv_copy()

size_t iconv_copy | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

## ◆ lazy_initialize_iconv()

void lazy_initialize_iconv | ( | void |  | ) |
| static

## ◆ sys_iconv()

size_t sys_iconv | ( | void * | cd,
|  | char ** | inbuf,
|  | size_t * | inbytesleft,
|  | char ** | outbuf,
|  | size_t * | outbytesleft )
| static

## Variable Documentation

## ◆ builtin_functions

struct charset_functions builtin_functions[]
| static

Initial value:
= {
{"UCS-2", 0, iconv_copy, iconv_copy, CHARSET_WIDECHAR | CHARSET_PRECOMPOSED, NULL, NULL, NULL},
{"ASCII", 0, ascii_pull, ascii_push, CHARSET_MULTIBYTE | CHARSET_PRECOMPOSED, NULL, NULL, NULL},
{NULL, 0, NULL, NULL, 0, NULL, NULL, NULL}
}
iconv_copy
static size_t iconv_copy(void *, char **, size_t *, char **, size_t *)
Definition iconv.c:449
ascii_pull
static size_t ascii_pull(void *, char **, size_t *, char **, size_t *)
Definition iconv.c:385
ascii_push
static size_t ascii_push(void *, char **, size_t *, char **, size_t *)
Definition iconv.c:413
CHARSET_PRECOMPOSED
#define CHARSET_PRECOMPOSED
Definition unicode.h:30
CHARSET_MULTIBYTE
#define CHARSET_MULTIBYTE
Definition unicode.h:32
CHARSET_WIDECHAR
#define CHARSET_WIDECHAR
Definition unicode.h:33

## ◆ charset_mac_centraleurope

struct charset_functions charset_mac_centraleurope
| extern

## ◆ charset_mac_chinese_simp

struct charset_functions charset_mac_chinese_simp
| extern

## ◆ charset_mac_chinese_trad

struct charset_functions charset_mac_chinese_trad
| extern

## ◆ charset_mac_cyrillic

struct charset_functions charset_mac_cyrillic
| extern

## ◆ charset_mac_greek

struct charset_functions charset_mac_greek
| extern

## ◆ charset_mac_hebrew

struct charset_functions charset_mac_hebrew
| extern

## ◆ charset_mac_japanese

struct charset_functions charset_mac_japanese
| extern

## ◆ charset_mac_korean

struct charset_functions charset_mac_korean
| extern

## ◆ charset_mac_roman

struct charset_functions charset_mac_roman
| extern

## ◆ charset_mac_turkish

struct charset_functions charset_mac_turkish
| extern

## ◆ charset_utf8

struct charset_functions charset_utf8
| extern

## ◆ charset_utf8_mac

struct charset_functions charset_utf8_mac
| extern

## ◆ charsets

struct charset_functions* charsets = NULL
| static