Fixes for zig 0.10.0
This commit is contained in:
parent
1ba1b18c39
commit
5d94f6874d
4 changed files with 4 additions and 4 deletions
|
@ -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;
|
var hash_encoded: [std.base64.standard.Encoder.calcSize(Sha1.digest_length)]u8 = undefined;
|
||||||
_ = std.base64.standard.Encoder.encode(&hash_encoded, &hash);
|
_ = std.base64.standard.Encoder.encode(&hash_encoded, &hash);
|
||||||
try headers.put("Sec-WebSocket-Accept", &hash_encoded);
|
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 };
|
return Socket{ .stream = stream };
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,7 +499,7 @@ fn parseInternal(
|
||||||
if (!fields_seen[i]) {
|
if (!fields_seen[i]) {
|
||||||
if (field.default_value) |default_ptr| {
|
if (field.default_value) |default_ptr| {
|
||||||
if (!field.is_comptime) {
|
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;
|
@field(r, field.name) = default;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn up(db: anytype) !void {
|
||||||
std.log.info("Running migration {s}", .{migration.name});
|
std.log.info("Running migration {s}", .{migration.name});
|
||||||
try execScript(tx, migration.up, gpa.allocator());
|
try execScript(tx, migration.up, gpa.allocator());
|
||||||
try tx.insert("migration", .{
|
try tx.insert("migration", .{
|
||||||
.name = migration.name,
|
.name = @as([]const u8, migration.name),
|
||||||
.applied_at = DateTime.now(),
|
.applied_at = DateTime.now(),
|
||||||
}, gpa.allocator());
|
}, gpa.allocator());
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,7 +496,7 @@ fn Tx(comptime tx_level: u8) type {
|
||||||
inline for (fields) |field, i| {
|
inline for (fields) |field, i| {
|
||||||
// This causes a compiler crash. Why?
|
// This causes a compiler crash. Why?
|
||||||
//const F = field.field_type;
|
//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
|
// causes issues if F is @TypeOf(null), use dummy type
|
||||||
types[i] = if (F == @TypeOf(null)) ?i64 else F;
|
types[i] = if (F == @TypeOf(null)) ?i64 else F;
|
||||||
table_spec = comptime (table_spec ++ field.name ++ ",");
|
table_spec = comptime (table_spec ++ field.name ++ ",");
|
||||||
|
|
Loading…
Reference in a new issue