diff --git a/src/Database.zig b/src/Database.zig index 8ec6bdb..f39c492 100644 --- a/src/Database.zig +++ b/src/Database.zig @@ -31,7 +31,7 @@ const wrapMessage = @import("error.zig").wrapMessage; /// A callback invoked by `compact` to notify the user of the progress of the /// compaction process. -pub const StatusCallback = fn (message: [*c]const u8, closure: ?*anyopaque) callconv(.c) void; +pub const StatusCallback = *const fn (message: [*c]const u8, closure: ?*anyopaque) callconv(.c) void; database: *c.notmuch_database_t, @@ -371,7 +371,7 @@ pub fn needsUpgrade(self: *const Database) bool { /// Callback function that provides progress notification during a database /// upgrade operation. -pub const ProgressCallback = fn (closure: ?*anyopaque, progress: f64) callconv(.c) void; +pub const ProgressCallback = *const fn (closure: ?*anyopaque, progress: f64) callconv(.c) void; /// Upgrade the current database to the latest supported version. /// @@ -412,7 +412,7 @@ pub fn beginAtomic(self: *const Database) error{XapianException}!void { /// `beginAtomic`) "database.autocommit" times, commit the the transaction and /// all previous (non-cancelled) transactions to the database. pub fn endAtomic(self: *const Database) error{ UnbalancedAtomic, XapianException }!void { - switch (status(c.notmuch_database_begin_atomic(self.database))) { + switch (status(c.notmuch_database_end_atomic(self.database))) { .success => {}, .unbalanced_atomic => return error.UnbalancedAtomic, .xapian_exception => return error.XapianException, diff --git a/src/Directory.zig b/src/Directory.zig index 3684520..7c91359 100644 --- a/src/Directory.zig +++ b/src/Directory.zig @@ -75,7 +75,7 @@ pub const GetChildDirectoriesError = error{ /// paths). pub fn getChildDirectories(self: *const Directory) GetChildDirectoriesError!FilenamesIterator { return .{ - .filenames = c.notmuch_directory_get_child_files(self.directory) orelse return error.XapianException, + .filenames = c.notmuch_directory_get_child_directories(self.directory) orelse return error.XapianException, }; } diff --git a/src/Message.zig b/src/Message.zig index c9d18d3..f4b6ff7 100644 --- a/src/Message.zig +++ b/src/Message.zig @@ -238,7 +238,7 @@ pub const RemoveTagError = error{ /// Remove a tag from the given message. pub fn removeTag(self: *const Message, tag: [:0]const u8) RemoveTagError!void { - return switch (status(c.notmuch_message_add_tag(self.message, tag))) { + return switch (status(c.notmuch_message_remove_tag(self.message, tag))) { .success => {}, .null_pointer => unreachable, .tag_too_long => error.TagTooLong, diff --git a/src/notmuch.zig b/src/notmuch.zig index 4778cac..b4576a3 100644 --- a/src/notmuch.zig +++ b/src/notmuch.zig @@ -37,7 +37,7 @@ const wrap = @import("error.zig").wrap; /// called with diagnostic and informational messages. The argument `closure` is /// passed verbatim to any callback invoked. pub fn compact(path: [:0]const u8, backup_path: [:0]const u8, status_cb: ?Database.StatusCallback, closure: ?*anyopaque) Error!void { - try wrap(c.notmuch_database_compact_db(path, backup_path, status_cb, closure)); + try wrap(c.notmuch_database_compact(path, backup_path, status_cb, closure)); } /// Interrogate the library for compile time features.