winrt: Fix casting a pointer to int.

Fixes Bugzilla #5202.
This commit is contained in:
Ryan C. Gordon 2020-07-16 13:25:50 -04:00
parent 8babda2c20
commit 3b38e61a7d
1 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
sdlButton = &messageboxdata->buttons[i]; sdlButton = &messageboxdata->buttons[i];
} }
UICommand ^ button = ref new UICommand(WINRT_UTF8ToPlatformString(sdlButton->text)); UICommand ^ button = ref new UICommand(WINRT_UTF8ToPlatformString(sdlButton->text));
button->Id = safe_cast<IntPtr>((int)(sdlButton - messageboxdata->buttons)); button->Id = safe_cast<IntPtr>((size_t)(sdlButton - messageboxdata->buttons));
dialog->Commands->Append(button); dialog->Commands->Append(button);
if (sdlButton->flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { if (sdlButton->flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
dialog->CancelCommandIndex = i; dialog->CancelCommandIndex = i;
@ -104,7 +104,7 @@ WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog"); return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
} }
if (buttonid) { if (buttonid) {
IntPtr results = safe_cast<IntPtr>((int)(operation->GetResults()->Id)); IntPtr results = safe_cast<IntPtr>((size_t)(operation->GetResults()->Id));
int clicked_index = results.ToInt32(); int clicked_index = results.ToInt32();
*buttonid = messageboxdata->buttons[clicked_index].buttonid; *buttonid = messageboxdata->buttons[clicked_index].buttonid;
} }