diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-03-01 19:55:46 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-03-01 19:55:46 +0100 |
commit | 94069bd2747a8397308c0b0b384f7bb4edd8f68b (patch) | |
tree | ace3c4fa9d0cb134d4e904354bd33b395c1e1289 /source4/lib | |
parent | bbe2d30f66ebd8537203870b1225179f03d42744 (diff) | |
download | samba-94069bd2747a8397308c0b0b384f7bb4edd8f68b.tar.gz samba-94069bd2747a8397308c0b0b384f7bb4edd8f68b.tar.bz2 samba-94069bd2747a8397308c0b0b384f7bb4edd8f68b.zip |
s4: Use same function signature for convert_* as s3.
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/registry/ldb.c | 8 | ||||
-rw-r--r-- | source4/lib/registry/tests/generic.c | 12 | ||||
-rw-r--r-- | source4/lib/registry/util.c | 6 | ||||
-rw-r--r-- | source4/lib/tdr/tdr.c | 12 |
4 files changed, 17 insertions, 21 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 41fbd22335..c558805e04 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -60,9 +60,9 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, case REG_SZ: case REG_EXPAND_SZ: if (val != NULL) - data->length = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, + convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, - (void **)&data->data, false); + (void **)&data->data, &data->length, false); else { data->data = NULL; data->length = 0; @@ -105,10 +105,10 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, case REG_SZ: case REG_EXPAND_SZ: if (data.data[0] != '\0') { - val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, + convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, - (void **)&val.data, false); + (void **)&val.data, &val.length, false); ldb_msg_add_value(msg, "data", &val, NULL); } else { ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL); diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 3a3c3e7747..3de7602e53 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -53,8 +53,8 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx) static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; - db.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, - "bla", 3, (void **)&db.data, false); + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + "bla", 3, (void **)&db.data, &db.length, false); torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), "sz failed"); @@ -88,10 +88,10 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx) static bool test_reg_val_description(struct torture_context *ctx) { DATA_BLOB data; - data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "stationary traveller", strlen("stationary traveller"), - (void **)&data.data, false); + (void **)&data.data, &data.length, false); torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data), "reg_val_description failed"); @@ -102,10 +102,10 @@ static bool test_reg_val_description(struct torture_context *ctx) static bool test_reg_val_description_nullname(struct torture_context *ctx) { DATA_BLOB data; - data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "west berlin", strlen("west berlin"), - (void **)&data.data, false); + (void **)&data.data, &data.length, false); torture_assert_str_equal(ctx, "<No Name> = REG_SZ : west berlin", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data), "description with null name failed"); diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index 742c3dca2f..a1897eff2e 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -65,7 +65,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, case REG_SZ: convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX, data.data, data.length, - (void **)&ret, false); + (void **)&ret, NULL, false); return ret; case REG_BINARY: ret = data_blob_hex_string(mem_ctx, &data); @@ -123,9 +123,9 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, { case REG_SZ: case REG_EXPAND_SZ: - data->length = convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, + convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, data_str, strlen(data_str), - (void **)&data->data, false); + (void **)&data->data, &data->length, false); break; case REG_DWORD: { diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index 93f1329ea9..8b62ea0c2b 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -130,7 +130,7 @@ NTSTATUS tdr_print_uint32(struct tdr_print *tdr, const char *name, uint32_t *v) NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, uint32_t length, uint32_t el_size, charset_t chset) { - int ret; + size_t ret; if (length == -1) { switch (chset) { @@ -153,9 +153,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_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), false); - - if (ret == -1) { + 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)) { return NT_STATUS_INVALID_PARAMETER; } @@ -166,7 +164,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, uint32_t el_size, charset_t chset) { - ssize_t ret, required; + size_t ret, required; if (length == -1) { length = strlen(*v) + 1; /* Extra element for null character */ @@ -175,9 +173,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_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false); - - if (ret == -1) { + if (!convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, &ret, false)) { return NT_STATUS_INVALID_PARAMETER; } |