#include "win_iconv.c"
#include <stdio.h>
Go to the source code of this file.
|
#define | STATIC_STRLEN(arr) (sizeof(arr) - 1) |
|
#define | success(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), 0, BUFSIZ, __LINE__) |
|
#define | einval(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EINVAL, BUFSIZ, __LINE__) |
|
#define | eilseq(from, fromstr, to, tostr) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EILSEQ, BUFSIZ, __LINE__) |
|
#define | e2big(from, fromstr, to, tostr, bufsize) test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), E2BIG, bufsize, __LINE__) |
|
|
const char * | tohex (const char *str, int size) |
|
const char * | errstr (int errcode) |
|
int | check_enc (const char *encname, int codepage) |
|
void | test (const char *from, const char *fromstr, int fromsize, const char *to, const char *tostr, int tosize, int errcode, int bufsize, int line) |
|
int | main (int argc, char **argv) |
|
◆ e2big
#define e2big |
( |
|
from, |
|
|
|
fromstr, |
|
|
|
to, |
|
|
|
tostr, |
|
|
|
bufsize |
|
) |
| test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), E2BIG, bufsize, __LINE__) |
◆ eilseq
#define eilseq |
( |
|
from, |
|
|
|
fromstr, |
|
|
|
to, |
|
|
|
tostr |
|
) |
| test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EILSEQ, BUFSIZ, __LINE__) |
◆ einval
#define einval |
( |
|
from, |
|
|
|
fromstr, |
|
|
|
to, |
|
|
|
tostr |
|
) |
| test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), EINVAL, BUFSIZ, __LINE__) |
◆ STATIC_STRLEN
◆ success
#define success |
( |
|
from, |
|
|
|
fromstr, |
|
|
|
to, |
|
|
|
tostr |
|
) |
| test(from, fromstr, STATIC_STRLEN(fromstr), to, tostr, STATIC_STRLEN(tostr), 0, BUFSIZ, __LINE__) |
◆ check_enc()
Definition at line 67 of file win_iconv_test.c.
74 printf(
"%s(%d) IS NOT SUPPORTED: SKIP THE TEST\n", encname,
codepage);
81 printf(
"%s(%d) ALIAS IS MAPPED TO DIFFERENT CODEPAGE (%d)\n", encname,
codepage,
cp);
iconv_t iconv_open(const char *tocode, const char *fromcode)
int iconv_close(iconv_t cd)
Referenced by main().
◆ errstr()
Definition at line 27 of file win_iconv_test.c.
32 case 0:
return "NOERROR";
33 case EINVAL:
return "EINVAL";
34 case EILSEQ:
return "EILSEQ";
35 case E2BIG:
return "E2BIG";
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
Referenced by csp_hostaddr(), error(), gl_error(), pagesetup_common(), test(), test_FunnyChars(), test_setdir(), test_ValidPathA(), and warning().
◆ main()
Definition at line 164 of file win_iconv_test.c.
166 #ifdef USE_LIBICONV_DLL 170 success(
"ascii",
"ABC",
"ascii",
"ABC");
171 success(
"ascii",
"ABC",
"utf-16be",
"\x00\x41\x00\x42\x00\x43");
175 printf(
"\nDLL TEST IS SKIPPED\n\n");
183 success(
"ascii",
"ABC",
"ascii",
"ABC");
185 success(
"ascii",
"\x80\xFF",
"ascii",
"\x00\x7F");
197 success(
"utf-16",
"\xFE\xFF\x01\x02",
"utf-16be",
"\x01\x02");
198 success(
"utf-16",
"\xFF\xFE\x02\x01",
"utf-16be",
"\x01\x02");
199 success(
"utf-32",
"\x00\x00\xFE\xFF\x00\x00\x01\x02",
"utf-32be",
"\x00\x00\x01\x02");
200 success(
"utf-32",
"\xFF\xFE\x00\x00\x02\x01\x00\x00",
"utf-32be",
"\x00\x00\x01\x02");
201 success(
"utf-16",
"\xFE\xFF\x00\x01",
"utf-8",
"\x01");
202 #ifndef GLIB_COMPILATION 203 success(
"utf-8",
"\x01",
"utf-16",
"\xFE\xFF\x00\x01");
204 success(
"utf-8",
"\x01",
"utf-32",
"\x00\x00\xFE\xFF\x00\x00\x00\x01");
206 success(
"utf-8",
"\x01",
"utf-16",
"\xFF\xFE\x01\x00");
207 success(
"utf-8",
"\x01",
"utf-32",
"\xFF\xFE\x00\x00\x01\x00\x00\x00");
210 success(
"utf-16be",
"\xFE\xFF\x01\x02",
"utf-16be",
"\xFE\xFF\x01\x02");
211 success(
"utf-16le",
"\xFF\xFE\x02\x01",
"utf-16be",
"\xFE\xFF\x01\x02");
212 success(
"utf-32be",
"\x00\x00\xFE\xFF\x00\x00\x01\x02",
"utf-32be",
"\x00\x00\xFE\xFF\x00\x00\x01\x02");
213 success(
"utf-32le",
"\xFF\xFE\x00\x00\x02\x01\x00\x00",
"utf-32be",
"\x00\x00\xFE\xFF\x00\x00\x01\x02");
214 success(
"utf-16be",
"\xFE\xFF\x00\x01",
"utf-8",
"\xEF\xBB\xBF\x01");
215 success(
"utf-8",
"\xEF\xBB\xBF\x01",
"utf-8",
"\xEF\xBB\xBF\x01");
217 success(
"utf-16be",
"\x01\x02",
"utf-16le",
"\x02\x01");
218 success(
"utf-16le",
"\x02\x01",
"utf-16be",
"\x01\x02");
219 success(
"utf-16be",
"\xFE\xFF",
"utf-16le",
"\xFF\xFE");
220 success(
"utf-16le",
"\xFF\xFE",
"utf-16be",
"\xFE\xFF");
221 success(
"utf-32be",
"\x00\x00\x03\x04",
"utf-32le",
"\x04\x03\x00\x00");
222 success(
"utf-32le",
"\x04\x03\x00\x00",
"utf-32be",
"\x00\x00\x03\x04");
223 success(
"utf-32be",
"\x00\x00\xFF\xFF",
"utf-16be",
"\xFF\xFF");
224 success(
"utf-16be",
"\xFF\xFF",
"utf-32be",
"\x00\x00\xFF\xFF");
225 success(
"utf-32be",
"\x00\x01\x00\x00",
"utf-16be",
"\xD8\x00\xDC\x00");
226 success(
"utf-16be",
"\xD8\x00\xDC\x00",
"utf-32be",
"\x00\x01\x00\x00");
227 success(
"utf-32be",
"\x00\x10\xFF\xFF",
"utf-16be",
"\xDB\xFF\xDF\xFF");
228 success(
"utf-16be",
"\xDB\xFF\xDF\xFF",
"utf-32be",
"\x00\x10\xFF\xFF");
229 eilseq(
"utf-32be",
"\x00\x11\x00\x00",
"utf-16be",
"");
230 eilseq(
"utf-16be",
"\xDB\xFF\xE0\x00",
"utf-32be",
"");
231 success(
"utf-8",
"\xE3\x81\x82",
"utf-16be",
"\x30\x42");
232 einval(
"utf-8",
"\xE3",
"utf-16be",
"");
243 success(
"utf-16be",
"\xFF\x5E",
"cp932",
"\x81\x60");
244 success(
"utf-16be",
"\x30\x1C",
"cp932",
"\x81\x60");
245 success(
"utf-16be",
"\xFF\x5E",
"cp932//nocompat",
"\x81\x60");
246 eilseq(
"utf-16be",
"\x30\x1C",
"cp932//nocompat",
"");
247 success(
"euc-jp",
"\xA4\xA2",
"utf-16be",
"\x30\x42");
248 einval(
"euc-jp",
"\xA4\xA2\xA4",
"utf-16be",
"\x30\x42");
249 eilseq(
"euc-jp",
"\xA4\xA2\xFF\xFF",
"utf-16be",
"\x30\x42");
250 success(
"cp932",
"\x81\x60",
"iso-2022-jp",
"\x1B\x24\x42\x21\x41\x1B\x28\x42");
251 success(
"UTF-16BE",
"\xFF\x5E",
"iso-2022-jp",
"\x1B\x24\x42\x21\x41\x1B\x28\x42");
252 eilseq(
"UTF-16BE",
"\x30\x1C",
"iso-2022-jp//nocompat",
"");
253 success(
"UTF-16BE",
"\x30\x42\x30\x44",
"iso-2022-jp",
"\x1B\x24\x42\x24\x22\x24\x24\x1B\x28\x42");
254 success(
"iso-2022-jp",
"\x1B\x24\x42\x21\x41\x1B\x28\x42",
"UTF-16BE",
"\xFF\x5E");
261 eilseq(
"UTF-16BE",
"\xFF\x41",
"iso-8859-1",
"");
262 success(
"UTF-16BE",
"\xFF\x41",
"iso-8859-1//translit",
"a");
268 eilseq(
"UTF-16BE",
"\x30\x42",
"ascii",
"");
269 success(
"UTF-16BE",
"\x30\x42",
"ascii//translit",
"?");
274 eilseq(
"UTF-8",
"\xFF A \xFF B",
"ascii//ignore",
" A B");
275 eilseq(
"UTF-8",
"\xEF\xBC\xA1 A \xEF\xBC\xA2 B",
"ascii//ignore",
" A B");
276 eilseq(
"UTF-8",
"\xEF\x01 A \xEF\x02 B",
"ascii//ignore",
"\x01 A \x02 B");
int check_enc(const char *encname, int codepage)
#define einval(from, fromstr, to, tostr)
#define success(from, fromstr, to, tostr)
#define eilseq(from, fromstr, to, tostr)
◆ test()
Definition at line 90 of file win_iconv_test.c.
99 #ifdef USE_LIBICONV_DLL 106 printf(
"%s -> %s: NG: INVALID ENCODING NAME: line=%d\n",
from, to,
line);
110 #ifdef USE_LIBICONV_DLL 128 pin = (
char *)fromstr;
130 inbytesleft = fromsize;
132 r =
iconv(
cd, &
pin, &inbytesleft, &pout, &outbytesleft);
133 if (
r != (
size_t)(-1))
137 #ifdef USE_LIBICONV_DLL 149 printf(
"RESULT(%s:%s): ",
tohex(outbuf,
sizeof(outbuf) - outbytesleft),
GLdouble GLdouble GLdouble r
GLenum GLuint GLsizei bufsize
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
iconv_t iconv_open(const char *tocode, const char *fromcode)
int strcmp(const char *String1, const char *String2)
const char * tohex(const char *str, int size)
const char * errstr(int errcode)
◆ tohex()
Definition at line 15 of file win_iconv_test.c.
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by test().