geforkt von Mirrors/Velocity
Fix several issues with JNI compression
The libraries will require a recompile.
Dieser Commit ist enthalten in:
Ursprung
04d3ed6820
Commit
01c6777948
@ -27,7 +27,7 @@ Java_com_velocitypowered_natives_compression_NativeZlibDeflate_free(JNIEnv *env,
|
|||||||
libdeflate_free_compressor((struct libdeflate_compressor *) ctx);
|
libdeflate_free_compressor((struct libdeflate_compressor *) ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jlong JNICALL
|
||||||
Java_com_velocitypowered_natives_compression_NativeZlibDeflate_process(JNIEnv *env,
|
Java_com_velocitypowered_natives_compression_NativeZlibDeflate_process(JNIEnv *env,
|
||||||
jclass clazz,
|
jclass clazz,
|
||||||
jlong ctx,
|
jlong ctx,
|
||||||
|
@ -70,11 +70,13 @@ public class LibdeflateVelocityCompressor implements VelocityCompressor {
|
|||||||
destinationAddress, destination.writableBytes());
|
destinationAddress, destination.writableBytes());
|
||||||
if (produced > 0) {
|
if (produced > 0) {
|
||||||
destination.writerIndex(destination.writerIndex() + produced);
|
destination.writerIndex(destination.writerIndex() + produced);
|
||||||
return;
|
break;
|
||||||
}
|
} else if (produced == 0) {
|
||||||
|
|
||||||
// Insufficient room - enlarge the buffer.
|
// Insufficient room - enlarge the buffer.
|
||||||
destination.capacity(destination.capacity() * 2);
|
destination.capacity(destination.capacity() * 2);
|
||||||
|
} else {
|
||||||
|
throw new DataFormatException("libdeflate returned unknown code " + produced);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ public class NativeConstraints {
|
|||||||
// HotSpot on Intel macOS prefers x86_64, but OpenJ9 on macOS and HotSpot/OpenJ9 elsewhere
|
// HotSpot on Intel macOS prefers x86_64, but OpenJ9 on macOS and HotSpot/OpenJ9 elsewhere
|
||||||
// give amd64.
|
// give amd64.
|
||||||
IS_AMD64 = osArch.equals("amd64") || osArch.equals("x86_64");
|
IS_AMD64 = osArch.equals("amd64") || osArch.equals("x86_64");
|
||||||
IS_AARCH64 = osArch.equals("aarch64");
|
IS_AARCH64 = osArch.equals("aarch64") || osArch.equals("arm64");
|
||||||
|
System.out.println(System.getProperty("os.name", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
static final BooleanSupplier NATIVE_BASE = () -> NATIVES_ENABLED && CAN_GET_MEMORYADDRESS;
|
static final BooleanSupplier NATIVE_BASE = () -> NATIVES_ENABLED && CAN_GET_MEMORYADDRESS;
|
||||||
@ -52,6 +53,7 @@ public class NativeConstraints {
|
|||||||
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
|
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
|
||||||
&& IS_AARCH64;
|
&& IS_AARCH64;
|
||||||
|
|
||||||
static final BooleanSupplier JAVA_11 = () -> Double.parseDouble(
|
static final BooleanSupplier MACOS_AARCH64 = () -> NATIVE_BASE.getAsBoolean()
|
||||||
System.getProperty("java.specification.version")) >= 11;
|
&& System.getProperty("os.name", "").equalsIgnoreCase("Mac OS X")
|
||||||
|
&& IS_AARCH64;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren