summaryrefslogtreecommitdiff
path: root/src/pdf.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 14:35:15 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commitbc3d18d27f9fc1155db7fac3946c4d38774f9e65 (patch)
tree9178ce95952797f8a78b16c2b805e53368efb35a /src/pdf.zig
parent1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (diff)
downloadpardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.tar.gz
pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.zip
Build with Zig 0.17
ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pdf.zig')
-rw-r--r--src/pdf.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pdf.zig b/src/pdf.zig
index d98d5ff2..5adc62d1 100644
--- a/src/pdf.zig
+++ b/src/pdf.zig
@@ -4,9 +4,7 @@
const std = @import("std");
const c_heap = @import("c_heap");
-const c = @cImport({
- @cInclude("pdf_bridge.h");
-});
+const c = @import("pdf_c"); // src/pdf_bridge.h, translated by build.zig
/// What MuPDF allocates from, itself and the libraries it bundles (they all
/// allocate through its context): `start`'s allocator, through the shared C
@@ -1130,7 +1128,7 @@ pub const Document = struct {
const page_number = try document.checkedPage(page);
if (std.mem.indexOfScalar(u8, needle, 0) != null)
return error.InvalidNeedle;
- const needle_z = try gpa.dupeZ(u8, needle);
+ const needle_z = try gpa.dupeSentinel(u8, needle, 0);
defer gpa.free(needle_z);
var found: c.pardes_pdf_search_result =
@@ -2067,7 +2065,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" {
const projected = try document.pageText(std.testing.allocator, 0);
defer std.testing.allocator.free(projected);
- try std.testing.expect(std.ascii.indexOfIgnoreCase(projected, "Pardes") != null);
+ try std.testing.expect(std.ascii.findIgnoreCase(projected, "Pardes") != null);
// Exercise transactional cache replacement before searching page zero
// again; a failed ownership handoff here tends to surface as a double drop.
if (document.pages > 1) {
@@ -2093,7 +2091,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" {
const text = try document.copySelection(std.testing.allocator, 0, selected.start, selected.end);
defer std.testing.allocator.free(text);
- try std.testing.expect(std.ascii.indexOfIgnoreCase(text, "Pardes") != null);
+ try std.testing.expect(std.ascii.findIgnoreCase(text, "Pardes") != null);
}
test "highlighted render changes pixels while plain render stays stable" {