Fixes for zig 0.10.0

This commit is contained in:
jaina heartles 2022-11-03 23:26:50 -07:00
parent 1ba1b18c39
commit 5d94f6874d
4 changed files with 4 additions and 4 deletions

View file

@ -51,7 +51,7 @@ pub fn handshake(alloc: std.mem.Allocator, req: http.Request, res: *http.Respons
var hash_encoded: [std.base64.standard.Encoder.calcSize(Sha1.digest_length)]u8 = undefined;
_ = std.base64.standard.Encoder.encode(&hash_encoded, &hash);
try headers.put("Sec-WebSocket-Accept", &hash_encoded);
const stream = try res.upgrade(.switching_protcols, &headers);
const stream = try res.upgrade(.switching_protocols, &headers);
return Socket{ .stream = stream };
}

View file

@ -499,7 +499,7 @@ fn parseInternal(
if (!fields_seen[i]) {
if (field.default_value) |default_ptr| {
if (!field.is_comptime) {
const default = @ptrCast(*const field.field_type, default_ptr).*;
const default = @ptrCast(*align(1) const field.field_type, default_ptr).*;
@field(r, field.name) = default;
}
} else {

View file

@ -53,7 +53,7 @@ pub fn up(db: anytype) !void {
std.log.info("Running migration {s}", .{migration.name});
try execScript(tx, migration.up, gpa.allocator());
try tx.insert("migration", .{
.name = migration.name,
.name = @as([]const u8, migration.name),
.applied_at = DateTime.now(),
}, gpa.allocator());
}

View file

@ -496,7 +496,7 @@ fn Tx(comptime tx_level: u8) type {
inline for (fields) |field, i| {
// This causes a compiler crash. Why?
//const F = field.field_type;
const F = @TypeOf(@field(std.mem.zeroes(ValueType), field.name));
const F = @TypeOf(@field(value, field.name));
// causes issues if F is @TypeOf(null), use dummy type
types[i] = if (F == @TypeOf(null)) ?i64 else F;
table_spec = comptime (table_spec ++ field.name ++ ",");