Skip to content

Commit e882bfd

Browse files
committed
chore: clean dir
1 parent 4f9978d commit e882bfd

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/unit_tests.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ comptime {
44
_ = @import("table/mod.zig");
55
_ = @import("./lib.zig");
66
_ = @import("./byte_writer.zig");
7-
_ = @import("./woff.zig");
7+
_ = @import("./woff/woff_v1.zig");
88
}

src/woff/mod.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub const woff_v1 = @import("./woff_v1.zig");
2+
pub const woff_v2 = @import("./woff_v2.zig");

src/woff.zig renamed to src/woff/woff_v1.zig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const std = @import("std");
2-
const reader = @import("./byte_read.zig");
3-
const mod = @import("./parser.zig");
2+
const reader = @import("../byte_read.zig");
3+
const mod = @import("../parser.zig");
44
const Allocator = std.mem.Allocator;
5-
const Head = @import("./table/head.zig");
6-
const byte_writer = @import("./byte_writer.zig");
5+
const Head = @import("../table/head.zig");
6+
const byte_writer = @import("../byte_writer.zig");
77

88
const zlib = std.compress.zlib;
99
const fs = std.fs;
@@ -18,7 +18,7 @@ pub const Woff = struct {
1818

1919
allocator: Allocator,
2020
parser: *Parser,
21-
compressor: *const fn (data: []const u8, allocator: Allocator) anyerror![]u8,
21+
compressor: *const fn (allocator: Allocator, data: []const u8) anyerror![]u8,
2222

2323
pub const Error = error{
2424
InvalidSfntVersion,
@@ -36,7 +36,7 @@ pub const Woff = struct {
3636
pub fn init(
3737
allocator: Allocator,
3838
parser: *Parser,
39-
compressor: *const fn (data: []const u8, allocator: Allocator) anyerror![]u8,
39+
compressor: *const fn (allocator: Allocator, data: []const u8) anyerror![]u8,
4040
) Self {
4141
return Self{
4242
.allocator = allocator,
@@ -74,7 +74,7 @@ pub const Woff = struct {
7474
const start = table_record.offset;
7575
const end = start + table_record.length;
7676
const table_data = self.parser.buffer[start..end];
77-
const compressed_data = try self.compressor(table_data, self.allocator);
77+
const compressed_data = try self.compressor(self.allocator, table_data);
7878

7979
const use_compressed = compressed_data.len < table_data.len;
8080
const final_data = if (use_compressed) compressed_data else table_data;
@@ -162,7 +162,7 @@ pub const Woff = struct {
162162
pub fn ttf_to_woff_v1(
163163
allocator: Allocator,
164164
data: []u8,
165-
compressor: *const fn (data: []const u8, allocator: Allocator) anyerror![]u8,
165+
compressor: *const fn (allocator: Allocator, data: []const u8) anyerror![]u8,
166166
) ![]u8 {
167167
var parser = try Parser.init(allocator, data);
168168
defer parser.deinit();
@@ -174,14 +174,14 @@ pub fn ttf_to_woff_v1(
174174
pub fn ttf_woff_v1_with_parser(
175175
allocator: Allocator,
176176
parser: *Parser,
177-
compressor: *const fn (data: []const u8, allocator: Allocator) anyerror![]u8,
177+
compressor: *const fn (allocator: Allocator, data: []const u8) anyerror![]u8,
178178
) ![]u8 {
179179
var woff = Woff.init(allocator, parser, compressor);
180180
return woff.as_woff();
181181
}
182182

183183
// Mock compressor for testing purposes
184-
fn mock_compressor(data: []const u8, allocator: Allocator) ![]u8 {
184+
fn mock_compressor(allocator: Allocator, data: []const u8) ![]u8 {
185185
var compressed_data = std.ArrayList(u8).init(allocator);
186186
defer compressed_data.deinit();
187187

0 commit comments

Comments
 (0)