Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/util/charset/charset.h

    r590 r745  
    4040typedef uint16_t smb_ucs2_t;
    4141
     42#ifdef WORDS_BIGENDIAN
     43#define UCS2_SHIFT 8
     44#else
     45#define UCS2_SHIFT 0
     46#endif
     47
     48/* turn a 7 bit character into a ucs2 character */
     49#define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
     50
     51/* return an ascii version of a ucs2 character */
     52#define UCS2_TO_CHAR(c) (((c) >> UCS2_SHIFT) & 0xff)
     53
     54/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
     55#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
     56                                ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
     57
     58
     59
    4260/*
    4361 *   for each charset we have a function that pulls from that charset to
     
    103121
    104122char *strchr_m(const char *s, char c);
     123size_t strlen_m_ext(const char *s, charset_t src_charset, charset_t dst_charset);
     124size_t strlen_m_ext_term(const char *s, charset_t src_charset,
     125                         charset_t dst_charset);
    105126size_t strlen_m_term(const char *s);
    106127size_t strlen_m_term_null(const char *s);
     
    150171
    151172extern struct smb_iconv_convenience *global_iconv_convenience;
    152 
     173struct smb_iconv_convenience *get_iconv_convenience(void);
     174smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
     175                            charset_t from, charset_t to);
     176const char *charset_name(struct smb_iconv_convenience *ic, charset_t ch);
     177
     178codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
     179                               size_t *size);
    153180codepoint_t next_codepoint(const char *str, size_t *size);
    154181ssize_t push_codepoint(char *str, codepoint_t c);
    155182
    156183/* codepoints */
     184codepoint_t next_codepoint_convenience_ext(struct smb_iconv_convenience *ic,
     185                            const char *str, charset_t src_charset,
     186                            size_t *size);
    157187codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
    158188                            const char *str, size_t *size);
    159189ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
    160190                                char *str, codepoint_t c);
     191
    161192codepoint_t toupper_m(codepoint_t val);
    162193codepoint_t tolower_m(codepoint_t val);
     194bool islower_m(codepoint_t val);
     195bool isupper_m(codepoint_t val);
    163196int codepoint_cmpi(codepoint_t c1, codepoint_t c2);
    164197
    165198/* Iconv convenience functions */
    166 struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx,
    167                                                          const char *dos_charset,
    168                                                          const char *unix_charset,
    169                                                          bool native_iconv);
     199struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *mem_ctx,
     200                                                           const char *dos_charset,
     201                                                           const char *unix_charset,
     202                                                           const char *display_charset,
     203                                                           bool native_iconv,
     204                                                           struct smb_iconv_convenience *old_ic);
    170205
    171206bool convert_string_convenience(struct smb_iconv_convenience *ic,
     
    189224
    190225void load_case_tables(void);
    191 bool charset_register_backend(const void *_funcs);
     226void load_case_tables_library(void);
     227bool smb_register_charset(const struct charset_functions *funcs_in);
    192228
    193229/*
     
    264300NTSTATUS charset_ ## CHARSETNAME ## _init(void)                                                 \
    265301{                                                                                               \
    266         return smb_register_charset(& CHARSETNAME ## _functions);                               \
    267 }                                                                                               \
     302        if (!smb_register_charset(& CHARSETNAME ## _functions)) {       \
     303                return NT_STATUS_INTERNAL_ERROR;                        \
     304        }                                                               \
     305        return NT_STATUS_OK; \
     306}                                               \
    268307
    269308
Note: See TracChangeset for help on using the changeset viewer.