Fixed warning C6263: Using _alloca in a loop: this can quickly overflow stack.

This commit is contained in:
Sam Lantinga
2023-12-04 20:30:52 -08:00
parent 4ccc53edfe
commit c9b243fb56

View File

@@ -1288,16 +1288,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
HDROP drop = (HDROP)wParam;
UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
for (i = 0; i < count; ++i) {
SDL_bool isstack;
UINT size = DragQueryFile(drop, i, NULL, 0) + 1;
LPTSTR buffer = SDL_small_alloc(TCHAR, size, &isstack);
LPTSTR buffer = (LPTSTR)SDL_malloc(sizeof(TCHAR) * size);
if (buffer) {
if (DragQueryFile(drop, i, buffer, size)) {
char *file = WIN_StringToUTF8(buffer);
SDL_SendDropFile(data->window, NULL, file);
SDL_free(file);
}
SDL_small_free(buffer, isstack);
SDL_free(buffer);
}
}
SDL_SendDropComplete(data->window);