srctree

Gregory Mullen parent 9cf58d51 8e40e556
add support for x32 arch

I didn't actually test this natively myself, so shrug
inlinesplit
src/http.zig added: 14, removed: 12, total 2
@@ -68,10 +68,12 @@ fn requestData(a: Allocator, req: *std.http.Server.Request) !Request.Data {
var post_data: ?RequestData.PostData = null;
 
if (req.head.content_length) |h_len| {
if (h_len > 0) {
if (h_len > std.math.maxInt(usize)) return error.ContentTooLarge;
const hlen: usize = @intCast(h_len);
if (hlen > 0) {
const h_type = req.head.content_type orelse "text/plain";
var reader = try req.reader();
post_data = try RequestData.readPost(a, &reader, h_len, h_type);
post_data = try RequestData.readPost(a, &reader, hlen, h_type);
log.debug(
"post data \"{s}\" {{{any}}}",
.{ post_data.?.rawpost, post_data.?.rawpost },
 
src/request.zig added: 14, removed: 12, total 2
@@ -35,14 +35,12 @@ pub const Accept = []const u8;
pub const Authorization = []const u8;
pub const Referer = []const u8;
 
pub const Encoding = packed struct(usize) {
pub const Encoding = packed struct {
br: bool,
deflate: bool,
gzip: bool,
zstd: bool,
 
_padding: u60 = 0,
 
pub fn fromStr(str: []const u8) Encoding {
var e = Encoding.default;
inline for (@typeInfo(Encoding).@"struct".fields) |f| {
 
src/template/page.zig added: 14, removed: 12, total 2
@@ -104,7 +104,7 @@ fn getOffset(T: type, name: []const u8, base: usize) usize {
 
test getOffset {
const SUT1 = struct {
a: usize,
a: u64,
b: u8,
value: []const u8,
};
@@ -120,7 +120,7 @@ test getOffset {
// try std.testing.expectEqual(test_1, test_2);
 
const SUT2 = struct {
a: usize,
a: u64,
b: u16,
parent: SUT1,
};
 
src/websocket.zig added: 14, removed: 12, total 2
@@ -111,7 +111,9 @@ pub const Message = struct {
}
 
const length: usize = switch (m.length) {
inline else => |l| l,
.tiny => |t| t,
.small => |s| s,
.large => |l| if (@sizeOf(usize) != @sizeOf(@TypeOf(l))) @intCast(l) else l,
};
 
if (length > buffer.len) return error.NoSpaceLeft;