diff options
author | 2019-09-11 14:16:02 -0400 | |
---|---|---|
committer | 2019-09-11 14:16:02 -0400 | |
commit | bc15184c90a7eaf4cf16ea060916346e390a7c3b (patch) | |
tree | bdf475c68602c37cba55338702343f572bbed6ee /src/osd/modules/lib/osdlib_unix.cpp | |
parent | 4f8928432a9db8cd46cfd5c6e2cb262eafaed9d2 (diff) |
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)
Diffstat (limited to 'src/osd/modules/lib/osdlib_unix.cpp')
-rw-r--r-- | src/osd/modules/lib/osdlib_unix.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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; |