diff --git a/src/display/font_loader.js b/src/display/font_loader.js index c2f5a8044..b054f9a1f 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -18,7 +18,6 @@ import { FeatureTest, isNodeJS, shadow, - string32, unreachable, warn, } from "../shared/util.js"; @@ -270,6 +269,14 @@ class FontLoader { (data.charCodeAt(offset + 3) & 0xff) ); } + function string32(value) { + return String.fromCharCode( + (value >> 24) & 0xff, + (value >> 16) & 0xff, + (value >> 8) & 0xff, + value & 0xff + ); + } function spliceString(s, offset, remove, insert) { const chunk1 = s.substring(0, offset); const chunk2 = s.substring(offset + remove); diff --git a/src/shared/util.js b/src/shared/util.js index 6d00bb824..e89989ec4 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -596,21 +596,6 @@ function stringToBytes(str) { return bytes; } -function string32(value) { - if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) { - assert( - typeof value === "number" && Math.abs(value) < 2 ** 32, - `string32: Unexpected input "${value}".` - ); - } - return String.fromCharCode( - (value >> 24) & 0xff, - (value >> 16) & 0xff, - (value >> 8) & 0xff, - value & 0xff - ); -} - function objectSize(obj) { return Object.keys(obj).length; } @@ -1347,7 +1332,6 @@ export { ResponseException, setVerbosityLevel, shadow, - string32, stringToBytes, stringToPDFString, stringToUTF8String, diff --git a/test/unit/util_spec.js b/test/unit/util_spec.js index cd3d234f2..447687a3f 100644 --- a/test/unit/util_spec.js +++ b/test/unit/util_spec.js @@ -19,7 +19,6 @@ import { createValidAbsoluteUrl, getModificationDate, getUuid, - string32, stringToBytes, stringToPDFString, } from "../../src/shared/util.js"; @@ -72,14 +71,6 @@ describe("util", function () { }); }); - describe("string32", function () { - it("converts unsigned 32-bit integers to strings", function () { - expect(string32(0x74727565)).toEqual("true"); - expect(string32(0x74797031)).toEqual("typ1"); - expect(string32(0x4f54544f)).toEqual("OTTO"); - }); - }); - describe("stringToBytes", function () { it("handles non-string arguments", function () { expect(function () {