lib/util/charset: Remove 'display charset'
authorAndrew Bartlett <abartlet@samba.org>
Tue, 21 Jun 2011 23:52:31 +0000 (09:52 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 23 Jun 2011 11:47:27 +0000 (13:47 +0200)
As discussed in 'CH_DISPLAY and gettext' on the samba-technical list:
http://lists.samba.org/archive/samba-technical/2011-June/078190.html

Setting this to a value other than 'unix charset' does not make sense,
as any system where the filesytem charset does not equal the terminal
charset will already have problems with programs as simple as 'ls'.
It also means that our output could not be pasted as our input in
interactive programs or onto our command line, as we never did
translate in the DISPLAY -> UNIX direction.

The d_printf() calls are retained in case we need to revisit this, and
to support display_set_stderr().

Andrew Bartlett

13 files changed:
lib/util/charset/charset.h
lib/util/charset/codepoints.c
lib/util/charset/tests/convert_string.c
lib/util/charset/util_str.c
lib/util/dprintf.c
librpc/ndr/ndr_string.c
source3/build/charset.py
source3/configure.in
source3/include/proto.h
source3/param/loadparm.c
source3/param/loadparm_ctx.c
source4/param/loadparm.c
source4/param/util.c

index a7e554204bcabef985f3f270af3d8a4b27530e2f..b36c461003bf6b76639221c062ea2884f33da8b9 100644 (file)
@@ -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);
 
index 71611bfc4c1438f1bc773b761ad3c1b81983ac77..305bfd717fad46e9dc9384c6489cde1f03277a9c 100644 (file)
@@ -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;
index bd140d59db885b80b42694a6fca4978755c28580..9a5d974fe35da3e967e334427b79f075fa396150 100644 (file)
@@ -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,
index 80e5bde354f213f5ee39eee32d4b92b8fc3b9983..688ab5a0a1c11b8b1a02a421060eb0d8767c50e9 100644 (file)
@@ -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;
index 376eb4c75e474372d8d7f8f4007f898a8578c59b..90ca36c1ae5a1f3f592b280cd8dfa925587b820a 100644 (file)
 
 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);
 }
 
 
index 4510a71082ff8180833f4013287225c7bcceb3bf..840776fa3a9e38ab67ef6a9d48df0283d86547b7 100644 (file)
@@ -645,7 +645,6 @@ _PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset)
        case CH_UTF16MUNGED:
        case CH_UTF8:
                return strlen_m_ext_term((const char *)var, CH_UNIX, chset);
-       case CH_DISPLAY:
        case CH_DOS:
        case CH_UNIX:
                return strlen((const char *)var)+1;
