Deleted Added
full compact
charset.c (172468) charset.c (172597)
1/*
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.

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

663 */
664 public LWCHAR
665step_char(pp, dir, limit)
666 char **pp;
667 signed int dir;
668 char *limit;
669{
670 LWCHAR ch;
1/*
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.

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

663 */
664 public LWCHAR
665step_char(pp, dir, limit)
666 char **pp;
667 signed int dir;
668 char *limit;
669{
670 LWCHAR ch;
671 int len;
671 char *p = *pp;
672
673 if (!utf_mode)
674 {
675 /* It's easy if chars are one byte. */
676 if (dir > 0)
677 ch = (LWCHAR) ((p < limit) ? *p++ : 0);
678 else
679 ch = (LWCHAR) ((p > limit) ? *--p : 0);
680 } else if (dir > 0)
681 {
672 char *p = *pp;
673
674 if (!utf_mode)
675 {
676 /* It's easy if chars are one byte. */
677 if (dir > 0)
678 ch = (LWCHAR) ((p < limit) ? *p++ : 0);
679 else
680 ch = (LWCHAR) ((p > limit) ? *--p : 0);
681 } else if (dir > 0)
682 {
682 if (p + utf_len(*p) > limit)
683 len = utf_len(*p);
684 if (p + len > limit)
685 {
683 ch = 0;
686 ch = 0;
684 else
687 p = limit;
688 } else
685 {
686 ch = get_wchar(p);
689 {
690 ch = get_wchar(p);
687 p++;
688 while (IS_UTF8_TRAIL(*p))
689 p++;
691 p += len;
690 }
691 } else
692 {
693 while (p > limit && IS_UTF8_TRAIL(p[-1]))
694 p--;
695 if (p > limit)
696 ch = get_wchar(--p);
697 else

--- 468 unchanged lines hidden ---
692 }
693 } else
694 {
695 while (p > limit && IS_UTF8_TRAIL(p[-1]))
696 p--;
697 if (p > limit)
698 ch = get_wchar(--p);
699 else

--- 468 unchanged lines hidden ---