DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (409f3966645a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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>
 
 namespace ots {
 
@@ -200,16 +200,17 @@ bool OpenTypeGLAT_v3::Parse(const uint8_
       if (prevent_decompression) {
         return DropGraphite("Illegal nested compression");
       }
       std::vector<uint8_t> decompressed(this->compHead & FULL_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.data()),
           table.remaining(),  // input buffer size (input size + padding)
+          reinterpret_cast<char*>(decompressed.data()),
           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.data(), 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>
 
 namespace ots {
 
@@ -38,16 +38,17 @@ bool OpenTypeSILF::Parse(const uint8_t* 
         if (prevent_decompression) {
           return DropGraphite("Illegal nested compression");
         }
         std::vector<uint8_t> decompressed(this->compHead & FULL_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.data()),
             table.remaining(),  // input buffer size (input size + padding)
+            reinterpret_cast<char*>(decompressed.data()),
             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.data(), decompressed.size(), true);
       }
       default: