| 170 |
if (ret < 0) |
if (ret < 0) |
| 171 |
{ |
{ |
| 172 |
log_error("io_buf_conv(stdout, %d, %d, %d) error\n", stdout_buf_len, stdout_buf_offset, stdout_conv_len); |
log_error("io_buf_conv(stdout, %d, %d, %d) error\n", stdout_buf_len, stdout_buf_offset, stdout_conv_len); |
| 173 |
|
stdout_buf_len = stdout_buf_offset; // Discard invalid sequence |
| 174 |
} |
} |
| 175 |
} |
} |
| 176 |
|
|
| 400 |
if (ret < 0) |
if (ret < 0) |
| 401 |
{ |
{ |
| 402 |
log_error("io_buf_conv(stdin, %d, %d, %d) error\n", stdin_buf_len, stdin_buf_offset, stdin_conv_len); |
log_error("io_buf_conv(stdin, %d, %d, %d) error\n", stdin_buf_len, stdin_buf_offset, stdin_conv_len); |
| 403 |
|
stdin_buf_len = stdin_buf_offset; // Discard invalid sequence |
| 404 |
} |
} |
| 405 |
|
|
| 406 |
// For debug |
// For debug |
| 938 |
{ |
{ |
| 939 |
if (out_bytes <= 0) |
if (out_bytes <= 0) |
| 940 |
{ |
{ |
| 941 |
log_error("iconv(inbytes=%d, outbytes=%d) error: EILSEQ and E2BIG\n", in_bytes, out_bytes); |
log_error("No enough free space in p_conv, conv_len=%d, conv_size=%d\n", *p_conv_len, conv_size); |
| 942 |
return -2; |
return -2; |
| 943 |
} |
} |
| 944 |
|
|
| 1033 |
strncpy(stdio_charset, charset, sizeof(stdio_charset) - 1); |
strncpy(stdio_charset, charset, sizeof(stdio_charset) - 1); |
| 1034 |
stdio_charset[sizeof(stdio_charset) - 1] = '\0'; |
stdio_charset[sizeof(stdio_charset) - 1] = '\0'; |
| 1035 |
|
|
| 1036 |
stdin_cd = iconv_open(BBS_DEFAULT_CHARSET "//IGNORE", stdio_charset); |
snprintf(tocode, sizeof(tocode), "%s%s", BBS_DEFAULT_CHARSET, |
| 1037 |
|
(strcasecmp(stdio_charset, BBS_DEFAULT_CHARSET) == 0 ? "" : "//IGNORE")); |
| 1038 |
|
stdin_cd = iconv_open(tocode, stdio_charset); |
| 1039 |
if (stdin_cd == (iconv_t)(-1)) |
if (stdin_cd == (iconv_t)(-1)) |
| 1040 |
{ |
{ |
| 1041 |
log_error("iconv_open(%s->%s) error: %d\n", stdio_charset, BBS_DEFAULT_CHARSET "//IGNORE", errno); |
log_error("iconv_open(%s->%s) error: %d\n", stdio_charset, tocode, errno); |
| 1042 |
return -2; |
return -2; |
| 1043 |
} |
} |
| 1044 |
|
|
| 1045 |
snprintf(tocode, sizeof(tocode), "%s//TRANSLIT", stdio_charset); |
snprintf(tocode, sizeof(tocode), "%s%s", stdio_charset, |
| 1046 |
|
(strcasecmp(BBS_DEFAULT_CHARSET, stdio_charset) == 0 ? "" : "//TRANSLIT")); |
| 1047 |
stdout_cd = iconv_open(tocode, BBS_DEFAULT_CHARSET); |
stdout_cd = iconv_open(tocode, BBS_DEFAULT_CHARSET); |
| 1048 |
if (stdout_cd == (iconv_t)(-1)) |
if (stdout_cd == (iconv_t)(-1)) |
| 1049 |
{ |
{ |