Skip to content

Commit 61400e7

Browse files
committed
Avoid a test failure on Solaris 2.6 and HP-UX 11.00.
1 parent cb5f919 commit 61400e7

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2011-08-07 Bruno Haible <[email protected]>
2+
3+
Avoid a test failure on Solaris 2.6 and HP-UX 11.00.
4+
* tests/test-to-wchar.c (main): Skip the test if conversion to wchar_t
5+
is not supported.
6+
17
2011-08-07 Bruno Haible <[email protected]>
28

39
* tests/check-subst: Add comments about OSF/1.

tests/test-to-wchar.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2009 Free Software Foundation, Inc.
1+
/* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
22
This file is part of the GNU LIBICONV Library.
33
44
The GNU LIBICONV Library is free software; you can redistribute it
@@ -29,19 +29,24 @@
2929
int main ()
3030
{
3131
iconv_t cd = iconv_open ("wchar_t", "UTF-8");
32-
char inbuf[2] = { 0xc2, 0xa0 };
33-
wchar_t outbuf[10];
34-
35-
char *inptr = inbuf;
36-
size_t inbytesleft = 1;
37-
char *outptr = (char *) outbuf;
38-
size_t outbytesleft = sizeof (outbuf);
39-
size_t r = iconv (cd,
40-
(ICONV_CONST char **) &inptr, &inbytesleft,
41-
&outptr, &outbytesleft);
42-
43-
if (!(r == (size_t)(-1) && errno == EINVAL))
44-
abort ();
32+
if (cd == (iconv_t)(-1)) {
33+
/* Skip the test on platforms without wchar_t
34+
(Solaris 2.6, HP-UX 11.00). */
35+
} else {
36+
char inbuf[2] = { 0xc2, 0xa0 };
37+
wchar_t outbuf[10];
38+
39+
char *inptr = inbuf;
40+
size_t inbytesleft = 1;
41+
char *outptr = (char *) outbuf;
42+
size_t outbytesleft = sizeof (outbuf);
43+
size_t r = iconv (cd,
44+
(ICONV_CONST char **) &inptr, &inbytesleft,
45+
&outptr, &outbytesleft);
46+
47+
if (!(r == (size_t)(-1) && errno == EINVAL))
48+
abort ();
49+
}
4550

4651
return 0;
4752
}

0 commit comments

Comments
 (0)