| 1034 |
int ret; |
int ret; |
| 1035 |
int in_control = 0; |
int in_control = 0; |
| 1036 |
size_t i = 0; |
size_t i = 0; |
| 1037 |
|
int skip_current = 0; |
| 1038 |
|
|
| 1039 |
if (cd == NULL || p_buf == NULL || p_buf_len == NULL || p_buf_offset == NULL || p_conv == NULL || p_conv_len == NULL) |
if (cd == NULL || p_buf == NULL || p_buf_len == NULL || p_buf_offset == NULL || p_conv == NULL || p_conv_len == NULL) |
| 1040 |
{ |
{ |
| 1058 |
} |
} |
| 1059 |
} |
} |
| 1060 |
|
|
| 1061 |
if (in_control) |
if (in_control || skip_current) |
| 1062 |
{ |
{ |
| 1063 |
|
skip_current = 0; |
| 1064 |
|
|
| 1065 |
if (out_bytes <= 0) |
if (out_bytes <= 0) |
| 1066 |
{ |
{ |
| 1067 |
log_error("No enough free space in p_conv, conv_len=%d, conv_size=%d\n", *p_conv_len, conv_size); |
log_error("No enough free space in p_conv, conv_len=%d, conv_size=%d\n", *p_conv_len, conv_size); |
| 1075 |
out_bytes--; |
out_bytes--; |
| 1076 |
|
|
| 1077 |
(*p_buf_offset)++; |
(*p_buf_offset)++; |
| 1078 |
*p_conv_len = (int)(conv_size - out_bytes); |
(*p_conv_len)++; |
| 1079 |
|
|
| 1080 |
i++; |
i++; |
| 1081 |
if (i >= 2) |
if (i >= 2) |
| 1095 |
#endif |
#endif |
| 1096 |
if (p_buf != in_buf) |
if (p_buf != in_buf) |
| 1097 |
{ |
{ |
| 1098 |
*p_buf_len = (int)(p_buf + *p_buf_len - in_buf); |
*p_buf_len -= (int)(in_buf - p_buf); |
| 1099 |
*p_buf_offset = 0; |
*p_buf_offset = 0; |
| 1100 |
*p_conv_len = (int)(conv_size - out_bytes); |
*p_conv_len = (int)(conv_size - out_bytes); |
| 1101 |
memmove(p_buf, in_buf, (size_t)(*p_buf_len)); |
memmove(p_buf, in_buf, (size_t)(*p_buf_len)); |
| 1128 |
in_bytes--; |
in_bytes--; |
| 1129 |
out_bytes--; |
out_bytes--; |
| 1130 |
|
|
| 1131 |
|
(*p_buf_offset)++; |
| 1132 |
|
(*p_conv_len)++; |
| 1133 |
|
|
| 1134 |
|
continue; |
| 1135 |
|
} |
| 1136 |
|
else // something strange |
| 1137 |
|
{ |
| 1138 |
|
#ifdef _DEBUG |
| 1139 |
|
log_error("*p_buf_offset += %d, *p_conv_len = %d, in_bytes=%d, out_bytes=%d, in_buf[0]=%d\n", |
| 1140 |
|
(int)(in_buf - p_buf), (int)(conv_size - out_bytes), in_bytes, out_bytes, in_buf[0]); |
| 1141 |
|
#endif |
| 1142 |
|
|
| 1143 |
|
*p_buf_offset += (int)(in_buf - p_buf); |
| 1144 |
|
*p_conv_len = (int)(conv_size - out_bytes); |
| 1145 |
|
skip_current = 1; |
| 1146 |
|
|
| 1147 |
continue; |
continue; |
| 1148 |
} |
} |
| 1149 |
} |
} |
| 1157 |
} |
} |
| 1158 |
} |
} |
| 1159 |
|
|
| 1160 |
|
if (*p_buf_offset >= *p_buf_len) |
| 1161 |
|
{ |
| 1162 |
|
*p_buf_len = 0; |
| 1163 |
|
*p_buf_offset = 0; |
| 1164 |
|
} |
| 1165 |
|
|
| 1166 |
return 0; |
return 0; |
| 1167 |
} |
} |
| 1168 |
|
|