git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 3000269e73a2043fd121ec39d866de99465db178
parent f5965fda2263ab6e15d9a7342d7343d3c91e0b98
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Tue, 23 Dec 2025 23:09:57 +0200

swprintf is broken in some MSVCRT versions, fixes #725

Diffstat:
MOpenDialog/windows.c10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/OpenDialog/windows.c b/OpenDialog/windows.c @@ -83,17 +83,17 @@ char *do_save_recording_dialog(unsigned frequency) { OPENFILENAMEW dialog; wchar_t filename[MAX_PATH + 5] = L"recording.wav"; - static wchar_t filter[] = L"RIFF WAVE\0*.wav\0Apple AIFF\0*.aiff;*.aif;*.aifc\0Raw PCM (Stereo _______Hz, 16-bit LE)\0*.raw;*.pcm;\0All files\0*.*\0\0"; + static wchar_t filter[] = L"RIFF WAVE\0*.wav\0Apple AIFF\0*.aiff;*.aif;*.aifc\0Raw PCM (Stereo \u200b\u200b\u200b\u200b\u200b\u200b\u200bHz, 16-bit LE)\0*.raw;*.pcm;\0All files\0*.*\0\0"; memset(&dialog, 0, sizeof(dialog)); dialog.lStructSize = sizeof(dialog); dialog.lpstrFile = filename; dialog.nMaxFile = MAX_PATH; dialog.lpstrFilter = filter; - swprintf(filter + sizeof("RIFF WAVE\0*.wav\0Apple AIFF\0*.aiff;*.aif;*.aifc\0Raw PCM (Stereo ") - 1, - sizeof("_______Hz, 16-bit LE)"), - L"%dHz, 16-bit LE) ", - frequency); + + wchar_t temp[11]; + _itow(frequency, temp, 10); + memcpy(filter + sizeof("RIFF WAVE\0*.wav\0Apple AIFF\0*.aiff;*.aif;*.aifc\0Raw PCM (Stereo ") - 1, temp, min(wcslen(temp), 7) * sizeof(wchar_t)); dialog.nFilterIndex = 1; dialog.lpstrInitialDir = NULL;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.