summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/charset/charset.h6
-rw-r--r--lib/util/charset/codepoints.c12
-rw-r--r--lib/util/charset/tests/convert_string.c110
-rw-r--r--lib/util/charset/util_str.c1
-rw-r--r--lib/util/dprintf.c35
5 files changed, 61 insertions, 103 deletions
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index a7e554204b..b36c461003 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -28,7 +28,7 @@
#include <talloc.h>
/* this defines the charset types used in samba */
-typedef enum {CH_UTF16LE=0, CH_UTF16=0, CH_UNIX, CH_DISPLAY, CH_DOS, CH_UTF8, CH_UTF16BE, CH_UTF16MUNGED} charset_t;
+typedef enum {CH_UTF16LE=0, CH_UTF16=0, CH_UNIX, CH_DOS, CH_UTF8, CH_UTF16BE, CH_UTF16MUNGED} charset_t;
#define NUM_CHARSETS 7
@@ -182,8 +182,7 @@ extern struct smb_iconv_handle *global_iconv_handle;
struct smb_iconv_handle *get_iconv_handle(void);
struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx,
const char *dos_charset,
- const char *unix_charset,
- const char *display_charset);
+ const char *unix_charset);
smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to);
const char *charset_name(struct smb_iconv_handle *ic, charset_t ch);
@@ -212,7 +211,6 @@ int codepoint_cmpi(codepoint_t c1, codepoint_t c2);
struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx,
const char *dos_charset,
const char *unix_charset,
- const char *display_charset,
bool native_iconv,
struct smb_iconv_handle *old_ic);
diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
index 71611bfc4c..305bfd717f 100644
--- a/lib/util/charset/codepoints.c
+++ b/lib/util/charset/codepoints.c
@@ -168,17 +168,16 @@ struct smb_iconv_handle *get_iconv_handle(void)
{
if (global_iconv_handle == NULL)
global_iconv_handle = smb_iconv_handle_reinit(talloc_autofree_context(),
- "ASCII", "UTF-8", "ASCII", true, NULL);
+ "ASCII", "UTF-8", true, NULL);
return global_iconv_handle;
}
struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx,
const char *dos_charset,
- const char *unix_charset,
- const char *display_charset)
+ const char *unix_charset)
{
return smb_iconv_handle_reinit(mem_ctx,
- dos_charset, unix_charset, display_charset, true, NULL);
+ dos_charset, unix_charset, true, NULL);
}
/**
@@ -190,7 +189,6 @@ const char *charset_name(struct smb_iconv_handle *ic, charset_t ch)
case CH_UTF16: return "UTF-16LE";
case CH_UNIX: return ic->unix_charset;
case CH_DOS: return ic->dos_charset;
- case CH_DISPLAY: return ic->display_charset;
case CH_UTF8: return "UTF8";
case CH_UTF16BE: return "UTF-16BE";
case CH_UTF16MUNGED: return "UTF16_MUNGED";
@@ -261,14 +259,11 @@ static const char *map_locale(const char *charset)
_PUBLIC_ struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx,
const char *dos_charset,
const char *unix_charset,
- const char *display_charset,
bool native_iconv,
struct smb_iconv_handle *old_ic)
{
struct smb_iconv_handle *ret;
- display_charset = map_locale(display_charset);
-
if (old_ic != NULL) {
ret = old_ic;
close_iconv_handle(ret);
@@ -297,7 +292,6 @@ _PUBLIC_ struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx,
ret->dos_charset = talloc_strdup(ret->child_ctx, dos_charset);
ret->unix_charset = talloc_strdup(ret->child_ctx, unix_charset);
- ret->display_charset = talloc_strdup(ret->child_ctx, display_charset);
ret->native_iconv = native_iconv;
return ret;
diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c
index bd140d59db..9a5d974fe3 100644
--- a/lib/util/charset/tests/convert_string.c
+++ b/lib/util/charset/tests/convert_string.c
@@ -105,7 +105,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_iso8859_1.data);
talloc_steal(tctx, gd_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -199,11 +199,11 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, gd_output, gd_cp850, "conversion from UTF8 to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF8, CH_DISPLAY,
+ CH_UTF8, CH_UTF8,
gd_utf8.data, gd_utf8.length,
(void *)&gd_output.data, &gd_output.length),
- "conversion from UTF8 to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF8 to (display charset) UTF8 incorrect");
+ "conversion from UTF8 to UTF8");
+ torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF8 to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_DOS,
@@ -227,11 +227,11 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, gd_output, gd_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF16LE, CH_DISPLAY,
+ CH_UTF16LE, CH_UTF8,
gd_utf16le.data, gd_utf16le.length,
(void *)&gd_output.data, &gd_output.length),
- "conversion from UTF16LE to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion from UTF16LE to UTF8");
+ torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_DOS,
@@ -248,11 +248,11 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, gd_output, gd_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_DOS, CH_DISPLAY,
+ CH_DOS, CH_UTF8,
gd_iso8859_1.data, gd_iso8859_1.length,
(void *)&gd_output.data, &gd_output.length),
- "conversion from (dos charset) ISO8859-1 to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion from (dos charset) ISO8859-1 to UTF8");
+ torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UTF16LE,
@@ -265,7 +265,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
(const char *)gd_iso8859_1.data,
CH_DOS, CH_UTF16LE),
gd_output.length / 2,
- "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to display charset UTF8 and back again");
+ "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to UTF8 and back again");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UTF8,
@@ -297,7 +297,7 @@ static bool test_gd_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_cp850.data);
talloc_steal(tctx, gd_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850");
torture_assert(tctx, iconv_handle, "getting iconv handle");
gd_utf8_terminated = data_blob_talloc(tctx, NULL, gd_utf8.length + 1);
@@ -481,7 +481,7 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_iso8859_1.data);
talloc_steal(tctx, gd_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -550,7 +550,7 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
talloc_steal(tctx, plato_english_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -568,11 +568,11 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_cp850, "conversion from UTF8 to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF8, CH_DISPLAY,
+ CH_UTF8, CH_UTF8,
plato_english_utf8.data, plato_english_utf8.length,
(void *)&plato_english_output.data, &plato_english_output.length),
- "conversion from UTF8 to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF8 to (display charset) UTF8 incorrect");
+ "conversion from UTF8 to UTF8");
+ torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF8 to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_DOS,
@@ -621,11 +621,11 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF16LE, CH_DISPLAY,
+ CH_UTF16LE, CH_UTF8,
plato_english_utf16le.data, plato_english_utf16le.length,
(void *)&plato_english_output.data, &plato_english_output.length),
- "conversion from UTF16LE to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion from UTF16LE to UTF8");
+ torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_DOS,
@@ -642,11 +642,11 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_DOS, CH_DISPLAY,
+ CH_DOS, CH_UTF8,
plato_english_iso8859_1.data, plato_english_iso8859_1.length,
(void *)&plato_english_output.data, &plato_english_output.length),
- "conversion from (dos charset) ISO8859-1 to (display charset) UTF8");
- torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion from (dos charset) ISO8859-1 to UTF8");
+ torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UTF16LE,
@@ -668,7 +668,7 @@ static bool test_plato_english_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_english_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
torture_assert(tctx, iconv_handle, "getting iconv handle");
plato_english_utf8_terminated = data_blob_talloc(tctx, NULL, plato_english_utf8.length + 1);
@@ -809,7 +809,7 @@ static bool test_plato_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_utf8.data);
talloc_steal(tctx, plato_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
torture_assert(tctx, iconv_handle, "getting iconv handle");
plato_utf8_terminated = data_blob_talloc(tctx, NULL, plato_utf8.length + 1);
@@ -923,7 +923,7 @@ static bool test_plato_cp850_utf8_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_utf8.data);
talloc_steal(tctx, plato_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8");
torture_assert(tctx, iconv_handle, "creating iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -1008,11 +1008,11 @@ static bool test_plato_cp850_utf8_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF8 to (unix charset) UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF8, CH_DISPLAY,
+ CH_UTF8, CH_UTF8,
plato_utf8.data, plato_utf8.length,
(void *)&plato_output.data, &plato_output.length),
"conversion of UTF16 ancient greek to unix charset UTF8 failed");
- torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF8 to (display charset) UTF8 incorrect");
+ torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF8 to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_DOS,
@@ -1067,39 +1067,39 @@ static bool test_plato_cp850_utf8_handle(struct torture_context *tctx)
"conversion of UTF16 ancient greek to UTF8 failed");
torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF16LE, CH_DISPLAY,
+ CH_UTF16LE, CH_UTF8,
plato_utf16le.data, plato_utf16le.length,
(void *)&plato_output.data, &plato_output.length),
- "conversion of UTF16 ancient greek to display charset UTF8 failed");
- torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion of UTF16 ancient greek to UTF8 failed");
+ torture_assert_data_blob_equal(tctx, plato_output, plato_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_DISPLAY, CH_UTF16LE,
+ CH_UTF8, CH_UTF16LE,
plato_output.data, plato_output.length,
(void *)&plato_output2.data, &plato_output2.length),
- "round trip conversion of UTF16 ancient greek to display charset UTF8 and back again failed");
+ "round trip conversion of UTF16 ancient greek to UTF8 and back again failed");
torture_assert_data_blob_equal(tctx, plato_output2, plato_utf16le,
- "round trip conversion of UTF16 ancient greek to display charset UTF8 and back again failed");
+ "round trip conversion of UTF16 ancient greek to UTF8 and back again failed");
torture_assert_int_equal(tctx,
strlen_m_ext_handle(iconv_handle,
(const char *)plato_output.data,
- CH_DISPLAY, CH_UTF16LE),
+ CH_UTF8, CH_UTF16LE),
plato_output2.length / 2,
- "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to display charset UTF8 and back again");
+ "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to UTF8 and back again");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_DISPLAY, CH_UTF8,
+ CH_UTF8, CH_UTF8,
plato_output.data, plato_output.length,
(void *)&plato_output2.data, &plato_output2.length),
- "conversion of display charset UTF8 to UTF8");
+ "conversion of UTF8 to UTF8");
torture_assert_data_blob_equal(tctx, plato_output2, plato_utf8,
- "conversion of display charset UTF8 to UTF8");
+ "conversion of UTF8 to UTF8");
torture_assert_int_equal(tctx,
strlen_m_ext_handle(iconv_handle,
(const char *)plato_output.data,
- CH_DISPLAY, CH_UTF8),
+ CH_UTF8, CH_UTF8),
plato_output2.length,
- "checking strlen_m_ext of conversion of display charset UTF8 to UTF8");
+ "checking strlen_m_ext of conversion of UTF8 to UTF8");
return true;
}
@@ -1114,7 +1114,7 @@ static bool test_plato_latin_cp850_utf8_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_latin_utf8.data);
talloc_steal(tctx, plato_latin_utf16le.data);
- iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8");
torture_assert(tctx, iconv_handle, "creating iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -1131,11 +1131,11 @@ static bool test_plato_latin_cp850_utf8_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF8 to (unix charset) UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF8, CH_DISPLAY,
+ CH_UTF8, CH_UTF8,
plato_latin_utf8.data, plato_latin_utf8.length,
(void *)&plato_latin_output.data, &plato_latin_output.length),
"conversion of UTF16 latin charset greek to unix charset UTF8 failed");
- torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF8 to (display charset) UTF8 incorrect");
+ torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF8 to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_DOS,
@@ -1151,25 +1151,25 @@ static bool test_plato_latin_cp850_utf8_handle(struct torture_context *tctx)
torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF16LE to (unix charset) CP850 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_UTF16LE, CH_DISPLAY,
+ CH_UTF16LE, CH_UTF8,
plato_latin_utf16le.data, plato_latin_utf16le.length,
(void *)&plato_latin_output.data, &plato_latin_output.length),
- "conversion of UTF16 latin charset greek to display charset UTF8 failed");
- torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF16LE to (display charset) UTF8 incorrect");
+ "conversion of UTF16 latin charset greek to UTF8 failed");
+ torture_assert_data_blob_equal(tctx, plato_latin_output, plato_latin_utf8, "conversion from UTF16LE to UTF8 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
- CH_DISPLAY, CH_UTF16LE,
+ CH_UTF8, CH_UTF16LE,
plato_latin_output.data, plato_latin_output.length,
(void *)&plato_latin_output2.data, &plato_latin_output2.length),
- "round trip conversion of UTF16 latin charset greek to display charset UTF8 and back again failed");
+ "round trip conversion of UTF16 latin charset greek to UTF8 and back again failed");
torture_assert_data_blob_equal(tctx, plato_latin_output2, plato_latin_utf16le,
- "round trip conversion of UTF16 latin charset greek to display charset UTF8 and back again failed");
+ "round trip conversion of UTF16 latin charset greek to UTF8 and back again failed");
torture_assert_int_equal(tctx,
strlen_m_ext_handle(iconv_handle,
(const char *)plato_latin_output.data,
- CH_DISPLAY, CH_UTF16LE),
+ CH_UTF8, CH_UTF16LE),
plato_latin_output2.length / 2,
- "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to display charset UTF8 and back again");
+ "checking strlen_m_ext of round trip conversion of UTF16 latin charset greek to UTF8 and back again");
return true;
}
@@ -1182,7 +1182,7 @@ static bool test_gd_case_utf8_handle(struct torture_context *tctx)
char *gd_lower, *gd_upper;
talloc_steal(tctx, gd_utf8.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
torture_assert(tctx,
@@ -1245,7 +1245,7 @@ static bool test_gd_case_cp850_handle(struct torture_context *tctx)
char *gd_lower, *gd_upper;
talloc_steal(tctx, gd_cp850.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850", "CP850");
+ iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850");
torture_assert(tctx, iconv_handle, "getting cp850 iconv handle");
torture_assert(tctx,
@@ -1306,7 +1306,7 @@ static bool test_plato_case_utf8_handle(struct torture_context *tctx)
char *plato_lower, *plato_upper;
talloc_steal(tctx, plato_utf8.data);
- iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8", "UTF8");
+ iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
torture_assert(tctx,
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c
index 80e5bde354..688ab5a0a1 100644
--- a/lib/util/charset/util_str.c
+++ b/lib/util/charset/util_str.c
@@ -169,7 +169,6 @@ _PUBLIC_ size_t strlen_m_ext_handle(struct smb_iconv_handle *ic,
switch (dst_charset) {
case CH_DOS:
case CH_UNIX:
- case CH_DISPLAY:
smb_panic("cannot call strlen_m_ext() with a variable dest charset (must be UTF16* or UTF8)");
default:
break;
diff --git a/lib/util/dprintf.c b/lib/util/dprintf.c
index 376eb4c75e..90ca36c1ae 100644
--- a/lib/util/dprintf.c
+++ b/lib/util/dprintf.c
@@ -36,40 +36,7 @@
static int d_vfprintf(FILE *f, const char *format, va_list ap)
{
- char *p, *p2;
- int ret;
- size_t clen;
- bool cret;
- va_list ap2;
-
- va_copy(ap2, ap);
- ret = vasprintf(&p, format, ap2);
- va_end(ap2);
-
- if (ret <= 0) return ret;
-
- cret = convert_string_talloc(NULL, CH_UNIX, CH_DISPLAY, p, ret, (void **)&p2, &clen);
- if (!cret) {
- /* the string can't be converted - do the best we can,
- filling in non-printing chars with '?' */
- int i;
- for (i=0;i<ret;i++) {
- if (isprint(p[i]) || isspace(p[i])) {
- fwrite(p+i, 1, 1, f);
- } else {
- fwrite("?", 1, 1, f);
- }
- }
- SAFE_FREE(p);
- return ret;
- }
-
- /* good, its converted OK */
- SAFE_FREE(p);
- ret = fwrite(p2, 1, clen, f);
- talloc_free(p2);
-
- return ret;
+ return vfprintf(f, format, ap);
}