Skip to content

Commit cde32c7

Browse files
committed
fix cr
1 parent eb734be commit cde32c7

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-latest, macos-latest]
26-
zig-version: [0.14.0]
26+
zig-version: [0.14.1]
2727
steps:
2828
- uses: actions/checkout@v4
2929
- uses: mlugg/setup-zig@v1
@@ -61,15 +61,12 @@ jobs:
6161
fail-fast: false
6262
matrix:
6363
os: [ubuntu-latest]
64-
zig-version: [0.14.0]
64+
zig-version: [0.14.1]
6565
steps:
6666
- uses: actions/checkout@v4
6767
- uses: mlugg/setup-zig@v1
6868
with:
6969
version: ${{ matrix.zig-version }}
70-
- uses: actions/setup-go@v5
71-
with:
72-
go-version: 'stable'
7370
- name: Set Environment Variables
7471
run: |
7572
echo "ZIG_ARGS='-Dlink_vendor=false'" >> $GITHUB_ENV

examples/multi.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ pub fn main() !void {
2828
defer multi.deinit();
2929

3030
var ctx1 = curl.DynamicContext.init(allocator);
31+
defer ctx1.deinit();
3132
var ctx2 = curl.DynamicContext.init(allocator);
33+
defer ctx2.deinit();
3234

3335
try multi.addHandle(try newEasy(&ctx1, "http://httpbin.org/headers"));
3436
try multi.addHandle(try newEasy(&ctx2, "http://httpbin.org/ip"));
@@ -68,7 +70,6 @@ pub fn main() !void {
6870
var private_data: ?*anyopaque = null;
6971
try checkCode(c.curl_easy_getinfo(easy_handle, c.CURLINFO_PRIVATE, &private_data));
7072
const ctx: *curl.DynamicContext = @ptrCast(@alignCast(private_data.?));
71-
defer ctx.deinit();
7273

7374
std.debug.print("Response body: {s}\n", .{ctx.asSlice()});
7475
}

src/Easy.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ pub fn setWriteContext(
372372
fn write(ptr: [*c]c_char, size: c_uint, nmemb: c_uint, user_data: *anyopaque) callconv(.C) c_uint {
373373
const real_size = size * nmemb;
374374
const ctx: @TypeOf(context) = @alignCast(@ptrCast(user_data));
375-
var typed_data: [*]u8 = @ptrCast(ptr);
376-
return @intCast(writeFunc(ctx, typed_data[0..real_size]));
375+
const data = (@as([*]const u8, @ptrCast(ptr)))[0..real_size];
376+
return @intCast(writeFunc(ctx, data));
377377
}
378378
}.write);
379379
}
@@ -513,7 +513,7 @@ pub fn stdoutWriteCallback(ptr: [*c]c_char, size: c_uint, nmemb: c_uint, user_da
513513
_ = user_data;
514514
const stdout = std.io.getStdOut().writer();
515515
const real_size = size * nmemb;
516-
const data = ptr[0..real_size];
516+
const data = (@as([*]const u8, @ptrCast(ptr)))[0..real_size];
517517
stdout.writeAll(data) catch {
518518
return 0;
519519
};

src/util.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub const DynamicContext = struct {
6060
data: []const u8,
6161
) usize {
6262
ctx.buffer.appendSlice(data) catch {
63-
// Not enough space in the buffer
63+
// Out of memory
6464
return 0;
6565
};
6666

0 commit comments

Comments
 (0)