Some Windows tweaks (#8118)

* Some windows tweaks

* Make this pub

* Update bundle_v2.zig

* Fix woopsie

* Make this error better

* Add assertion for using allocator for HTTP client from another thread.

* Do fewer copies in readdir()

* Fix crash/failing tests

* Update tests

* Fix windows build

* Update loop.c

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2024-01-15 17:33:33 -08:00
committed by GitHub
parent 2d21567271
commit a36355cefb
18 changed files with 372 additions and 100 deletions

View File

@@ -280,6 +280,7 @@ pub const String = extern struct {
extern fn BunString__fromLatin1(bytes: [*]const u8, len: usize) String;
extern fn BunString__fromBytes(bytes: [*]const u8, len: usize) String;
extern fn BunString__fromUTF16(bytes: [*]const u16, len: usize) String;
extern fn BunString__fromUTF16ToLatin1(bytes: [*]const u16, len: usize) String;
extern fn BunString__fromLatin1Unitialized(len: usize) String;
extern fn BunString__fromUTF16Unitialized(len: usize) String;
@@ -369,6 +370,9 @@ pub const String = extern struct {
pub fn createUTF16(bytes: []const u16) String {
if (bytes.len == 0) return String.empty;
if (bun.strings.firstNonASCII16CheckMin([]const u16, bytes, false) == null) {
return BunString__fromUTF16ToLatin1(bytes.ptr, bytes.len);
}
return BunString__fromUTF16(bytes.ptr, bytes.len);
}