mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user