diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-12-06 21:11:44 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-12-27 13:19:25 +0100 |
commit | f3326d34e78bd28fba6d8cfd3bc455a506b429fe (patch) | |
tree | 307a0608a7fb1c211fd72a8b8326cfe9bb1d37a2 /src/video | |
parent | 0c6e8a8123c9f74db757272f73adcbd8621e012d (diff) | |
download | openttd-f3326d34e78bd28fba6d8cfd3bc455a506b429fe.tar.xz |
Codechange: Use std::string in FIO search path handling.
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/cocoa/cocoa_v.mm | 2 | ||||
-rw-r--r-- | src/video/sdl2_v.cpp | 6 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index f02599799..e4a0a0c6f 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -551,8 +551,8 @@ void cocoaSetApplicationBundleDir() char tmp[MAXPATHLEN]; CFAutoRelease<CFURLRef> url(CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle())); if (CFURLGetFileSystemRepresentation(url.get(), true, (unsigned char*)tmp, MAXPATHLEN)) { - AppendPathSeparator(tmp, lastof(tmp)); _searchpaths[SP_APPLICATION_BUNDLE_DIR] = tmp; + AppendPathSeparator(_searchpaths[SP_APPLICATION_BUNDLE_DIR]); } else { _searchpaths[SP_APPLICATION_BUNDLE_DIR].clear(); } diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 852f7298d..ea2a88bb9 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -285,10 +285,10 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize) return false; } - char icon_path[MAX_PATH]; - if (FioFindFullPath(icon_path, lastof(icon_path), BASESET_DIR, "openttd.32.bmp") != nullptr) { + std::string icon_path = FioFindFullPath(BASESET_DIR, "openttd.32.bmp"); + if (!icon_path.empty()) { /* Give the application an icon */ - SDL_Surface *icon = SDL_LoadBMP(icon_path); + SDL_Surface *icon = SDL_LoadBMP(icon_path.c_str()); if (icon != nullptr) { /* Get the colourkey, which will be magenta */ uint32 rgbmap = SDL_MapRGB(icon->format, 255, 0, 255); diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 98777a87d..4f5167335 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -266,10 +266,10 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h) if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals"); - char icon_path[MAX_PATH]; - if (FioFindFullPath(icon_path, lastof(icon_path), BASESET_DIR, "openttd.32.bmp") != nullptr) { + std::string icon_path = FioFindFullPath(BASESET_DIR, "openttd.32.bmp"); + if (!icon_path.empty()) { /* Give the application an icon */ - icon = SDL_LoadBMP(icon_path); + icon = SDL_LoadBMP(icon_path.c_str()); if (icon != nullptr) { /* Get the colourkey, which will be magenta */ uint32 rgbmap = SDL_MapRGB(icon->format, 255, 0, 255); |