Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
PDIC: adjust spotbugs warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr committed Sep 28, 2021
1 parent 5e9a47e commit aaa3d39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Expand Up @@ -369,7 +369,9 @@ byte[] readBlockData(int blkno) {
mSrcStream.seek(m_bodyptr + (long) blkno * m_blocksize);

// 1ブロック分読込(1セクタ分先読み)
mSrcStream.read(pbuf, 0, 0x200);
if (mSrcStream.read(pbuf, 0, 0x200) < 0) {
return null;
}

// 長さ取得
int len = ((int) (pbuf[0])) & 0xFF;
Expand All @@ -384,7 +386,9 @@ byte[] readBlockData(int blkno) {
if (len * m_blocksize > 0x200) {
pbuf = new byte[m_blocksize * len];
System.arraycopy(buff, 0, pbuf, 0, 0x200);
mSrcStream.read(pbuf, 0x200, len * m_blocksize - 0x200);
if (mSrcStream.read(pbuf, 0x200, len * m_blocksize - 0x200) < 0) {
return null;
}
}
} else {
pbuf = null;
Expand Down
Expand Up @@ -39,7 +39,9 @@ byte[] getSegmentWithoutCache(int segment, int blocksize) {
}
try {
mFile.seek(mStart + (long) segment * blocksize);
mFile.read(mSegmentData, 0, blocksize);
if (mFile.read(mSegmentData, 0, blocksize) < 0) {
return null;
}
} catch (IOException e) {
return null;
}
Expand All @@ -55,11 +57,12 @@ byte[] getSegment(int segment) {
mFixedBuffer = new byte[mSize];
try {
mFile.seek(mStart);
mFile.read(mFixedBuffer, 0, mSize);
if (mFile.read(mFixedBuffer, 0, mSize) >= 0) {
return mFixedBuffer;
}
} catch (IOException ignored) {
}
}
return mFixedBuffer;
}

WeakReference<byte[]> ref = mMap.get(segment);
Expand Down

0 comments on commit aaa3d39

Please sign in to comment.