Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public String getRawText(byte[] cipherKey) {
*/
public DataIndex getBlockIndex() {
int start = keyEnd + 1;
return new DataIndex(SwordUtil.decodeLittleEndian32(data, start), SwordUtil.decodeLittleEndian32(data, start + 4));
return new DataIndex(SwordUtil.decodeLittleEndian32(data, start) & 0xFFFFFFFFL, SwordUtil.decodeLittleEndian32(data, start + 4));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/crosswire/jsword/book/sword/DataIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public class DataIndex {
* @param size
* The number of bytes to read from the file.
*/
public DataIndex(int offset, int size) {
public DataIndex(long offset, int size) {
this.offset = offset;
this.size = size;
}

/**
* @return the offset
*/
public int getOffset() {
public long getOffset() {
return offset;
}

Expand All @@ -54,6 +54,6 @@ public int getSize() {
return size;
}

private int offset;
private long offset;
private int size;
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected DataIndex getIndex(RandomAccessFile raf, long entry) throws IOExceptio
return new DataIndex(0, 0);
}

int entryOffset = SwordUtil.decodeLittleEndian32(buffer, 0);
long entryOffset = SwordUtil.decodeLittleEndian32(buffer, 0) & 0xFFFFFFFFL;
int entrySize = -1;
switch (datasize) {
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public int getRawTextLength(Key key) {
protected DataIndex getIndex(RawLDBackendState state, long entry) throws IOException {
// Read the offset and size for this key from the index
byte[] buffer = SwordUtil.readRAF(state.getIdxRaf(), entry * entrysize, entrysize);
int entryOffset = SwordUtil.decodeLittleEndian32(buffer, 0);
long entryOffset = SwordUtil.decodeLittleEndian32(buffer, 0) & 0xFFFFFFFFL;
int entrySize = -1;
switch (datasize) {
case 2:
Expand Down Expand Up @@ -534,7 +534,7 @@ public void dumpIdxRaf() {
System.out.println("index\toffset\tsize\tkey\tvalue");
for (long i = 0; i < end; ++i) {
DataIndex index = getIndex(state, i);
int offset = index.getOffset();
long offset = index.getOffset();
int size = index.getSize();
buf.setLength(0);
buf.append(i);
Expand Down Expand Up @@ -585,7 +585,7 @@ public void toIMP() {
StringBuilder buf = new StringBuilder();
for (long i = 0; i < end; ++i) {
DataIndex index = getIndex(state, i);
int offset = index.getOffset();
long offset = index.getOffset();
int size = index.getSize();
buf.setLength(0);
buf.append("$$$");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected DataEntry getEntry(RawLDBackendState fileState, DataEntry entry) {
return new DataEntry(entry.getName(), new byte[0], entry.getCharset());
}

int blockStart = SwordUtil.decodeLittleEndian32(temp, 0);
long blockStart = SwordUtil.decodeLittleEndian32(temp, 0) & 0xFFFFFFFFL;
int blockSize = SwordUtil.decodeLittleEndian32(temp, 4);

temp = SwordUtil.readRAF(state.getZdtRaf(), blockStart, blockSize);
Expand Down Expand Up @@ -147,7 +147,7 @@ public void dumpIdxRaf() {
System.out.println("index\toffset\tsize\tkey\tvalue");
for (long i = 0; i < end; ++i) {
DataIndex index = getIndex(state, i);
int offset = index.getOffset();
long offset = index.getOffset();
int size = index.getSize();
buf.setLength(0);
buf.append(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public String readRawContent(ZVerseBackendState rafBook, Key key) throws IOExcep
// The data is little endian - extract the blockNum, verseStart
// and
// verseSize
final long blockNum = SwordUtil.decodeLittleEndian32(temp, 0);
final long blockNum = SwordUtil.decodeLittleEndian32(temp, 0) & 0xFFFFFFFFL;
final int verseStart = SwordUtil.decodeLittleEndian32(temp, 4);
final int verseSize;
if (datasize == 2) {
Expand All @@ -354,7 +354,7 @@ public String readRawContent(ZVerseBackendState rafBook, Key key) throws IOExcep
return "";
}

final int blockStart = SwordUtil.decodeLittleEndian32(temp, 0);
final long blockStart = SwordUtil.decodeLittleEndian32(temp, 0) & 0xFFFFFFFFL;
final int blockSize = SwordUtil.decodeLittleEndian32(temp, 4);
final int uncompressedSize = SwordUtil.decodeLittleEndian32(temp, 8);

Expand Down