summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-06-12 09:10:17 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-13 12:45:45 +0200
commit55a11710a6c0f7942f3947711f2050c34782c39d (patch)
tree491b3009324e623236977614e91371a0ea4abac7 /src/os
parenta99ac62c1ab816ee48cac85fdf834f9fdc599cb1 (diff)
downloadopenttd-55a11710a6c0f7942f3947711f2050c34782c39d.tar.xz
Codechange: convert printf DEBUG statements to fmt Debug statements
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macosx/font_osx.cpp6
-rw-r--r--src/os/os2/os2.cpp2
-rw-r--r--src/os/unix/font_unix.cpp2
-rw-r--r--src/os/unix/unix.cpp8
-rw-r--r--src/os/windows/font_win32.cpp12
-rw-r--r--src/os/windows/win32.cpp6
6 files changed, 18 insertions, 18 deletions
diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp
index 295fcf257..b931e7407 100644
--- a/src/os/macosx/font_osx.cpp
+++ b/src/os/macosx/font_osx.cpp
@@ -57,7 +57,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
}
if (os_err == noErr) {
- DEBUG(freetype, 3, "Font path for %s: %s", font_name, file_path);
+ Debug(freetype, 3, "Font path for {}: {}", font_name, file_path);
err = FT_New_Face(_library, (const char *)file_path, 0, face);
}
@@ -134,7 +134,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
/* Save result. */
callback->SetFontNames(settings, name);
if (!callback->FindMissingGlyphs()) {
- DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
+ Debug(freetype, 2, "CT-Font for {}: {}", language_isocode, name);
result = true;
break;
}
@@ -221,7 +221,7 @@ void CoreTextFontCache::SetFontSize(int pixels)
CFStringGetCString(font_name.get(), name, lengthof(name), kCFStringEncodingUTF8);
this->font_name = name;
- DEBUG(freetype, 2, "Loaded font '%s' with size %d", this->font_name.c_str(), pixels);
+ Debug(freetype, 2, "Loaded font '{}' with size {}", this->font_name, pixels);
}
GlyphID CoreTextFontCache::MapCharToGlyph(WChar key)
diff --git a/src/os/os2/os2.cpp b/src/os/os2/os2.cpp
index d3de2631b..6e190cfa1 100644
--- a/src/os/os2/os2.cpp
+++ b/src/os/os2/os2.cpp
@@ -206,7 +206,7 @@ bool GetClipboardContents(char *buffer, const char *last)
void OSOpenBrowser(const char *url)
{
// stub only
- DEBUG(misc, 0, "Failed to open url: %s", url);
+ Debug(misc, 0, "Failed to open url: {}", url);
}
void SetCurrentThreadName(const char *)
diff --git a/src/os/unix/font_unix.cpp b/src/os/unix/font_unix.cpp
index b607db8f8..f8cf96a48 100644
--- a/src/os/unix/font_unix.cpp
+++ b/src/os/unix/font_unix.cpp
@@ -148,7 +148,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
callback->SetFontNames(settings, (const char *)file);
bool missing = callback->FindMissingGlyphs();
- DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
+ Debug(freetype, 1, "Font \"{}\" misses{} glyphs", file, missing ? "" : " no");
if (!missing) {
best_weight = value;
diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp
index 8bb947e85..f696f817f 100644
--- a/src/os/unix/unix.cpp
+++ b/src/os/unix/unix.cpp
@@ -164,7 +164,7 @@ static const char *convert_tofrom_fs(iconv_t convd, const char *name, char *outb
iconv(convd, nullptr, nullptr, nullptr, nullptr);
if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
- DEBUG(misc, 0, "[iconv] error converting '%s'. Errno %d", name, errno);
+ Debug(misc, 0, "[iconv] error converting '{}'. Errno {}", name, errno);
}
*outbuf = '\0';
@@ -186,7 +186,7 @@ std::string OTTD2FS(const std::string &name)
const char *env = GetLocalCode();
convd = iconv_open(env, INTERNALCODE);
if (convd == (iconv_t)(-1)) {
- DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", INTERNALCODE, env);
+ Debug(misc, 0, "[iconv] conversion from codeset '{}' to '{}' unsupported", INTERNALCODE, env);
return name;
}
}
@@ -208,7 +208,7 @@ std::string FS2OTTD(const std::string &name)
const char *env = GetLocalCode();
convd = iconv_open(INTERNALCODE, env);
if (convd == (iconv_t)(-1)) {
- DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", env, INTERNALCODE);
+ Debug(misc, 0, "[iconv] conversion from codeset '{}' to '{}' unsupported", env, INTERNALCODE);
return name;
}
}
@@ -306,7 +306,7 @@ void OSOpenBrowser(const char *url)
args[1] = url;
args[2] = nullptr;
execvp(args[0], const_cast<char * const *>(args));
- DEBUG(misc, 0, "Failed to open url: %s", url);
+ Debug(misc, 0, "Failed to open url: {}", url);
exit(0);
}
#endif /* __APPLE__ */
diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp
index 956e4a85c..c93e95e69 100644
--- a/src/os/windows/font_win32.cpp
+++ b/src/os/windows/font_win32.cpp
@@ -78,7 +78,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, FONT_DIR_NT, 0, KEY_READ, &hKey);
if (ret != ERROR_SUCCESS) {
- DEBUG(freetype, 0, "Cannot open registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
+ Debug(freetype, 0, "Cannot open registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
return err;
}
@@ -113,7 +113,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
}
if (!SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_FONTS, nullptr, SHGFP_TYPE_CURRENT, vbuffer))) {
- DEBUG(freetype, 0, "SHGetFolderPath cannot return fonts directory");
+ Debug(freetype, 0, "SHGetFolderPath cannot return fonts directory");
goto folder_error;
}
@@ -334,17 +334,17 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
info->callback->SetFontNames(info->settings, font_name, &logfont->elfLogFont);
if (info->callback->FindMissingGlyphs()) return 1;
- DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
+ Debug(freetype, 1, "Fallback font: {} ({})", font_name, english_name);
return 0; // stop enumerating
}
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
{
- DEBUG(freetype, 1, "Trying fallback fonts");
+ Debug(freetype, 1, "Trying fallback fonts");
EFCParam langInfo;
if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(wchar_t)) == 0) {
/* Invalid langid or some other mysterious error, can't determine fallback font. */
- DEBUG(freetype, 1, "Can't get locale info for fallback font (langid=0x%x)", winlangid);
+ Debug(freetype, 1, "Can't get locale info for fallback font (langid=0x{:x})", winlangid);
return false;
}
langInfo.settings = settings;
@@ -439,7 +439,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels)
this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth;
this->glyph_size.cy = otm->otmTextMetrics.tmHeight;
- DEBUG(freetype, 2, "Loaded font '%s' with size %d", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)).c_str(), pixels);
+ Debug(freetype, 2, "Loaded font '{}' with size {}", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)), pixels);
}
/**
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp
index 788021008..938aee5f9 100644
--- a/src/os/windows/win32.cpp
+++ b/src/os/windows/win32.cpp
@@ -471,7 +471,7 @@ void DetermineBasePaths(const char *exe)
wchar_t config_dir[MAX_PATH];
wcsncpy(path, convert_to_fs(_config_file.c_str(), path, lengthof(path)), lengthof(path));
if (!GetFullPathName(path, lengthof(config_dir), config_dir, nullptr)) {
- DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
+ Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
_searchpaths[SP_WORKING_DIR].clear();
} else {
std::string tmp(FS2OTTD(config_dir));
@@ -483,13 +483,13 @@ void DetermineBasePaths(const char *exe)
}
if (!GetModuleFileName(nullptr, path, lengthof(path))) {
- DEBUG(misc, 0, "GetModuleFileName failed (%lu)\n", GetLastError());
+ Debug(misc, 0, "GetModuleFileName failed ({})", GetLastError());
_searchpaths[SP_BINARY_DIR].clear();
} else {
wchar_t exec_dir[MAX_PATH];
wcsncpy(path, convert_to_fs(exe, path, lengthof(path)), lengthof(path));
if (!GetFullPathName(path, lengthof(exec_dir), exec_dir, nullptr)) {
- DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
+ Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
_searchpaths[SP_BINARY_DIR].clear();
} else {
std::string tmp(FS2OTTD(exec_dir));