Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: fix console debug output on Windows
The FWrite function on Windows assumed that MultiByteToWideChar automatically null-terminates the resulting string, but it will only do so if the size of the source was passed as -1 or null character was explicitly counted in the size. The FWrite uses std::string and its `.size()` method which doesn't count the null character even though the `.data()` method adds it to the resulting string. https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar#remarks > MultiByteToWideChar does not null-terminate an output string if the input string length is explicitly specified without a terminating null character. To null-terminate an output string for this function, the application should pass in -1 or explicitly count the terminating null character for the input string. PR-URL: #31580 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- Loading branch information