Rev 4184 | Rev 4200 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4184 | Rev 4199 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | * of string |
82 | * of string |
83 | */ |
83 | */ |
84 | index_t index = 0; |
84 | index_t index = 0; |
85 | 85 | ||
86 | while (index < size) { |
86 | while (index < size) { |
87 | wchar_t uc = utf8_decode(str, &index, size - 1); |
87 | wchar_t uc = utf8_decode(str, &index, size); |
88 | 88 | ||
89 | if (!utf8_encode(uc, data->dst, &data->len, data->size - 2)) |
89 | if (!utf8_encode(uc, data->dst, &data->len, data->size - 1)) |
90 | break; |
90 | break; |
91 | - | ||
92 | data->len++; |
- | |
93 | index++; |
- | |
94 | } |
91 | } |
95 | 92 | ||
96 | /* Put trailing zero at end, but not count it |
93 | /* Put trailing zero at end, but not count it |
97 | * into data->len so it could be rewritten next time |
94 | * into data->len so it could be rewritten next time |
98 | */ |
95 | */ |
Line 147... | Line 144... | ||
147 | data->dst[data->size - 1] = 0; |
144 | data->dst[data->size - 1] = 0; |
148 | data->len = data->size; |
145 | data->len = data->size; |
149 | return ((int) size); |
146 | return ((int) size); |
150 | } |
147 | } |
151 | 148 | ||
152 | if (!utf8_encode(str[index], data->dst, &data->len, data->size - 2)) |
149 | if (!utf8_encode(str[index], data->dst, &data->len, data->size - 1)) |
153 | break; |
150 | break; |
154 | 151 | ||
155 | data->len++; |
- | |
156 | index++; |
152 | index++; |
157 | } |
153 | } |
158 | 154 | ||
159 | /* Put trailing zero at end, but not count it |
155 | /* Put trailing zero at end, but not count it |
160 | * into data->len so it could be rewritten next time |
156 | * into data->len so it could be rewritten next time |