move off of deprecated APIs
This commit is contained in:
parent
dafc69726f
commit
5ba3be2cc4
3 changed files with 9 additions and 3 deletions
|
@ -387,7 +387,10 @@ fn generateServices(
|
||||||
file: std.fs.File,
|
file: std.fs.File,
|
||||||
writer: *std.Io.Writer,
|
writer: *std.Io.Writer,
|
||||||
) ![][]const u8 {
|
) ![][]const u8 {
|
||||||
const json = try file.readToEndAlloc(allocator, 1024 * 1024 * 1024);
|
var fbuf: [1024]u8 = undefined;
|
||||||
|
var freader = file.reader(&fbuf);
|
||||||
|
var reader = &freader.interface;
|
||||||
|
const json = try reader.allocRemaining(allocator, .limited(1024 * 1024 * 1024));
|
||||||
defer allocator.free(json);
|
defer allocator.free(json);
|
||||||
const model = try smithy.parse(allocator, json);
|
const model = try smithy.parse(allocator, json);
|
||||||
defer model.deinit();
|
defer model.deinit();
|
||||||
|
|
|
@ -463,7 +463,10 @@ const PartialCredentials = struct {
|
||||||
};
|
};
|
||||||
fn credsForFile(allocator: std.mem.Allocator, file: ?std.fs.File, profile: []const u8) !PartialCredentials {
|
fn credsForFile(allocator: std.mem.Allocator, file: ?std.fs.File, profile: []const u8) !PartialCredentials {
|
||||||
if (file == null) return PartialCredentials{};
|
if (file == null) return PartialCredentials{};
|
||||||
const text = try file.?.readToEndAlloc(allocator, std.math.maxInt(usize));
|
var fbuf: [1024]u8 = undefined;
|
||||||
|
var freader = file.?.reader(&fbuf);
|
||||||
|
var reader = &freader.interface;
|
||||||
|
const text = try reader.allocRemaining(allocator, .unlimited);
|
||||||
defer allocator.free(text);
|
defer allocator.free(text);
|
||||||
const partial_creds = try credsForText(text, profile);
|
const partial_creds = try credsForText(text, profile);
|
||||||
var ak: ?[]const u8 = null;
|
var ak: ?[]const u8 = null;
|
||||||
|
|
|
@ -382,7 +382,7 @@ const TestSetup = struct {
|
||||||
self.request_actuals = acts;
|
self.request_actuals = acts;
|
||||||
return acts.request.*;
|
return acts.request.*;
|
||||||
}
|
}
|
||||||
fn sendBodyComplete(self_ptr: usize, body: []u8) std.io.Writer.Error!void {
|
fn sendBodyComplete(self_ptr: usize, body: []u8) std.Io.Writer.Error!void {
|
||||||
const self: *Self = @ptrFromInt(self_ptr);
|
const self: *Self = @ptrFromInt(self_ptr);
|
||||||
if (self.request_actuals == null) return error.WriteFailed; // invalid state - must be called after request
|
if (self.request_actuals == null) return error.WriteFailed; // invalid state - must be called after request
|
||||||
self.request_actuals.?.body = self.allocator.dupe(u8, body) catch return error.WriteFailed;
|
self.request_actuals.?.body = self.allocator.dupe(u8, body) catch return error.WriteFailed;
|
||||||
|
|
Loading…
Add table
Reference in a new issue