From bc15184c90a7eaf4cf16ea060916346e390a7c3b Mon Sep 17 00:00:00 2001 From: npwoods Date: Wed, 11 Sep 2019 14:16:02 -0400 Subject: Changed osd_get_clipboard_text() to return std::string (#5615) * Changed osd_get_clipboard_text() to return std::string This change has only been tested on Windows. The Un*x/Mac versions were made blindly; they might not even build. This needs to be checked prior to merging. * Fixing Mac OS X build (hopefully) --- src/osd/modules/lib/osdlib_unix.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/osd/modules/lib/osdlib_unix.cpp') diff --git a/src/osd/modules/lib/osdlib_unix.cpp b/src/osd/modules/lib/osdlib_unix.cpp index ba3eec9662c..178fb4594cb 100644 --- a/src/osd/modules/lib/osdlib_unix.cpp +++ b/src/osd/modules/lib/osdlib_unix.cpp @@ -100,24 +100,23 @@ void osd_break_into_debugger(const char *message) } #ifdef SDLMAME_ANDROID -char *osd_get_clipboard_text(void) +std::string osd_get_clipboard_text(void) { - return nullptr; + return std::string(); } #else //============================================================ // osd_get_clipboard_text //============================================================ -char *osd_get_clipboard_text(void) +std::string osd_get_clipboard_text(void) { - char *result = nullptr; + std::string result; if (SDL_HasClipboardText()) { char *temp = SDL_GetClipboardText(); - result = (char *) malloc(strlen(temp) + 1); - strcpy(result, temp); + result.assign(temp); SDL_free(temp); } return result; -- cgit v1.2.3-70-g09d2