From f9ca9e46ad24036bf00cb361a6cef4b2e7e98d7d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 9 May 2010 17:20:01 +0200 Subject: Finish removal of iconv_convenience in public API's. --- source4/lib/registry/tests/diff.c | 19 ++++++------------- source4/lib/registry/tests/generic.c | 24 ++++++++++++------------ source4/lib/registry/tests/hive.c | 3 +-- 3 files changed, 19 insertions(+), 27 deletions(-) (limited to 'source4/lib/registry/tests') diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index 4241ab5ee2..d6a5bd53f2 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -52,14 +52,11 @@ static bool test_generate_diff(struct torture_context *tctx, void *tcase_data) static bool test_diff_load(struct torture_context *tctx, void *tcase_data) { struct diff_tcase_data *td = tcase_data; - struct smb_iconv_convenience *ic; struct reg_diff_callbacks *callbacks; void *data; WERROR error; - ic = lp_iconv_convenience(tctx->lp_ctx); - - error = reg_diff_load(td->filename, iconv_convenience, callbacks, data); + error = reg_diff_load(td->filename, callbacks, data); torture_assert_werr_ok(tctx, error, "reg_diff_load"); return true; @@ -71,7 +68,7 @@ static bool test_diff_apply(struct torture_context *tctx, void *tcase_data) struct registry_key *key; WERROR error; - error = reg_diff_apply(td->r1_ctx, lp_iconv_convenience(tctx->lp_ctx), td->filename); + error = reg_diff_apply(td->r1_ctx, td->filename); torture_assert_werr_ok(tctx, error, "reg_diff_apply"); error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key); @@ -247,16 +244,14 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data) { struct diff_tcase_data *td; - struct smb_iconv_convenience *ic; WERROR error; diff_setup_tcase(tctx, data); td = *data; - ic = lp_iconv_convenience(tctx->lp_ctx); - td->filename = talloc_asprintf(tctx, "%s/test.pol", td->tempdir); - error = reg_preg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data); + error = reg_preg_diff_save(tctx, td->filename, &td->callbacks, + &td->callback_data); torture_assert_werr_ok(tctx, error, "reg_preg_diff_save"); return true; @@ -265,16 +260,14 @@ static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data) static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data) { struct diff_tcase_data *td; - struct smb_iconv_convenience *ic; WERROR error; diff_setup_tcase(tctx, data); td = *data; - ic = lp_iconv_convenience(tctx->lp_ctx); - td->filename = talloc_asprintf(tctx, "%s/test.reg", td->tempdir); - error = reg_dotreg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data); + error = reg_dotreg_diff_save(tctx, td->filename, &td->callbacks, + &td->callback_data); torture_assert_werr_ok(tctx, error, "reg_dotreg_diff_save"); return true; diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 75b6c7ff26..a69a6148d5 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -65,7 +65,7 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx) uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 }; DATA_BLOB db = { d, 4 }; torture_assert_str_equal(ctx, "0x00000020", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD, db), + reg_val_data_string(ctx, REG_DWORD, db), "dword failed"); return true; } @@ -75,7 +75,7 @@ static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ct uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 }; DATA_BLOB db = { d, 4 }; torture_assert_str_equal(ctx, "0x00000020", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD_BIG_ENDIAN, db), + reg_val_data_string(ctx, REG_DWORD_BIG_ENDIAN, db), "dword failed"); return true; } @@ -85,7 +85,7 @@ static bool test_reg_val_data_string_qword(struct torture_context *ctx) uint8_t d[] = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; DATA_BLOB db = { d, 8 }; torture_assert_str_equal(ctx, "0x0000000000000020", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_QWORD, db), + reg_val_data_string(ctx, REG_QWORD, db), "qword failed"); return true; } @@ -93,14 +93,14 @@ static bool test_reg_val_data_string_qword(struct torture_context *ctx) static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; - convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc(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), + reg_val_data_string(ctx, REG_SZ, db), "sz failed"); db.length = 4; torture_assert_str_equal(ctx, "bl", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), + reg_val_data_string(ctx, REG_SZ, db), "sz failed"); return true; } @@ -110,7 +110,7 @@ static bool test_reg_val_data_string_binary(struct torture_context *ctx) uint8_t x[] = { 0x1, 0x2, 0x3, 0x4 }; DATA_BLOB db = { x, 4 }; torture_assert_str_equal(ctx, "01020304", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db), + reg_val_data_string(ctx, REG_BINARY, db), "binary failed"); return true; } @@ -120,7 +120,7 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx) { DATA_BLOB db = { NULL, 0 }; torture_assert_str_equal(ctx, "", - reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db), + reg_val_data_string(ctx, REG_BINARY, db), "empty failed"); return true; } @@ -128,12 +128,12 @@ 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; - convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc(ctx, CH_UTF8, CH_UTF16, "stationary traveller", strlen("stationary traveller"), (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(ctx, "camel", REG_SZ, data), "reg_val_description failed"); return true; } @@ -142,12 +142,12 @@ static bool test_reg_val_description(struct torture_context *ctx) static bool test_reg_val_description_nullname(struct torture_context *ctx) { DATA_BLOB data; - convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc(ctx, CH_UTF8, CH_UTF16, "west berlin", strlen("west berlin"), (void **)&data.data, &data.length, false); torture_assert_str_equal(ctx, " = REG_SZ : west berlin", - reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data), + reg_val_description(ctx, NULL, REG_SZ, data), "description with null name failed"); return true; } diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 905b9a97ef..4ae9a5bcbf 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -435,8 +435,7 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data) rmdir(dirname); - error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx), - dirname, 5, &key); + error = reg_create_regf_file(tctx, dirname, 5, &key); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to create new regf file\n"); return false; -- cgit