summaryrefslogtreecommitdiffstats
path: root/gfx/ots/ots-lz4.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/ots/ots-lz4.patch
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/ots/ots-lz4.patch')
-rw-r--r--gfx/ots/ots-lz4.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/gfx/ots/ots-lz4.patch b/gfx/ots/ots-lz4.patch
new file mode 100644
index 0000000000..729dd30a1d
--- /dev/null
+++ b/gfx/ots/ots-lz4.patch
@@ -0,0 +1,74 @@
+diff --git a/gfx/ots/src/glat.cc b/gfx/ots/src/glat.cc
+--- a/gfx/ots/src/glat.cc
++++ b/gfx/ots/src/glat.cc
+@@ -4,9 +4,9 @@
+
+ #include "glat.h"
+
+ #include "gloc.h"
+-#include "lz4.h"
++#include "mozilla/Compression.h"
+ #include <list>
+ #include <memory>
+
+ namespace ots {
+@@ -214,16 +214,17 @@ bool OpenTypeGLAT_v3::Parse(const uint8_
+ OTS_MAX_DECOMPRESSED_TABLE_SIZE / (1024.0 * 1024.0),
+ decompressed_size / (1024.0 * 1024.0));
+ }
+ std::unique_ptr<uint8_t> decompressed(new uint8_t[decompressed_size]());
+- int ret = LZ4_decompress_safe_partial(
++ size_t outputSize = 0;
++ bool ret = mozilla::Compression::LZ4::decompressPartial(
+ reinterpret_cast<const char*>(data + table.offset()),
+- reinterpret_cast<char*>(decompressed.get()),
+ table.remaining(), // input buffer size (input size + padding)
++ reinterpret_cast<char*>(decompressed.get()),
+ decompressed_size, // target output size
+- decompressed_size); // output buffer size
+- if (ret < 0 || unsigned(ret) != decompressed_size) {
+- return DropGraphite("Decompression failed with error code %d", ret);
++ &outputSize); // return output size
++ if (!ret || outputSize != decompressed_size) {
++ return DropGraphite("Decompression failed");
+ }
+ return this->Parse(decompressed.get(), decompressed_size, true);
+ }
+ default:
+diff --git a/gfx/ots/src/silf.cc b/gfx/ots/src/silf.cc
+--- a/gfx/ots/src/silf.cc
++++ b/gfx/ots/src/silf.cc
+@@ -4,9 +4,9 @@
+
+ #include "silf.h"
+
+ #include "name.h"
+-#include "lz4.h"
++#include "mozilla/Compression.h"
+ #include <cmath>
+ #include <memory>
+
+ namespace ots {
+@@ -49,16 +49,17 @@ bool OpenTypeSILF::Parse(const uint8_t*
+ OTS_MAX_DECOMPRESSED_TABLE_SIZE / (1024.0 * 1024.0),
+ decompressed_size / (1024.0 * 1024.0));
+ }
+ std::unique_ptr<uint8_t> decompressed(new uint8_t[decompressed_size]());
+- int ret = LZ4_decompress_safe_partial(
++ size_t outputSize = 0;
++ bool ret = mozilla::Compression::LZ4::decompressPartial(
+ reinterpret_cast<const char*>(data + table.offset()),
+- reinterpret_cast<char*>(decompressed.get()),
+ table.remaining(), // input buffer size (input size + padding)
++ reinterpret_cast<char*>(decompressed.get()),
+ decompressed_size, // target output size
+- decompressed_size); // output buffer size
+- if (ret < 0 || unsigned(ret) != decompressed_size) {
+- return DropGraphite("Decompression failed with error code %d", ret);
++ &outputSize); // return output size
++ if (!ret || outputSize != decompressed_size) {
++ return DropGraphite("Decompression failed");
+ }
+ return this->Parse(decompressed.get(), decompressed_size, true);
+ }
+ default: