r7901: check if system supports UTF-16LE at all in LOCAL-ICONV test
authorAndrew Tridgell <tridge@samba.org>
Sat, 25 Jun 2005 06:13:29 +0000 (06:13 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:47 +0000 (13:18 -0500)
(This used to be commit aa9e7cf63a0e5ce7c9b7d121a4df064cd6fae90f)

source4/torture/local/iconv.c

index e61d3348eb89e2d5465aab643792c5ff78670131..9aa678995b0ea4c84f9b4499f2056fc523488dd9 100644 (file)
@@ -315,8 +315,16 @@ BOOL torture_local_iconv(void)
        unsigned char inbuf[1000];
        int ok = 1;
        unsigned int codepoint, i, c;
+       static iconv_t cd;
+
+        srandom(time(NULL));
 
-       srandom(time(NULL));
+       cd = iconv_open("UTF-16LE", "UCS-4LE");
+       if (cd == (iconv_t)-1) {
+               printf("unable to test - system iconv library does not support UTF-16LE -> UCS-4LE\n");
+               return True;
+       }
+       iconv_close(cd);
 
        printf("Testing next_codepoint()\n");
        for (codepoint=0;ok && codepoint<(1<<20);codepoint++) {