Skip to content

Commit

Permalink
IOS: Replace strdup with Common::String
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover authored and sev- committed Aug 18, 2018
1 parent 481b608 commit d43732a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions backends/platform/ios7/ios7_osys_main.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ OSystem_iOS7::OSystem_iOS7() :
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false), _screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false), _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0), _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
_lastErrorMessage(NULL), _mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) { _mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) {
_queuedInputEvent.type = Common::EVENT_INVALID; _queuedInputEvent.type = Common::EVENT_INVALID;
_touchpadModeEnabled = !iOS7_isBigDevice(); _touchpadModeEnabled = !iOS7_isBigDevice();
#ifdef IPHONE_SANDBOXED #ifdef IPHONE_SANDBOXED
Expand Down Expand Up @@ -352,8 +352,7 @@ void OSystem_iOS7::logMessage(LogMessageType::Type type, const char *message) {
output = stderr; output = stderr;


if (type == LogMessageType::kError) { if (type == LogMessageType::kError) {
free(_lastErrorMessage); _lastErrorMessage = message;
_lastErrorMessage = strdup(message);
} }


fputs(message, output); fputs(message, output);
Expand Down
3 changes: 2 additions & 1 deletion backends/platform/ios7/ios7_osys_main.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "backends/platform/ios7/ios7_common.h" #include "backends/platform/ios7/ios7_common.h"
#include "backends/base-backend.h" #include "backends/base-backend.h"
#include "common/events.h" #include "common/events.h"
#include "common/str.h"
#include "audio/mixer_intern.h" #include "audio/mixer_intern.h"
#include "backends/fs/posix/posix-fs-factory.h" #include "backends/fs/posix/posix-fs-factory.h"
#include "graphics/colormasks.h" #include "graphics/colormasks.h"
Expand Down Expand Up @@ -109,7 +110,7 @@ class OSystem_iOS7 : public EventsBaseBackend, public PaletteManager {
bool _fullScreenOverlayIsDirty; bool _fullScreenOverlayIsDirty;
int _screenChangeCount; int _screenChangeCount;


char *_lastErrorMessage; Common::String _lastErrorMessage;


#ifdef IPHONE_SANDBOXED #ifdef IPHONE_SANDBOXED
Common::String _chrootBasePath; Common::String _chrootBasePath;
Expand Down
4 changes: 2 additions & 2 deletions backends/platform/ios7/ios7_osys_video.mm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ static void displayAlert(void *ctx) {
} }


void OSystem_iOS7::fatalError() { void OSystem_iOS7::fatalError() {
if (_lastErrorMessage) { if (_lastErrorMessage.size()) {
dispatch_async_f(dispatch_get_main_queue(), _lastErrorMessage, displayAlert); dispatch_async_f(dispatch_get_main_queue(), (void *)_lastErrorMessage.c_str(), displayAlert);
for(;;); for(;;);
} }
else { else {
Expand Down

0 comments on commit d43732a

Please sign in to comment.