summaryrefslogtreecommitdiffstats
path: root/lib/tdr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-05-09 17:20:01 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-05-18 11:45:30 +0200
commitf9ca9e46ad24036bf00cb361a6cef4b2e7e98d7d (patch)
tree9a0a6cb6617d855c28eb891396898096c4214e88 /lib/tdr
parente9f5bdf6b5a1aeb7e2e556cf41f7cbc2abed7856 (diff)
downloadsamba-f9ca9e46ad24036bf00cb361a6cef4b2e7e98d7d.tar.gz
samba-f9ca9e46ad24036bf00cb361a6cef4b2e7e98d7d.tar.xz
samba-f9ca9e46ad24036bf00cb361a6cef4b2e7e98d7d.zip
Finish removal of iconv_convenience in public API's.
Diffstat (limited to 'lib/tdr')
-rw-r--r--lib/tdr/tdr.c17
-rw-r--r--lib/tdr/tdr.h2
-rw-r--r--lib/tdr/testsuite.c18
3 files changed, 16 insertions, 21 deletions
diff --git a/lib/tdr/tdr.c b/lib/tdr/tdr.c
index ce67003f8bf..95871047b7f 100644
--- a/lib/tdr/tdr.c
+++ b/lib/tdr/tdr.c
@@ -163,7 +163,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v,
TDR_PULL_NEED_BYTES(tdr, el_size*length);
- if (!convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret, false)) {
+ if (!convert_string_talloc(ctx, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret, false)) {
return NT_STATUS_INVALID_PARAMETER;
}
@@ -183,7 +183,8 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length,
required = el_size * length;
TDR_PUSH_NEED_BYTES(tdr, required);
- if (!convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, &ret, false)) {
+ ret = convert_string(CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false);
+ if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
}
@@ -343,33 +344,29 @@ NTSTATUS tdr_pull_DATA_BLOB(struct tdr_pull *tdr, TALLOC_CTX *ctx, DATA_BLOB *bl
return NT_STATUS_OK;
}
-struct tdr_push *tdr_push_init(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic)
+struct tdr_push *tdr_push_init(TALLOC_CTX *mem_ctx)
{
struct tdr_push *push = talloc_zero(mem_ctx, struct tdr_push);
if (push == NULL)
return NULL;
- push->iconv_convenience = talloc_reference(push, ic);
-
return push;
}
-struct tdr_pull *tdr_pull_init(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic)
+struct tdr_pull *tdr_pull_init(TALLOC_CTX *mem_ctx)
{
struct tdr_pull *pull = talloc_zero(mem_ctx, struct tdr_pull);
if (pull == NULL)
return NULL;
- pull->iconv_convenience = talloc_reference(pull, ic);
-
return pull;
}
-NTSTATUS tdr_push_to_fd(int fd, struct smb_iconv_convenience *iconv_convenience, tdr_push_fn_t push_fn, const void *p)
+NTSTATUS tdr_push_to_fd(int fd, tdr_push_fn_t push_fn, const void *p)
{
- struct tdr_push *push = tdr_push_init(NULL, iconv_convenience);
+ struct tdr_push *push = tdr_push_init(NULL);
if (push == NULL)
return NT_STATUS_NO_MEMORY;
diff --git a/lib/tdr/tdr.h b/lib/tdr/tdr.h
index 84f3e50c2ba..c3ffd2f6ffd 100644
--- a/lib/tdr/tdr.h
+++ b/lib/tdr/tdr.h
@@ -33,13 +33,11 @@ struct tdr_pull {
DATA_BLOB data;
uint32_t offset;
int flags;
- struct smb_iconv_convenience *iconv_convenience;
};
struct tdr_push {
DATA_BLOB data;
int flags;
- struct smb_iconv_convenience *iconv_convenience;
};
struct tdr_print {
diff --git a/lib/tdr/testsuite.c b/lib/tdr/testsuite.c
index ca76b5291e7..1db7a1d5fe9 100644
--- a/lib/tdr/testsuite.c
+++ b/lib/tdr/testsuite.c
@@ -25,7 +25,7 @@
static bool test_push_uint8(struct torture_context *tctx)
{
uint8_t v = 4;
- struct tdr_push *tdr = tdr_push_init(tctx, global_iconv_convenience);
+ struct tdr_push *tdr = tdr_push_init(tctx);
torture_assert_ntstatus_ok(tctx, tdr_push_uint8(tdr, &v), "push failed");
torture_assert_int_equal(tctx, tdr->data.length, 1, "length incorrect");
@@ -37,7 +37,7 @@ static bool test_pull_uint8(struct torture_context *tctx)
{
uint8_t d = 2;
uint8_t l;
- struct tdr_pull *tdr = tdr_pull_init(tctx, global_iconv_convenience);
+ struct tdr_pull *tdr = tdr_pull_init(tctx);
tdr->data.data = &d;
tdr->data.length = 1;
tdr->offset = 0;
@@ -52,7 +52,7 @@ static bool test_pull_uint8(struct torture_context *tctx)
static bool test_push_uint16(struct torture_context *tctx)
{
uint16_t v = 0xF32;
- struct tdr_push *tdr = tdr_push_init(tctx, global_iconv_convenience);
+ struct tdr_push *tdr = tdr_push_init(tctx);
torture_assert_ntstatus_ok(tctx, tdr_push_uint16(tdr, &v), "push failed");
torture_assert_int_equal(tctx, tdr->data.length, 2, "length incorrect");
@@ -65,7 +65,7 @@ static bool test_pull_uint16(struct torture_context *tctx)
{
uint8_t d[2] = { 782 & 0xFF, (782 & 0xFF00) / 0x100 };
uint16_t l;
- struct tdr_pull *tdr = tdr_pull_init(tctx, global_iconv_convenience);
+ struct tdr_pull *tdr = tdr_pull_init(tctx);
tdr->data.data = d;
tdr->data.length = 2;
tdr->offset = 0;
@@ -80,7 +80,7 @@ static bool test_pull_uint16(struct torture_context *tctx)
static bool test_push_uint32(struct torture_context *tctx)
{
uint32_t v = 0x100F32;
- struct tdr_push *tdr = tdr_push_init(tctx, global_iconv_convenience);
+ struct tdr_push *tdr = tdr_push_init(tctx);
torture_assert_ntstatus_ok(tctx, tdr_push_uint32(tdr, &v), "push failed");
torture_assert_int_equal(tctx, tdr->data.length, 4, "length incorrect");
@@ -95,7 +95,7 @@ static bool test_pull_uint32(struct torture_context *tctx)
{
uint8_t d[4] = { 782 & 0xFF, (782 & 0xFF00) / 0x100, 0, 0 };
uint32_t l;
- struct tdr_pull *tdr = tdr_pull_init(tctx, global_iconv_convenience);
+ struct tdr_pull *tdr = tdr_pull_init(tctx);
tdr->data.data = d;
tdr->data.length = 4;
tdr->offset = 0;
@@ -109,7 +109,7 @@ static bool test_pull_uint32(struct torture_context *tctx)
static bool test_pull_charset(struct torture_context *tctx)
{
- struct tdr_pull *tdr = tdr_pull_init(tctx, global_iconv_convenience);
+ struct tdr_pull *tdr = tdr_pull_init(tctx);
const char *l = NULL;
tdr->data.data = (uint8_t *)talloc_strdup(tctx, "bla");
tdr->data.length = 4;
@@ -131,7 +131,7 @@ static bool test_pull_charset(struct torture_context *tctx)
static bool test_pull_charset_empty(struct torture_context *tctx)
{
- struct tdr_pull *tdr = tdr_pull_init(tctx, global_iconv_convenience);
+ struct tdr_pull *tdr = tdr_pull_init(tctx);
const char *l = NULL;
tdr->data.data = (uint8_t *)talloc_strdup(tctx, "bla");
tdr->data.length = 4;
@@ -150,7 +150,7 @@ static bool test_pull_charset_empty(struct torture_context *tctx)
static bool test_push_charset(struct torture_context *tctx)
{
const char *l = "bloe";
- struct tdr_push *tdr = tdr_push_init(tctx, global_iconv_convenience);
+ struct tdr_push *tdr = tdr_push_init(tctx);
torture_assert_ntstatus_ok(tctx, tdr_push_charset(tdr, &l, 4, 1, CH_UTF8),
"push failed");
torture_assert_int_equal(tctx, 4, tdr->data.length, "offset invalid");