summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-13 22:46:09 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:56 +0100
commitd891c0c74a03d797aed1c5ac0329fd9d1d78da63 (patch)
tree65d0966014ca2bcded71ece2319a7723b03c4d3d /source4/lib
parent8f687a5faeaf779e88c54bea4f886eb8f410d448 (diff)
downloadsamba-d891c0c74a03d797aed1c5ac0329fd9d1d78da63.tar.gz
samba-d891c0c74a03d797aed1c5ac0329fd9d1d78da63.tar.bz2
samba-d891c0c74a03d797aed1c5ac0329fd9d1d78da63.zip
r26429: Avoid use of global_smb_iconv_convenience.
(This used to be commit d37136b7abfbba75ef2e5ab855eb3382b9648b8c)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/charset/util_unistr.c39
-rw-r--r--source4/lib/policy/lex.c3
-rw-r--r--source4/lib/registry/ldb.c4
-rw-r--r--source4/lib/registry/patchfile_preg.c3
-rw-r--r--source4/lib/registry/util.c5
-rw-r--r--source4/lib/tdr/tdr.c9
-rw-r--r--source4/lib/util/dprintf.c3
-rw-r--r--source4/lib/util/ms_fnmatch.c15
8 files changed, 43 insertions, 38 deletions
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c
index 67a790c250..e0e1aed222 100644
--- a/source4/lib/charset/util_unistr.c
+++ b/source4/lib/charset/util_unistr.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "system/locale.h"
#include "dynconfig.h"
+#include "param/param.h"
/**
* @file
@@ -129,8 +130,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
if (s2 == NULL) return 1;
while (*s1 && *s2) {
- c1 = next_codepoint(global_smb_iconv_convenience, s1, &size1);
- c2 = next_codepoint(global_smb_iconv_convenience, s2, &size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
s1 += size1;
s2 += size2;
@@ -215,8 +216,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
while (*s1 && *s2 && n) {
n--;
- c1 = next_codepoint(global_smb_iconv_convenience, s1, &size1);
- c2 = next_codepoint(global_smb_iconv_convenience, s2, &size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
s1 += size1;
s2 += size2;
@@ -275,7 +276,7 @@ _PUBLIC_ void string_replace_w(char *s, char oldc, char newc)
{
while (s && *s) {
size_t size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c == oldc) {
*s = newc;
}
@@ -353,7 +354,7 @@ _PUBLIC_ size_t strlen_m(const char *s)
while (*s) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
if (c < 0x10000) {
count += 1;
} else {
@@ -391,7 +392,7 @@ _PUBLIC_ char *strchr_m(const char *s, char c)
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) {
return discard_const_p(char, s);
}
@@ -416,7 +417,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) {
ret = discard_const_p(char, s);
}
@@ -436,7 +437,7 @@ _PUBLIC_ bool strhaslower(const char *string)
codepoint_t s;
codepoint_t t;
- s = next_codepoint(global_smb_iconv_convenience, string, &c_size);
+ s = next_codepoint(lp_iconv_convenience(global_loadparm), string, &c_size);
string += c_size;
t = toupper_w(s);
@@ -459,7 +460,7 @@ _PUBLIC_ bool strhasupper(const char *string)
codepoint_t s;
codepoint_t t;
- s = next_codepoint(global_smb_iconv_convenience, string, &c_size);
+ s = next_codepoint(lp_iconv_convenience(global_loadparm), string, &c_size);
string += c_size;
t = tolower_w(s);
@@ -489,12 +490,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
src += c_size;
c = tolower_w(c);
- c_size = push_codepoint(global_smb_iconv_convenience, dest+size, c);
+ c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -533,12 +534,12 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
src += c_size;
c = toupper_w(c);
- c_size = push_codepoint(global_smb_iconv_convenience, dest+size, c);
+ c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
@@ -579,8 +580,8 @@ _PUBLIC_ void strlower_m(char *s)
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(global_smb_iconv_convenience, d, tolower_w(c));
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
+ c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, tolower_w(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n",
c, tolower_w(c), (int)c_size, (int)c_size2));
@@ -615,8 +616,8 @@ _PUBLIC_ void strupper_m(char *s)
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(global_smb_iconv_convenience, d, toupper_w(c));
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
+ c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, toupper_w(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n",
c, toupper_w(c), (int)c_size, (int)c_size2));
@@ -638,7 +639,7 @@ _PUBLIC_ size_t count_chars_w(const char *s, char c)
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(global_smb_iconv_convenience, s, &size);
+ codepoint_t c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s, &size);
if (c2 == c) count++;
s += size;
}
diff --git a/source4/lib/policy/lex.c b/source4/lib/policy/lex.c
index 5364706fc4..c2899aa808 100644
--- a/source4/lib/policy/lex.c
+++ b/source4/lib/policy/lex.c
@@ -587,6 +587,7 @@ char *yytext;
#line 23 "lex.l"
#include "includes.h"
#include "lib/policy/parse_adm.h"
+#include "param/param.h"
void error_message (const char *format, ...);
int yyparse (void);
@@ -600,7 +601,7 @@ static bool utf16 = false;
if (fread(&v, 2, 1, yyin) < 1) \
result = YY_NULL; \
else \
- result = push_codepoint(global_smb_iconv_convenience, buf, v); \
+ result = push_codepoint(lp_iconv_convenience(global_loadparm), buf, v); \
} else { \
int c = getc(yyin); \
result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 0e556da9e2..11fa066a35 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -54,7 +54,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
{
case REG_SZ:
case REG_EXPAND_SZ:
- data->length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF8, CH_UTF16,
+ data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16,
val->data, val->length,
(void **)&data->data);
break;
@@ -85,7 +85,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
switch (type) {
case REG_SZ:
case REG_EXPAND_SZ:
- val.length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ val.length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
(void *)data.data,
data.length,
(void **)&val.data);
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 47bd160c54..9cc9a5dec2 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -23,6 +23,7 @@
#include "lib/registry/registry.h"
#include "lib/registry/patchfile.h"
#include "system/filesys.h"
+#include "param/param.h"
struct preg_data {
int fd;
@@ -35,7 +36,7 @@ static WERROR preg_read_utf16(int fd, char *c)
if (read(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE;
}
- push_codepoint(global_smb_iconv_convenience, c, v);
+ push_codepoint(lp_iconv_convenience(global_loadparm), c, v);
return WERR_OK;
}
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index f75fc835b5..a251ae49a5 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "lib/registry/registry.h"
#include "librpc/gen_ndr/winreg.h"
+#include "param/param.h"
/**
* @file
@@ -61,7 +62,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type,
switch (type) {
case REG_EXPAND_SZ:
case REG_SZ:
- convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UTF16, CH_UNIX,
+ convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
data.data, data.length,
(void **)&ret);
return ret;
@@ -117,7 +118,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str,
{
case REG_SZ:
case REG_EXPAND_SZ:
- data->length = convert_string_talloc(mem_ctx, global_smb_iconv_convenience, CH_UNIX, CH_UTF16,
+ data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
data_str, strlen(data_str),
(void **)&data->data);
break;
diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c
index 0757a02e47..80e1d9ae24 100644
--- a/source4/lib/tdr/tdr.c
+++ b/source4/lib/tdr/tdr.c
@@ -24,6 +24,7 @@
#include "system/filesys.h"
#include "system/network.h"
#include "tdr/tdr.h"
+#include "param/param.h"
#define TDR_BASE_MARSHALL_SIZE 1024
@@ -153,7 +154,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v,
TDR_PULL_NEED_BYTES(tdr, el_size*length);
- ret = convert_string_talloc(ctx, global_smb_iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v));
+ ret = convert_string_talloc(ctx, lp_iconv_convenience(global_loadparm), chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v));
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
@@ -175,7 +176,7 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length,
required = el_size * length;
TDR_PUSH_NEED_BYTES(tdr, required);
- ret = convert_string(global_smb_iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required);
+ ret = convert_string(lp_iconv_convenience(global_loadparm), CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required);
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
@@ -404,9 +405,7 @@ void tdr_print_debug_helper(struct tdr_print *tdr, const char *format, ...) _PRI
vasprintf(&s, format, ap);
va_end(ap);
- for (i=0;i<tdr->level;i++) {
- DEBUG(0,(" "));
- }
+ for (i=0;i<tdr->level;i++) { DEBUG(0,(" ")); }
DEBUG(0,("%s\n", s));
free(s);
diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c
index 5b3fe4b1ea..ae2b7bb4d5 100644
--- a/source4/lib/util/dprintf.c
+++ b/source4/lib/util/dprintf.c
@@ -32,6 +32,7 @@
#include "includes.h"
#include "system/locale.h"
+#include "param/param.h"
_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
{
@@ -55,7 +56,7 @@ again:
SAFE_FREE(p);
return -1;
}
- clen = convert_string(global_smb_iconv_convenience, CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen);
+ clen = convert_string(lp_iconv_convenience(global_loadparm), CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen);
if (clen == -1) {
/* the string can't be converted - do the best we can,
filling in non-printing chars with '?' */
diff --git a/source4/lib/util/ms_fnmatch.c b/source4/lib/util/ms_fnmatch.c
index e1bf6f94c5..1fb57b07a4 100644
--- a/source4/lib/util/ms_fnmatch.c
+++ b/source4/lib/util/ms_fnmatch.c
@@ -29,6 +29,7 @@
*/
#include "includes.h"
+#include "param/param.h"
static int null_match(const char *p)
{
@@ -64,7 +65,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
int i;
size_t size, size_n;
- while ((c = next_codepoint(global_smb_iconv_convenience, p, &size))) {
+ while ((c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &size))) {
p += size;
switch (c) {
@@ -74,7 +75,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
return null_match(p);
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(global_smb_iconv_convenience, n+i, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) {
return 0;
}
@@ -93,7 +94,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
return -1;
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(global_smb_iconv_convenience, n+i, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0;
if (n+i == ldot) {
if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0;
@@ -109,7 +110,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
if (! *n) {
return -1;
}
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
@@ -123,7 +124,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
break;
}
if (! *n) return null_match(p);
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
@@ -133,12 +134,12 @@ static int ms_fnmatch_core(const char *p, const char *n,
return 0;
}
if (*n != '.') return -1;
- next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
n += size_n;
break;
default:
- c2 = next_codepoint(global_smb_iconv_convenience, n, &size_n);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
if (c != c2 && codepoint_cmpi(c, c2) != 0) {
return -1;
}