From 3b9e6c1cecdbf6a58fee9d585956bffb4614c15d Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 4 Feb 2022 19:50:20 +0300 Subject: [PATCH] SDL_os2video.c: fixed HasClipboardText() semantics. Empty string in clipboard is expected to give FALSE by SDL_HasClipboardText. Noticed in a commit by josch1710 in bitwiseworks' os/2 fork. --- src/video/os2/SDL_os2video.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c index d624575cf..e95564888 100644 --- a/src/video/os2/SDL_os2video.c +++ b/src/video/os2/SDL_os2video.c @@ -1401,18 +1401,17 @@ static char *OS2_GetClipboardText(_THIS) static SDL_bool OS2_HasClipboardText(_THIS) { SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - SDL_bool fClipboard; + PSZ pszClipboard; if (!WinOpenClipbrd(pVData->hab)) { debug_os2("WinOpenClipbrd() failed"); return SDL_FALSE; } - fClipboard = ((PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT) != NULL)? - SDL_TRUE : SDL_FALSE; + pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); WinCloseClipbrd(pVData->hab); - return fClipboard; + return (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; }