mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
some improvement
This commit is contained in:
@@ -2532,9 +2532,7 @@ pub const Arguments = struct {
|
||||
return ctx.throwInvalidArgumentTypeValue("buffer", "TypedArray", buffer_value.?);
|
||||
};
|
||||
|
||||
if (buffer.buffer.len == 0) {
|
||||
return JSC.Error.ERR_INVALID_ARG_VALUE.throw(ctx, "The argument 'buffer' is empty and cannot be written.", .{});
|
||||
}
|
||||
|
||||
|
||||
arguments.eat();
|
||||
|
||||
@@ -2569,6 +2567,10 @@ pub const Arguments = struct {
|
||||
defined_length = true;
|
||||
}
|
||||
|
||||
if (buffer.buffer.len == 0) {
|
||||
return JSC.Error.ERR_INVALID_ARG_VALUE.throw(ctx, "The argument 'buffer' is empty and cannot be written.", .{});
|
||||
}
|
||||
|
||||
if (arguments.next()) |arg_position| {
|
||||
arguments.eat();
|
||||
|
||||
|
||||
@@ -947,7 +947,14 @@ pub const PathLike = union(enum) {
|
||||
|
||||
pub inline fn osPathKernel32(this: PathLike, buf: *bun.PathBuffer) bun.OSPathSliceZ {
|
||||
if (comptime Environment.isWindows) {
|
||||
return strings.toKernel32Path(@alignCast(std.mem.bytesAsSlice(u16, buf)), this.slice());
|
||||
const s = this.slice();
|
||||
if (bun.strings.hasPrefixComptime(s, "/")) {
|
||||
const b = bun.PathBufferPool.get();
|
||||
defer bun.PathBufferPool.put(b);
|
||||
const resolve = path_handler.PosixToWinNormalizer.resolveCWDWithExternalBuf(b,s) catch @panic("Error while resolving path.");
|
||||
return strings.toKernel32Path(@alignCast(std.mem.bytesAsSlice(u16, buf)), resolve);
|
||||
}
|
||||
return strings.toKernel32Path(@alignCast(std.mem.bytesAsSlice(u16, buf)), s);
|
||||
}
|
||||
|
||||
return sliceZWithForceCopy(this, buf, false);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user