diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-06-27 17:58:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:35 -0500 |
commit | f0f1a5f4bf1c0c732a6c5a80c275656ac7d5617f (patch) | |
tree | 2d7d85e00b21e7ede1cc9cc0166d7f8de6c490e6 /source4/lib/charset | |
parent | 0646a91bc9e004340026f2dbe082e057416eb1e6 (diff) | |
download | samba-f0f1a5f4bf1c0c732a6c5a80c275656ac7d5617f.tar.gz samba-f0f1a5f4bf1c0c732a6c5a80c275656ac7d5617f.tar.bz2 samba-f0f1a5f4bf1c0c732a6c5a80c275656ac7d5617f.zip |
r16571: - make push/pull_ascii()/_ucs() functions static,
callers should use push/pull_string() functions with STR_ASCII or STR_UNICODE
- make the push/pull_ascii/ucs2/utf8_talloc() functions complete
(they should be reduced to pull/push_string_talloc() later...)
metze
(This used to be commit b0af976187d2d46b7dbe5a532a5491476b459119)
Diffstat (limited to 'source4/lib/charset')
-rw-r--r-- | source4/lib/charset/charcnv.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/source4/lib/charset/charcnv.c b/source4/lib/charset/charcnv.c index ca06b3b7d6..0df77f4eff 100644 --- a/source4/lib/charset/charcnv.c +++ b/source4/lib/charset/charcnv.c @@ -286,7 +286,7 @@ convert: * @param dest_len the maximum length in bytes allowed in the * destination. If @p dest_len is -1 then no maximum is used. **/ -_PUBLIC_ ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int flags) +static ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int flags) { size_t src_len; ssize_t ret; @@ -321,7 +321,6 @@ _PUBLIC_ ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int fl _PUBLIC_ ssize_t push_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { size_t src_len = strlen(src)+1; - *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void **)dest); } @@ -342,7 +341,7 @@ _PUBLIC_ ssize_t push_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src * @param src_len is the length of the source area in bytes. * @returns the number of bytes occupied by the string in @p src. **/ -_PUBLIC_ ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) +static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { size_t ret; @@ -381,7 +380,7 @@ _PUBLIC_ ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t * @param dest_len is the maximum length allowed in the * destination. If dest_len is -1 then no maxiumum is used. **/ -_PUBLIC_ ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int flags) +static ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int flags) { size_t len=0; size_t src_len = strlen(src); @@ -449,7 +448,6 @@ _PUBLIC_ ssize_t push_ucs2_talloc(TALLOC_CTX *ctx, void **dest, const char *src) _PUBLIC_ ssize_t push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) { size_t src_len = strlen(src)+1; - *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void **)dest); } @@ -465,7 +463,7 @@ _PUBLIC_ ssize_t push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src) The resulting string in "dest" is always null terminated. **/ -_PUBLIC_ size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) +static size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { size_t ret; @@ -495,6 +493,21 @@ _PUBLIC_ size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t s } /** + * Copy a string from a ASCII src to a unix char * destination, allocating a buffer using talloc + * + * @param dest always set at least to NULL + * + * @returns The number of bytes occupied by the string in the destination + **/ + +_PUBLIC_ ssize_t pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src) +{ + size_t src_len = strlen(src)+1; + *dest = NULL; + return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void **)dest); +} + +/** * Copy a string from a UCS2 src to a unix char * destination, allocating a buffer using talloc * * @param dest always set at least to NULL |