Fixed all instances of the usage of wcstombs to use a sizeof() of whatever the destination is instead of the source size.
This commit is contained in:
@@ -132,6 +132,7 @@ endif
|
||||
|
||||
|
||||
ifeq ($(WALTJE), y)
|
||||
OPENDIR = win_opendir.o
|
||||
SERIAL = serial.o
|
||||
WSERIAL = win_serial.o
|
||||
WFLAGS = -DWALTJE
|
||||
@@ -241,7 +242,7 @@ VIDOBJ = video.o \
|
||||
WINOBJ = win.o \
|
||||
win_ddraw.o win_ddraw_fs.o win_ddraw_screenshot.o \
|
||||
win_d3d.o win_d3d_fs.o \
|
||||
win_language.o win_status.o win_opendir.o win_dynld.o \
|
||||
win_language.o win_status.o $(OPENDIR) win_dynld.o \
|
||||
win_video.o $(WSERIAL) win_keyboard.o win_mouse.o \
|
||||
win_iodev.o win_joystick.o win_midi.o \
|
||||
win_settings.o win_deviceconfig.o win_joystickconfig.o \
|
||||
|
||||
@@ -198,7 +198,7 @@ int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save)
|
||||
}
|
||||
if (r)
|
||||
{
|
||||
wcstombs(openfilestring, wopenfilestring, 520);
|
||||
wcstombs(openfilestring, wopenfilestring, sizeof(openfilestring));
|
||||
pclog("File dialog return true\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_MEMTEXT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2);
|
||||
wcstombs(stransi, lptsTemp, sizeof(stransi));
|
||||
sscanf(stransi, "%i", &temp_mem_size);
|
||||
temp_mem_size &= ~(models[temp_model].ram_granularity - 1);
|
||||
if (temp_mem_size < models[temp_model].min_ram)
|
||||
@@ -765,7 +765,7 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2);
|
||||
wcstombs(stransi, lptsTemp, sizeof(stransi));
|
||||
gfx = video_card_getid(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
|
||||
@@ -792,7 +792,7 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2);
|
||||
wcstombs(stransi, lptsTemp, sizeof(stransi));
|
||||
gfx = video_card_getid(stransi);
|
||||
temp_gfxcard = video_new_to_old(gfx);
|
||||
|
||||
@@ -828,7 +828,7 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2);
|
||||
wcstombs(stransi, lptsTemp, sizeof(stransi));
|
||||
deviceconfig_open(hdlg, (void *)video_card_getdevice(video_card_getid(stransi)));
|
||||
|
||||
free(stransi);
|
||||
@@ -843,7 +843,7 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, (wcslen(lptsTemp) * 2) + 2);
|
||||
wcstombs(stransi, lptsTemp, sizeof(stransi));
|
||||
temp_gfxcard = video_new_to_old(video_card_getid(stransi));
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED);
|
||||
@@ -2436,7 +2436,7 @@ static void get_edit_box_contents(HWND hdlg, int id, uint64_t *val)
|
||||
|
||||
h = GetDlgItem(hdlg, id);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM) szText);
|
||||
wcstombs(stransi, szText, (wcslen(szText) * 2) + 2);
|
||||
wcstombs(stransi, szText, sizeof(stransi));
|
||||
sscanf(stransi, "%" PRIu64, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -985,7 +985,7 @@ int image_open(uint8_t id, wchar_t *fn)
|
||||
}
|
||||
|
||||
cdimg[id] = new CDROM_Interface_Image();
|
||||
wcstombs(afn, fn, (wcslen(fn) << 1) + 2);
|
||||
wcstombs(afn, fn, sizeof(afn));
|
||||
if (!cdimg[id]->SetDevice(afn, false))
|
||||
{
|
||||
image_close(id);
|
||||
|
||||
@@ -225,7 +225,7 @@ int config_load(wchar_t *fn)
|
||||
strncpy(new_entry->name, ename, 256);
|
||||
memcpy(new_entry->wdata, &cfgbuffer[data_pos], 512);
|
||||
new_entry->wdata[255] = L'\0';
|
||||
wcstombs(new_entry->data, new_entry->wdata, 512);
|
||||
wcstombs(new_entry->data, new_entry->wdata, sizeof(new_entry->data));
|
||||
new_entry->data[255] = '\0';
|
||||
list_add(&new_entry->list, ¤t_section->entry_head);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user