1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/util/charset Use name of ISO-8859-1 that matches our internal implementation

This commit is contained in:
Andrew Bartlett 2011-09-10 15:41:14 +10:00
parent 0022296349
commit 142f871cef

View File

@ -106,7 +106,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",
iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle");
@ -114,16 +114,16 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
CH_UTF8, CH_DOS,
gd_utf8.data, gd_utf8.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from UTF8 to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
"conversion from UTF8 to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_error_handle(iconv_handle,
CH_UTF8, CH_DOS,
gd_utf8.data, gd_utf8.length,
(void *)gd_output.data, gd_output.length,
&gd_output.length),
"conversion from UTF8 to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
"conversion from UTF8 to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
/* Short output handling confirmation */
gd_output.length = 1;
@ -132,10 +132,10 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
gd_utf8.data, gd_utf8.length,
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
"conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
/* Short output handling confirmation */
gd_output.length = 2;
@ -144,8 +144,8 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
gd_utf8.data, gd_utf8.length,
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
"conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
torture_assert_int_equal(tctx, gd_output.length, 2, "Should only get 2 char of output");
/* Short input handling confirmation */
@ -155,8 +155,8 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
gd_utf8.data, 2,
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from short UTF8 to (dos charset) ISO8859-1 should fail EINVAL");
"conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from short UTF8 to (dos charset) ISO-8859-1 should fail EINVAL");
torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
/* Short output handling confirmation */
@ -167,7 +167,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF16 to UTF8 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO8859-1 should fail E2BIG");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO-8859-1 should fail E2BIG");
torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF16 to UTF8 incorrect");
@ -179,7 +179,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF16 to UTF8 should fail due to too short");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO8859-1 should fail E2BIG");
torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO-8859-1 should fail E2BIG");
torture_assert_int_equal(tctx, gd_output.length, 3, "Should get 3 bytes output for UTF8");
/* Short input handling confirmation */
@ -211,15 +211,15 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
CH_UTF16LE, CH_DOS,
gd_utf16le.data, gd_utf16le.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from UTF16LE to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
"conversion from UTF16LE to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UTF16LE,
gd_output.data, gd_output.length,
(void *)&gd_output2.data, &gd_output2.length),
"round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
torture_assert_data_blob_equal(tctx, gd_output2, gd_utf16le, "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
"round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
torture_assert_data_blob_equal(tctx, gd_output2, gd_utf16le, "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_UNIX,
@ -239,29 +239,29 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
CH_DOS, CH_DOS,
gd_iso8859_1.data, gd_iso8859_1.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from (dos charset) ISO8859-1 to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
"conversion from (dos charset) ISO-8859-1 to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UNIX,
gd_iso8859_1.data, gd_iso8859_1.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from (dos charset) ISO8859-1 to (unix charset) CP850");
"conversion from (dos charset) ISO-8859-1 to (unix charset) CP850");
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_UTF8,
gd_iso8859_1.data, gd_iso8859_1.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from (dos charset) ISO8859-1 to UTF8");
"conversion from (dos charset) ISO-8859-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,
gd_iso8859_1.data, gd_iso8859_1.length,
(void *)&gd_output.data, &gd_output.length),
"conversion from (dos charset) ISO8859-1 to UTF16LE");
torture_assert_data_blob_equal(tctx, gd_output, gd_utf16le, "conversion from (dos charset) ISO8859-1 to UTF16LE");
"conversion from (dos charset) ISO-8859-1 to UTF16LE");
torture_assert_data_blob_equal(tctx, gd_output, gd_utf16le, "conversion from (dos charset) ISO-8859-1 to UTF16LE");
torture_assert_int_equal(tctx,
strlen_m_ext_handle(iconv_handle,
(const char *)gd_iso8859_1.data,
@ -273,14 +273,14 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
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 UTF8");
torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from (dos charset) ISO8859-1 to UTF8");
"conversion from (dos charset) ISO-8859-1 to UTF8");
torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from (dos charset) ISO-8859-1 to UTF8");
torture_assert_int_equal(tctx,
strlen_m_ext_handle(iconv_handle,
(const char *)gd_iso8859_1.data,
CH_DOS, CH_UTF8),
gd_output.length,
"checking strlen_m_ext of conversion from (dos charset) ISO8859-1 to UTF8");
"checking strlen_m_ext of conversion from (dos charset) ISO-8859-1 to UTF8");
return true;
}
@ -502,7 +502,7 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF8 to (dos charset) ASCII should fail");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "partial conversion from UTF8 to (dos charset) ASCII incorrect");
@ -526,7 +526,7 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
(void *)gd_output.data, gd_output.length,
&gd_output.length) == false,
"conversion from UTF8 to (dos charset) ASCII should fail due to too illigal seqence");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO8859-1 should fail EILSEQ");
torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail EILSEQ");
torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 2 char of output");
/* Short input handling confirmation */
@ -554,7 +554,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",
iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle");
@ -562,8 +562,8 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
CH_UTF8, CH_DOS,
plato_english_utf8.data, plato_english_utf8.length,
(void *)&plato_english_output.data, &plato_english_output.length),
"conversion from UTF8 to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
"conversion from UTF8 to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF8, CH_UNIX,
@ -583,15 +583,15 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
CH_UTF16LE, CH_DOS,
plato_english_utf16le.data, plato_english_utf16le.length,
(void *)&plato_english_output.data, &plato_english_output.length),
"conversion from UTF16LE to (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
"conversion from UTF16LE to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UTF16LE,
plato_english_output.data, plato_english_output.length,
(void *)&plato_english_output2.data, &plato_english_output2.length),
"round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
torture_assert_data_blob_equal(tctx, plato_english_output2, plato_english_utf16le, "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
"round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
torture_assert_data_blob_equal(tctx, plato_english_output2, plato_english_utf16le, "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_UTF16LE, CH_UTF8,
@ -636,29 +636,29 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
CH_DOS, CH_DOS,
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 (dos charset) ISO8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
"conversion from (dos charset) ISO-8859-1 to (dos charset) ISO-8859-1");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
CH_DOS, CH_UNIX,
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 (unix charset) CP850");
"conversion from (dos charset) ISO-8859-1 to (unix charset) CP850");
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_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 UTF8");
"conversion from (dos charset) ISO-8859-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,
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 UTF16LE");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf16le, "conversion from (dos charset) ISO8859-1 to UTF16LE");
"conversion from (dos charset) ISO-8859-1 to UTF16LE");
torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf16le, "conversion from (dos charset) ISO-8859-1 to UTF16LE");
return true;
}
@ -673,7 +673,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",
iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle");
@ -815,7 +815,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",
iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle");