Commit Graph

3 Commits

Author SHA1 Message Date
Alastair Houghton
fb1211e3fa Rename the functions as they're exported as C APIs.
`SWIFT_RUNTIME_STDLIB_INTERNAL` does `extern "C"`, so we can't put these
in a namespace and have to use a C-style prefix instead.

Also slightly rearrange the code in `CommandLine.cpp`.

rdar://103397975
2022-12-21 11:44:37 +00:00
Alastair Houghton
ca771c4d1d Change to returning nullptr rather than triggering a fatal error.
Instead of triggering a fatal error on failure, return `nullptr` and
let the caller decide what to do about it.  The CommandLine code should
trigger a fatal error, of course.

rdar://103397975
2022-12-21 11:44:37 +00:00
Alastair Houghton
a31b1c54fa Centralise code to map between UTF-8 and UTF-16 on Windows.
In various places we need to call the Windows API, and because Swift uses UTF-8
for its string representation, we can’t call the ANSI API functions (because the
code page used for the ANSI functions varies depending on the system locale
setting). Instead, we need to use the wide character APIs.

This means that we need to convert UTF-8 to wide character and vice-versa in
various places in the runtime.

rdar://103397975
2022-12-21 11:44:35 +00:00