Skip to content

Commit 64506f4

Browse files
committed
1.1.0 - Allocate ZLib.uncompress() in relation to remaining bytes
1 parent b8dcb55 commit 64506f4

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

leveldb-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.hivemc.leveldb</groupId>
77
<artifactId>leveldb-project</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.1.0</version>
99
</parent>
1010

1111
<artifactId>leveldb-api</artifactId>

leveldb-benchmark/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>com.hivemc.leveldb</groupId>
2323
<artifactId>leveldb-project</artifactId>
24-
<version>1.0.1</version>
24+
<version>1.1.0</version>
2525
</parent>
2626

2727
<artifactId>leveldb-benchmark</artifactId>

leveldb/dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>leveldb-project</artifactId>
55
<groupId>com.hivemc.leveldb</groupId>
6-
<version>1.0.1</version>
6+
<version>1.1.0</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>leveldb</artifactId>

leveldb/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.hivemc.leveldb</groupId>
77
<artifactId>leveldb-project</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.1.0</version>
99
</parent>
1010

1111
<artifactId>leveldb</artifactId>

leveldb/src/main/java/org/iq80/leveldb/util/ZLib.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public static ByteBuffer uncompress(ByteBuffer compressed, boolean raw) throws I
4141
{
4242
Inflater inflater = (raw ? INFLATER_RAW : INFLATER).get();
4343
try {
44-
ByteBuffer buffer = ByteBuffer.allocate(1024);
44+
ByteBuffer buffer = ByteBuffer.allocate(Math.max(1024, compressed.remaining() * 2));
4545
inflater.setInput(compressed);
4646
while (!inflater.finished()) {
4747
if (inflater.inflate(buffer) == 0) {
4848
// Grow buffer
49-
ByteBuffer newBuffer = ByteBuffer.allocate(buffer.capacity() + 1024);
49+
ByteBuffer newBuffer = ByteBuffer.allocate(buffer.capacity() + Math.max(1024, (compressed.remaining() * 2)));
5050
int position = buffer.position();
5151

5252
// Reset reader index

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>com.hivemc.leveldb</groupId>
1313
<artifactId>leveldb-project</artifactId>
14-
<version>1.0.1</version>
14+
<version>1.1.0</version>
1515
<packaging>pom</packaging>
1616

1717
<name>${project.groupId}:${project.artifactId}</name>

0 commit comments

Comments
 (0)