- if (OpenClipboard (NULL) != 0)
- {
- HANDLE hClipboardData;
-
- if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0)
- {
- if ((cliptext = (char *)GlobalLock (hClipboardData)) != 0)
- {
- size_t allocsize;
- allocsize = GlobalSize (hClipboardData) + 1;
- data = (char *)Z_Malloc (allocsize);
- strlcpy (data, cliptext, allocsize);
- GlobalUnlock (hClipboardData);
- }
- }
- CloseClipboard ();
+ cliptext = SDL_GetClipboardText();
+ if (cliptext != NULL) {
+ size_t allocsize;
+ allocsize = min(MAX_INPUTLINE, strlen(cliptext) + 1);
+ data = (char *)Z_Malloc (allocsize);
+ strlcpy (data, cliptext, allocsize);
+ SDL_free(cliptext);