summaryrefslogtreecommitdiff
path: root/lib/util/charset
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-03 12:29:12 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-05-03 07:37:07 +0200
commit80f1d49b61560f326fb55f2df09cc4f30e7a85ea (patch)
tree5bc73a35dd8e5dc2169cfb11fbec8c7f632d1932 /lib/util/charset
parent7c083caf741d4f12cdf630026e02d9f07a64d0fb (diff)
downloadsamba-80f1d49b61560f326fb55f2df09cc4f30e7a85ea.tar.gz
samba-80f1d49b61560f326fb55f2df09cc4f30e7a85ea.tar.bz2
samba-80f1d49b61560f326fb55f2df09cc4f30e7a85ea.zip
lib/util/charset Use push_string and talloc_strupper/strlower from common code
The only caller of push_string() (not to be confused with push_string_check()) in the common code was encode_pw_buffer(), and it didn't use the alignment or STR_UPPER flags. The talloc_strupper() and talloc_strlower() functions are tested in smbtorture, and are next_codepoint() based. Andrew Bartlett
Diffstat (limited to 'lib/util/charset')
-rw-r--r--lib/util/charset/util_unistr.c10
-rw-r--r--lib/util/charset/wscript_build17
2 files changed, 10 insertions, 17 deletions
diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
index 1915c73ad5..e4ae65053c 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -194,7 +194,7 @@ _PUBLIC_ size_t count_chars_m(const char *s, char c)
* @param dest_len the maximum length in bytes allowed in the
* destination. If @p dest_len is -1 then no maximum is used.
**/
-static bool push_ascii(void *dest, const char *src, size_t dest_len, int flags, size_t *converted_size)
+static bool push_ascii_string(void *dest, const char *src, size_t dest_len, int flags, size_t *converted_size)
{
size_t src_len;
bool ret;
@@ -204,7 +204,7 @@ static bool push_ascii(void *dest, const char *src, size_t dest_len, int flags,
if (tmpbuf == NULL) {
return false;
}
- ret = push_ascii(dest, tmpbuf, dest_len, flags & ~STR_UPPER, converted_size);
+ ret = push_ascii_string(dest, tmpbuf, dest_len, flags & ~STR_UPPER, converted_size);
talloc_free(tmpbuf);
return ret;
}
@@ -232,7 +232,7 @@ static bool push_ascii(void *dest, const char *src, size_t dest_len, int flags,
* @param src_len is the length of the source area in bytes.
* @returns the number of bytes occupied by the string in @p src.
**/
-static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags)
+static ssize_t pull_ascii_string(char *dest, const void *src, size_t dest_len, size_t src_len, int flags)
{
size_t size = 0;
@@ -373,7 +373,7 @@ _PUBLIC_ ssize_t push_string(void *dest, const char *src, size_t dest_len, int f
{
if (flags & STR_ASCII) {
size_t size = 0;
- if (push_ascii(dest, src, dest_len, flags, &size)) {
+ if (push_ascii_string(dest, src, dest_len, flags, &size)) {
return (ssize_t)size;
} else {
return (ssize_t)-1;
@@ -404,7 +404,7 @@ _PUBLIC_ ssize_t push_string(void *dest, const char *src, size_t dest_len, int f
_PUBLIC_ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_t src_len, int flags)
{
if (flags & STR_ASCII) {
- return pull_ascii(dest, src, dest_len, src_len, flags);
+ return pull_ascii_string(dest, src, dest_len, src_len, flags);
} else if (flags & STR_UNICODE) {
return pull_ucs2(dest, src, dest_len, src_len, flags);
} else {
diff --git a/lib/util/charset/wscript_build b/lib/util/charset/wscript_build
index 771ff5dc24..7623131146 100644
--- a/lib/util/charset/wscript_build
+++ b/lib/util/charset/wscript_build
@@ -1,18 +1,11 @@
#!/usr/bin/env python
-
-if bld.env._SAMBA_BUILD_ == 4:
- bld.SAMBA_SUBSYSTEM('CHARSET',
- source='util_unistr.c',
- public_deps='CODEPOINTS',
- public_headers='charset.h',
- )
-
bld.SAMBA_SUBSYSTEM('ICONV_WRAPPER',
source='iconv.c',
public_deps='iconv replace talloc')
-bld.SAMBA_SUBSYSTEM('CODEPOINTS',
- source='codepoints.c convert_string.c util_str.c util_unistr_w.c charcnv.c pull_push.c',
- deps='DYNCONFIG ICONV_WRAPPER'
- )
+bld.SAMBA_SUBSYSTEM('CHARSET',
+ public_headers='charset.h',
+ source='codepoints.c convert_string.c util_str.c util_unistr_w.c charcnv.c pull_push.c util_unistr.c',
+ deps='DYNCONFIG ICONV_WRAPPER'
+ )