index 03ba24936775eaa655ce77e759c2ab24f81678df..44852a6c52a1717b72f12a3980baa4feccb4ee1b 100644 (file)
@@ -8,7 +8,6 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
     '''
     if conf.CHECK_ICONV(define='HAVE_NATIVE_ICONV'):
         default_dos_charset=False
-        default_display_charset=False
         default_unix_charset=False
 
         # check for default dos charset name
@@ -17,12 +16,6 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
                 default_dos_charset=charset
                 break
 
-        # check for default display charset name
-        for charset in ['ASCII', '646']:
-            if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
-                default_display_charset=charset
-                break
-
         # check for default unix charset name
         for charset in ['UTF-8', 'UTF8']:
             if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
@@ -37,16 +30,13 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
        # match the results we get at runtime anyway.
        if crossbuild:
            default_dos_charset="CP850"
-           default_display_charset="ASCII"
            default_unix_charset="UTF-8"
             # TODO: this used to warn about the set charset on cross builds
 
         conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
-        conf.DEFINE('DEFAULT_DISPLAY_CHARSET', default_display_charset, quote=True)
         conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
 
     else:
         conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
-        conf.DEFINE('DEFAULT_DISPLAY_CHARSET', "ASCII", quote=True)
         conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)
 
index e8662da0e7cc871a4a6ed7bd1f434fbcefb395d4..e85d9f1f470129ff9dd58a79fa199b8932da325c 100644 (file)
@@ -2693,7 +2693,6 @@ for i in $ICONV_LOOK_DIRS ; do
         export LDFLAGS LIBS CPPFLAGS
 
        default_dos_charset=no
-       default_display_charset=no
        default_unix_charset=no
 
        # check for default dos charset name
@@ -2705,15 +2704,6 @@ for i in $ICONV_LOOK_DIRS ; do
            fi
        done
 
-       # check for default display charset name
-       for j in ASCII 646 ; do
-           rjs_CHARSET($j)
-           default_display_charset="$ICONV_CHARSET"
-           if test x"$default_display_charset" = x"$j"; then
-               break
-           fi
-       done
-
        # check for default unix charset name
        for j in UTF-8 UTF8 ; do
            rjs_CHARSET($j)
@@ -2725,15 +2715,12 @@ for i in $ICONV_LOOK_DIRS ; do
 
        if test "$default_dos_charset" != "no" -a \
                "$default_dos_charset" != "cross" -a \
-               "$default_display_charset" != "no" -a \
-               "$default_display_charset" != "cross" -a \
                "$default_unix_charset" != "no" -a \
                "$default_unix_charset" != "cross"
        then
                samba_cv_HAVE_NATIVE_ICONV=yes
        else
            if test "$default_dos_charset" = "cross" -o \
-                    "$default_display_charset" = "cross" -o \
                     "$default_unix_charset" = "cross"
            then
                    samba_cv_HAVE_NATIVE_ICONV=cross
@@ -2750,11 +2737,10 @@ for i in $ICONV_LOOK_DIRS ; do
        # match the results we get at runtime anyway.
        if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"cross" ; then
            default_dos_charset="CP850"
-           default_display_charset="ASCII"
            default_unix_charset="UTF-8"
            samba_cv_HAVE_NATIVE_ICONV=yes
            AC_MSG_WARN(assuming the libiconv in $iconv_current_LDFLAGS can convert)
-           AC_MSG_WARN([$default_dos_charset, $default_display_charset and $default_unix_charset to UCS-16LE])
+           AC_MSG_WARN([$default_dos_charset and $default_unix_charset to UCS-16LE])
        fi
 
         if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes" ; then
@@ -2773,12 +2759,10 @@ for i in $ICONV_LOOK_DIRS ; do
 
            # Turn the #defines into string literals
            default_dos_charset="\"$default_dos_charset\""
-           default_display_charset="\"$default_display_charset\""
            default_unix_charset="\"$default_unix_charset\""
 
            AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
            AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
-           AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
            AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
 
            break
@@ -2800,7 +2784,6 @@ if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; th
     AC_MSG_WARN([Sufficient support for iconv function was not found.
     Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!])
    AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,"ASCII",[Default dos charset name])
-   AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,"ASCII",[Default display charset name])
    AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,"UTF8",[Default unix charset name])
 fi
 
index ef8be4f98784cb12df0335ae99e61401ccb03c1c..31c75189fc12dd7497e6ca0de58c44688940a616 100644 (file)
@@ -1174,7 +1174,6 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m
 const char *lp_smb_ports(void);
 const char *lp_dos_charset(void);
 const char *lp_unix_charset(void);
-const char *lp_display_charset(void);
 char *lp_logfile(void);
 char *lp_configfile(void);
 const char *lp_smb_passwd_file(void);
index 1635373827771fc08edfc8c5bc5a68e2f3a20115..18fdc75834c9908b7c4b31dd4c1176e621809813 100644 (file)
@@ -130,7 +130,6 @@ struct global {
        char *smb_ports;
        char *dos_charset;
        char *unix_charset;
-       char *display_charset;
        char *szPrintcapname;
        char *szAddPortCommand;
        char *szEnumPortsCommand;
@@ -969,15 +968,6 @@ static struct parm_struct parm_table[] = {
                .enum_list      = NULL,
                .flags          = FLAG_ADVANCED
        },
-       {
-               .label          = "display charset",
-               .type           = P_STRING,
-               .p_class        = P_GLOBAL,
-               .ptr            = &Globals.display_charset,
-               .special        = handle_charset,
-               .enum_list      = NULL,
-               .flags          = FLAG_ADVANCED
-       },
        {
                .label          = "comment",
                .type           = P_STRING,
@@ -5186,14 +5176,6 @@ static void init_globals(bool reinit_globals)
        /* using UTF8 by default allows us to support all chars */
        string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
 
-#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
-       /* If the system supports nl_langinfo(), try to grab the value
-          from the user's locale */
-       string_set(&Globals.display_charset, "LOCALE");
-#else
-       string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
-#endif
-
        /* Use codepage 850 as a default for the dos character set */
        string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
 
@@ -5556,7 +5538,6 @@ static char *lp_string(const char *s)
 FN_GLOBAL_CONST_STRING(lp_smb_ports, smb_ports)
 FN_GLOBAL_CONST_STRING(lp_dos_charset, dos_charset)
 FN_GLOBAL_CONST_STRING(lp_unix_charset, unix_charset)
-FN_GLOBAL_CONST_STRING(lp_display_charset, display_charset)
 FN_GLOBAL_STRING(lp_logfile, szLogFile)
 FN_GLOBAL_STRING(lp_configfile, szConfigFile)
 FN_GLOBAL_CONST_STRING(lp_smb_passwd_file, szSMBPasswdFile)
@@ -7507,7 +7488,7 @@ bool lp_file_list_changed(void)
 static void init_iconv(void)
 {
        global_iconv_handle = smb_iconv_handle_reinit(NULL, lp_dos_charset(),
-                                                     lp_unix_charset(), lp_display_charset(),
+                                                     lp_unix_charset(),
                                                      true, global_iconv_handle);
 }
 
index 33e854d6e9ef64b6f03820f860157ae31eff3c09..e80f6f1844442ea703a0a2c9bda81e590544cf52 100644 (file)
@@ -41,7 +41,6 @@ static const struct loadparm_s3_context s3_fns =
 
        .dos_charset = lp_dos_charset,
        .unix_charset = lp_unix_charset,
-       .display_charset = lp_display_charset,
 
        .realm = lp_realm,
        .dnsdomain = lp_dnsdomain,
index 67a782ded02d35fb6dd22bbe369e25060255a605..4ad555626a4781853620d6b347b13b86ba5e08dd 100644 (file)
@@ -209,7 +209,6 @@ static struct parm_struct parm_table[] = {
        {"dos charset", P_STRING, P_GLOBAL, GLOBAL_VAR(dos_charset), NULL, NULL},
        {"unix charset", P_STRING, P_GLOBAL, GLOBAL_VAR(unix_charset), NULL, NULL},
        {"ncalrpc dir", P_STRING, P_GLOBAL, GLOBAL_VAR(ncalrpc_dir), NULL, NULL},
-       {"display charset", P_STRING, P_GLOBAL, GLOBAL_VAR(display_charset), NULL, NULL},
        {"comment", P_STRING, P_LOCAL, LOCAL_VAR(comment), NULL, NULL},
        {"path", P_STRING, P_LOCAL, LOCAL_VAR(szPath), NULL, NULL},
        {"directory", P_STRING, P_LOCAL, LOCAL_VAR(szPath), NULL, NULL},
@@ -572,7 +571,6 @@ FN_GLOBAL_STRING(lockdir, szLockDir)
 FN_GLOBAL_STRING(ncalrpc_dir, ncalrpc_dir)
 FN_GLOBAL_STRING(dos_charset, dos_charset)
 FN_GLOBAL_STRING(unix_charset, unix_charset)
-FN_GLOBAL_STRING(display_charset, display_charset)
 FN_GLOBAL_STRING(piddir, szPidDir)
 FN_GLOBAL_LIST(rndc_command, szRNDCCommand)
 FN_GLOBAL_LIST(dns_update_command, szDNSUpdateCommand)
index 139a8acc74f022932a6c3d41250f1ff0897a79b1..b1a7a571e65ea8c3230d25f9fa2597de4935724c 100644 (file)
@@ -296,7 +296,6 @@ struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
 {
        return smb_iconv_handle_reinit(mem_ctx, lpcfg_dos_charset(lp_ctx),
                                            lpcfg_unix_charset(lp_ctx),
-                                           lpcfg_display_charset(lp_ctx),
                                            lpcfg_parm_bool(lp_ctx, NULL, "iconv", "native", true),
                                            old_ic);
 }