Deleted Added
full compact
mbutil.c (119610) mbutil.c (125759)
1/* mbutil.c -- readline multibyte character utility functions */
2
3/* Copyright (C) 2001 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it

--- 191 unchanged lines hidden (view full) ---

200 mbstate_t *ps;
201{
202 size_t tmp;
203
204 tmp = mbrlen((const char *)src, (size_t)strlen (src), ps);
205 if (tmp == (size_t)(-2))
206 {
207 /* shorted to compose multibyte char */
1/* mbutil.c -- readline multibyte character utility functions */
2
3/* Copyright (C) 2001 Free Software Foundation, Inc.
4
5 This file is part of the GNU Readline Library, a library for
6 reading lines of text with interactive input and history editing.
7
8 The GNU Readline Library is free software; you can redistribute it

--- 191 unchanged lines hidden (view full) ---

200 mbstate_t *ps;
201{
202 size_t tmp;
203
204 tmp = mbrlen((const char *)src, (size_t)strlen (src), ps);
205 if (tmp == (size_t)(-2))
206 {
207 /* shorted to compose multibyte char */
208 memset (ps, 0, sizeof(mbstate_t));
208 if (ps)
209 memset (ps, 0, sizeof(mbstate_t));
209 return -2;
210 }
211 else if (tmp == (size_t)(-1))
212 {
213 /* invalid to compose multibyte char */
214 /* initialize the conversion state */
210 return -2;
211 }
212 else if (tmp == (size_t)(-1))
213 {
214 /* invalid to compose multibyte char */
215 /* initialize the conversion state */
215 memset (ps, 0, sizeof(mbstate_t));
216 if (ps)
217 memset (ps, 0, sizeof(mbstate_t));
216 return -1;
217 }
218 else if (tmp == (size_t)0)
219 return 0;
220 else
221 return (int)tmp;
222}
223
224/* compare the specified two characters. If the characters matched,
225 return 1. Otherwise return 0. */
226int
227_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
218 return -1;
219 }
220 else if (tmp == (size_t)0)
221 return 0;
222 else
223 return (int)tmp;
224}
225
226/* compare the specified two characters. If the characters matched,
227 return 1. Otherwise return 0. */
228int
229_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
228 char *buf1, *buf2;
229 mbstate_t *ps1, *ps2;
230 int pos1, pos2;
230 char *buf1;
231 int pos1;
232 mbstate_t *ps1;
233 char *buf2;
234 int pos2;
235 mbstate_t *ps2;
231{
232 int i, w1, w2;
233
234 if ((w1 = _rl_get_char_len (&buf1[pos1], ps1)) <= 0 ||
235 (w2 = _rl_get_char_len (&buf2[pos2], ps2)) <= 0 ||
236 (w1 != w2) ||
237 (buf1[pos1] != buf2[pos2]))
238 return 0;

--- 32 unchanged lines hidden (view full) ---

271 if((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2)
272 {
273 /* in this case, bytes are invalid or shorted to compose
274 multibyte char, so assume that the first byte represents
275 a single character anyway. */
276 pos++;
277 /* clear the state of the byte sequence, because
278 in this case effect of mbstate is undefined */
236{
237 int i, w1, w2;
238
239 if ((w1 = _rl_get_char_len (&buf1[pos1], ps1)) <= 0 ||
240 (w2 = _rl_get_char_len (&buf2[pos2], ps2)) <= 0 ||
241 (w1 != w2) ||
242 (buf1[pos1] != buf2[pos2]))
243 return 0;

--- 32 unchanged lines hidden (view full) ---

276 if((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2)
277 {
278 /* in this case, bytes are invalid or shorted to compose
279 multibyte char, so assume that the first byte represents
280 a single character anyway. */
281 pos++;
282 /* clear the state of the byte sequence, because
283 in this case effect of mbstate is undefined */
279 memset (ps, 0, sizeof (mbstate_t));
284 if (ps)
285 memset (ps, 0, sizeof (mbstate_t));
280 }
286 }
287 else if (tmp == 0)
288 pos++;
281 else
282 pos += tmp;
283 }
284
285 return (pos - point);
286}
287
288int

--- 49 unchanged lines hidden ---
289 else
290 pos += tmp;
291 }
292
293 return (pos - point);
294}
295
296int

--- 49 unchanged lines hidden ---