version 1.1, 2012/02/21 22:57:48
|
version 1.1.1.2, 2012/05/29 09:29:43
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (C) 2000-2002, 2005-2006, 2008 Free Software Foundation, Inc. | * Copyright (C) 2000-2002, 2005-2006, 2008-2009, 2011 Free Software Foundation, Inc. |
* This file is part of the GNU LIBICONV Library. |
* This file is part of the GNU LIBICONV Library. |
* |
* |
* The GNU LIBICONV Library is free software; you can redistribute it |
* The GNU LIBICONV Library is free software; you can redistribute it |
Line 25
|
Line 25
|
*/ |
*/ |
|
|
#if HAVE_WCRTOMB || HAVE_MBRTOWC |
#if HAVE_WCRTOMB || HAVE_MBRTOWC |
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before |
|
<wchar.h>. |
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be |
|
included before <wchar.h>. |
|
In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined |
|
by <stddef.h>. */ |
|
# include <stddef.h> |
|
# include <stdio.h> |
|
# include <time.h> |
# include <wchar.h> |
# include <wchar.h> |
# define BUF_SIZE 64 /* assume MB_LEN_MAX <= 64 */ |
# define BUF_SIZE 64 /* assume MB_LEN_MAX <= 64 */ |
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ |
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ |
Line 321 static size_t wchar_to_loop_convert (iconv_t icd,
|
Line 330 static size_t wchar_to_loop_convert (iconv_t icd,
|
size_t result = 0; |
size_t result = 0; |
while (*inbytesleft > 0) { |
while (*inbytesleft > 0) { |
size_t incount; |
size_t incount; |
for (incount = 1; incount <= *inbytesleft; incount++) { | for (incount = 1; ; ) { |
| /* Here incount <= *inbytesleft. */ |
char buf[BUF_SIZE]; |
char buf[BUF_SIZE]; |
const char* inptr = *inbuf; |
const char* inptr = *inbuf; |
size_t inleft = incount; |
size_t inleft = incount; |
Line 402 static size_t wchar_to_loop_convert (iconv_t icd,
|
Line 412 static size_t wchar_to_loop_convert (iconv_t icd,
|
result += res; |
result += res; |
break; |
break; |
} |
} |
|
} |
|
incount++; |
|
if (incount > *inbytesleft) { |
|
/* Incomplete input. */ |
|
errno = EINVAL; |
|
return -1; |
} |
} |
} |
} |
} |
} |