[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs charset.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs charset.c |
Date: |
Sat, 11 Jan 2014 18:58:08 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 14/01/11 18:58:08
Modified files:
. : charset.c
Log message:
fix charset bugs, caused infinite loop in usc4
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/charset.c?cvsroot=qemacs&r1=1.27&r2=1.28
Patches:
Index: charset.c
===================================================================
RCS file: /sources/qemacs/qemacs/charset.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- charset.c 6 Jan 2014 09:40:20 -0000 1.27
+++ charset.c 11 Jan 2014 18:58:08 -0000 1.28
@@ -426,8 +426,8 @@
u.c[s->charset == &charset_ucs2be] = s->charset->eol_char;
nl = u.n;
- for (; p < p1; p++) {
- if (*p == nl) {
+ while (p < p1) {
+ if (*p++ == nl) {
lp = p;
line++;
}
@@ -450,7 +450,7 @@
u.c[charset == &charset_ucs2be] = charset->eol_char;
nl = u.n;
- while (nlines > 0) {
+ while (nlines > 0 && p < p1) {
while (p < p1) {
if (*p++ == nl) {
lp = p;
@@ -548,8 +548,8 @@
u.c[(s->charset == &charset_ucs4be) * 3] = s->charset->eol_char;
nl = u.n;
- for (; p < p1; p++) {
- if (*p == nl) {
+ while (p < p1) {
+ if (*p++ == nl) {
lp = p;
line++;
}
@@ -569,10 +569,10 @@
lp = p = (const uint32_t *)buf;
p1 = p + (size >> 2);
u.n = 0;
- u.c[(charset == &charset_ucs2be) * 3] = charset->eol_char;
+ u.c[(charset == &charset_ucs4be) * 3] = charset->eol_char;
nl = u.n;
- while (nlines > 0) {
+ while (nlines > 0 && p < p1) {
while (p < p1) {
if (*p++ == nl) {
lp = p;