#ifndef _ATALK_UNICODE_H
#define _ATALK_UNICODE_H 1
-#include <sys/cdefs.h>
-#include <netatalk/endian.h>
#include <errno.h>
+#include <stdint.h>
#include <sys/param.h>
-#define ucs2_t u_int16_t
+#define ucs2_t uint16_t
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
/* conversion flags */
#define CONV_IGNORE (1<<0) /* return the first convertable characters. */
-#define CONV_ESCAPEHEX (1<<1) /* escape unconvertable chars with :[UCS2HEX] */
+#define CONV_ESCAPEHEX (1<<1) /* escape unconvertable chars with :[UCS2HEX], */
+ /* also escape '/'. Escape ':' if also CONV_ALLOW_COLON, */
+ /* else ':' raises EILSEQ */
#define CONV_ESCAPEDOTS (1<<2) /* escape leading dots with :2600 */
#define CONV_UNESCAPEHEX (1<<3)
#define CONV_TOUPPER (1<<4) /* convert to UPPERcase */
#define CONV_DECOMPOSE (1<<7) /* precompose */
#define CONV_FORCE (1<<8) /* force convertion */
#define CONV__EILSEQ (1<<9) /* ignore EILSEQ, replace with IGNORE_CHAR (try USC2) */
+#define CONV_ALLOW_COLON (1<<10) /* Allow ':' in name. Needed for Extended Attributes */
/* conversion return flags */
#define CONV_REQMANGLE (1<<14) /* mangling of returned name is required */
/*
* for each charset we have a function that pulls from that charset to
* a ucs2 buffer, and a function that pushes to a ucs2 buffer
- * */
+ */
struct charset_functions {
const char *name;
char **outbuf, size_t *outbytesleft);
size_t (*push)(void *, char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft);
- u_int32_t flags;
+ uint32_t flags;
const char *iname;
struct charset_functions *prev, *next;
};
extern struct charset_functions *find_charset_functions (const char *);
extern int atalk_register_charset (struct charset_functions *);
+/* from utf16_case.c */
+extern ucs2_t toupper_w (ucs2_t);
+extern uint32_t toupper_sp (uint32_t);
+extern ucs2_t tolower_w (ucs2_t);
+extern uint32_t tolower_sp (uint32_t);
+
/* from util_unistr.c */
-extern ucs2_t toupper_w (ucs2_t);
-extern ucs2_t tolower_w (ucs2_t);
extern int strupper_w (ucs2_t *);
extern int strlower_w (ucs2_t *);
extern int islower_w (ucs2_t);
extern size_t utf8_to_charset_allocate (charset_t, char **dest, const char *src);
extern size_t ucs2_to_charset (charset_t, const ucs2_t *src, char *dest, size_t);
-extern size_t convert_charset (charset_t, charset_t, charset_t, const char *, size_t, char *, size_t, u_int16_t *);
+extern size_t convert_charset (charset_t, charset_t, charset_t, const char *, size_t, char *, size_t, uint16_t *);
extern size_t charset_precompose ( charset_t, char *, size_t, char *, size_t);
extern size_t charset_decompose ( charset_t, char *, size_t, char *, size_t);
extern size_t utf8_precompose ( char *, size_t, char *, size_t);
extern size_t utf8_decompose ( char *, size_t, char *, size_t);
-extern charset_t add_charset (char* name);
+extern charset_t add_charset (const char* name);
#endif /* _ATALK_UNICODE_H */