1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 12:00:17 +02:00
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@831 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Nikolay Pultsin 2008-04-15 02:31:44 +00:00
parent 186daba22e
commit b850b035ca
3 changed files with 130 additions and 132 deletions

View file

@ -79,7 +79,7 @@ loop:
if (sourceIndex + 1 > compressedSize) {
break loop;
}
int N = 256 * token + sourceBuffer[sourceIndex++];
int N = 256 * (token & 0xFF) + (sourceBuffer[sourceIndex++] & 0xFF);
int copyLength = (N & 7) + 3;
if (targetIndex + copyLength > maxUncompressedSize) {
break loop;

View file

@ -65,7 +65,6 @@ public class PluckerBookReader extends BookReader {
myFont = FontType.FT_REGULAR;
myCharBuffer = new char[65535];
myForcedEntry = null;
}
public boolean readDocument() throws IOException {
@ -405,10 +404,8 @@ public class PluckerBookReader extends BookReader {
break;
case 0x83:
{
char[] utf8 = new char[4];
int len = 0;//ZLUnicodeUtil.ucs2ToUtf8(utf8, twoBytes(ptr, cur + 2));
safeBeginParagraph();
addData(new String(utf8).substring(len).toCharArray());
addData(new char[] { (char)twoBytes(ptr, cur + 2) });
myBufferIsEmpty = false;
myBytesToSkip = ptr[cur+1];
break;
@ -458,6 +455,7 @@ public class PluckerBookReader extends BookReader {
break;
}
}
private void changeFont(int font) {
if (myFont == font) {
return;
@ -561,7 +559,7 @@ public class PluckerBookReader extends BookReader {
this.mySecond = second;
}
}
//TODO
static private int twoBytes(char[] ptr, int offset) {
return 256 * ptr[offset] + ptr[offset+1];
}
@ -572,4 +570,4 @@ public class PluckerBookReader extends BookReader {
//ZLStringUtil.appendNumber(str, num);
return str;
}
};
}

View file

@ -42,15 +42,15 @@ public class PluckerPlugin extends PdbPlugin {
try {
PdbStream stream = new PluckerTextStream(file);
if (stream.open()) {
//detectEncodingAndLanguage(description, stream);
detectEncodingAndLanguage(description, stream);
stream.close();
}
} catch (IOException e) {
}
//if (description.getEncoding().length() == 0) {
// return false;
//}
if (description.getEncoding().length() == 0) {
return false;
}
return true;
}