AElfred Bug and Patch
David Megginson
ak117 at freenet.carleton.ca
Tue Mar 10 12:23:17 GMT 1998
I have received a bug report for AElfred 1.1 (and earlier versions)
concerning the treatment of signed bytes in UCS-2/UTF-16 and UCS-4
encoded text. I will put out a maintenance version 1.1.1 in a few
days, once other people have had time to report any additional bugs;
in the mean time, since the patch is tiny (1,529 characters), I am
including here for anyone who needs UCS-2/UTF-16 or UCS-4 right away.
Thanks to Yoshida Masato for the bug report.
====================8<====================8<====================
*** XmlParser.java 1998/03/09 11:51:40 2.3
--- XmlParser.java 1998/03/10 12:13:53
***************
*** 3961,3968 ****
encodingError("odd number of bytes in UCS-2 encoding", -1, count);
}
for (int i = 0; i < count; i+=2) {
! readBuffer[j++] = (char)((rawReadBuffer[i] << shift1) |
! (rawReadBuffer[i+1] << shift2));
if (readBuffer[j-1] == '\r') {
sawCR = true;
}
--- 3961,3969 ----
encodingError("odd number of bytes in UCS-2 encoding", -1, count);
}
for (int i = 0; i < count; i+=2) {
! readBuffer[j++] =
! (char)(((rawReadBuffer[i] & 0xff) << shift1) |
! ((rawReadBuffer[i+1] & 0xff) << shift2));
if (readBuffer[j-1] == '\r') {
sawCR = true;
}
***************
*** 3999,4008 ****
-1, count);
}
for (int i = 0; i < count; i+=4) {
! value = ((rawReadBuffer[i] << shift1) |
! (rawReadBuffer[i+1] << shift2) |
! (rawReadBuffer[i+2] << shift3) |
! (rawReadBuffer[i+3] << shift4));
if (value < 0x0000ffff) {
readBuffer[j++] = (char)value;
if (value == (int)'\r') {
--- 4000,4009 ----
-1, count);
}
for (int i = 0; i < count; i+=4) {
! value = (((rawReadBuffer[i] & 0xff) << shift1) |
! ((rawReadBuffer[i+1] & 0xff) << shift2) |
! ((rawReadBuffer[i+2] & 0xff) << shift3) |
! ((rawReadBuffer[i+3] & 0xff) << shift4));
if (value < 0x0000ffff) {
readBuffer[j++] = (char)value;
if (value == (int)'\r') {
====================8<====================8<====================
All the best,
David
--
David Megginson ak117 at freenet.carleton.ca
Microstar Software Ltd. dmeggins at microstar.com
http://home.sprynet.com/sprynet/dmeggins/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list