3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-10-01 19:30:06 +02:00

Merge branch 'main' into upstream/offsets

Dieser Commit ist enthalten in:
Matt 2023-05-11 00:28:20 -04:00 committet von GitHub
Commit 7932b8497b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -173,7 +173,6 @@ public class DiskOptimizedClipboard extends LinearClipboard {
nbtMap = new HashMap<>(); nbtMap = new HashMap<>();
try { try {
this.file = file; this.file = file;
checkFileLength(file);
this.braf = new RandomAccessFile(file, "rw"); this.braf = new RandomAccessFile(file, "rw");
braf.setLength(file.length()); braf.setLength(file.length());
this.nbtBytesRemaining = Integer.MAX_VALUE - (int) file.length(); this.nbtBytesRemaining = Integer.MAX_VALUE - (int) file.length();
@ -202,32 +201,6 @@ public class DiskOptimizedClipboard extends LinearClipboard {
} }
} }
private void checkFileLength(File file) throws IOException {
long expectedFileSize = headerSize + ((long) getVolume() << 1);
if (file.length() > Integer.MAX_VALUE) {
if (expectedFileSize >= Integer.MAX_VALUE) {
throw new IOException(String.format(
"Cannot load clipboard of file size: %d > 2147483647 bytes (2.147 GiB), " + "volume: %d blocks",
file.length(),
getVolume()
));
} else {
throw new IOException(String.format(
"Cannot load clipboard of file size > 2147483647 bytes (2.147 GiB). Possible corrupt file? Mismatch" +
" between volume `%d` and file length `%d`!",
file.length(),
getVolume()
));
}
} else if (expectedFileSize != file.length()) {
throw new IOException(String.format(
"Possible corrupt clipboard file? Mismatch between expected file size `%d` and actual file size `%d`!",
expectedFileSize,
file.length()
));
}
}
/** /**
* Attempt to load a file into a new {@link DiskOptimizedClipboard} instance. Will attempt to recover on version mismatch * Attempt to load a file into a new {@link DiskOptimizedClipboard} instance. Will attempt to recover on version mismatch
* failure. * failure.