- Fixed variable shadowing in egf-speedup patch.

This commit is contained in:
Tim Waugh 2005-01-07 14:50:45 +00:00
parent 55f2675e4e
commit b077d63419
2 changed files with 16 additions and 15 deletions

View File

@ -164,8 +164,8 @@
+ bytes_left = offset;
+ while (bytes_left)
+ {
+ size_t len = mbrlen (beg, bytes_left, &mbs);
+ if (len == (size_t) -1 || len == 0)
+ size_t mlen = mbrlen (beg, bytes_left, &mbs);
+ if (mlen == (size_t) -1 || mlen == 0)
+ {
+ /* Incomplete character: treat as single-byte. */
+ memset (&mbs, '\0', sizeof (mbstate_t));
@ -174,13 +174,13 @@
+ continue;
+ }
+
+ if (len == (size_t) -2)
+ if (mlen == (size_t) -2)
+ /* Offset points inside multibyte character:
+ * no good. */
+ break;
+
+ beg += len;
+ bytes_left -= len;
+ beg += mlen;
+ bytes_left -= mlen;
+ }
+ }
+ else
@ -224,8 +224,8 @@
+ bytes_left = offset;
+ while (bytes_left)
+ {
+ size_t len = mbrlen (beg, bytes_left, &mbs);
+ if (len == (size_t) -1 || len == 0)
+ size_t mlen = mbrlen (beg, bytes_left, &mbs);
+ if (mlen == (size_t) -1 || mlen == 0)
+ {
+ /* Incomplete character: treat as single-byte. */
+ memset (&mbs, '\0', sizeof (mbstate_t));
@ -234,13 +234,13 @@
+ continue;
+ }
+
+ if (len == (size_t) -2)
+ if (mlen == (size_t) -2)
+ /* Offset points inside multibyte character:
+ * no good. */
+ break;
+
+ beg += len;
+ bytes_left -= len;
+ beg += mlen;
+ bytes_left -= mlen;
+ }
+ }
+ else
@ -781,16 +781,16 @@
+ end = beg + len;
+ while (end < buf + size)
+ {
+ size_t len = mbrlen (end, buf + size - end, &mbs);
+ if (len == (size_t) -1 || len == (size_t) -2 || len == 0)
+ size_t mlen = mbrlen (end, buf + size - end, &mbs);
+ if (mlen == (size_t) -1 || mlen == (size_t) -2 || mlen == 0)
+ {
+ memset (&mbs, '\0', sizeof (mbstate_t));
+ len = 1;
+ mlen = 1;
+ }
+ if (len == 1 && *end == eol)
+ if (mlen == 1 && *end == eol)
+ break;
+
+ end += len;
+ end += mlen;
+ }
}
+ else

View File

@ -91,6 +91,7 @@ fi
%changelog
* Fri Jan 7 2005 Tim Waugh <twaugh@redhat.com>
- Fixed variable shadowing in egf-speedup patch.
- Removed redundant (and incorrect) code in prline.
* Fri Jan 7 2005 Tim Waugh <twaugh@redhat.com> 2.5.1-46