From 4b55dc8caeddce64f35c5d3386f4f03c0f350b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Sat, 3 May 2025 01:41:18 +0200 Subject: [PATCH] plat: use size_t for global dir path buffer length --- src/include/86box/plat.h | 4 ++-- src/qt/qt_platform.cpp | 12 ++++++------ src/unix/unix.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index bbc673dcf..de0a9f30c 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -143,8 +143,8 @@ extern int plat_getcwd(char *bufp, int max); extern int plat_chdir(char *path); extern void plat_tempfile(char *bufp, char *prefix, char *suffix); extern void plat_get_exe_name(char *s, int size); -extern void plat_get_global_config_dir(char *outbuf, uint8_t len); -extern void plat_get_global_data_dir(char *outbuf, uint8_t len); +extern void plat_get_global_config_dir(char *outbuf, size_t len); +extern void plat_get_global_data_dir(char *outbuf, size_t len); extern void plat_get_temp_dir(char *outbuf, uint8_t len); extern void plat_init_rom_paths(void); extern int plat_dir_check(char *path); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index be40452fd..3bdbdf569 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -595,14 +595,14 @@ ProgSettings::reloadStrings() { translatedstrings.clear(); translatedstrings[STRING_MOUSE_CAPTURE] = QCoreApplication::translate("", "Click to capture mouse").toStdWString(); - + char mouseCaptureKeyseq[100]; sprintf(mouseCaptureKeyseq, qPrintable(QCoreApplication::translate("", "Press %s to release mouse")), acc_keys[FindAccelerator("release_mouse")].seq); translatedstrings[STRING_MOUSE_RELEASE] = QString(mouseCaptureKeyseq).toStdWString(); - + sprintf(mouseCaptureKeyseq, qPrintable(QCoreApplication::translate("", "Press %s or middle button to release mouse")), acc_keys[FindAccelerator("release_mouse")].seq); - translatedstrings[STRING_MOUSE_RELEASE_MMB] = QString(mouseCaptureKeyseq).toStdWString(); - + translatedstrings[STRING_MOUSE_RELEASE_MMB] = QString(mouseCaptureKeyseq).toStdWString(); + translatedstrings[STRING_INVALID_CONFIG] = QCoreApplication::translate("", "Invalid configuration").toStdWString(); translatedstrings[STRING_NO_ST506_ESDI_CDROM] = QCoreApplication::translate("", "MFM/RLL or ESDI CD-ROM drives never existed").toStdWString(); translatedstrings[STRING_PCAP_ERROR_NO_DEVICES] = QCoreApplication::translate("", "No PCap devices found").toStdWString(); @@ -639,7 +639,7 @@ plat_chdir(char *path) } void -plat_get_global_config_dir(char *outbuf, const uint8_t len) +plat_get_global_config_dir(char *outbuf, const size_t len) { const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)[0]); if (!dir.exists()) { @@ -651,7 +651,7 @@ plat_get_global_config_dir(char *outbuf, const uint8_t len) } void -plat_get_global_data_dir(char *outbuf, const uint8_t len) +plat_get_global_data_dir(char *outbuf, const size_t len) { const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[0]); if (!dir.exists()) { diff --git a/src/unix/unix.c b/src/unix/unix.c index 2e92a90d3..bdee9006b 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -844,7 +844,7 @@ plat_init_rom_paths(void) } void -plat_get_global_config_dir(char *outbuf, const uint8_t len) +plat_get_global_config_dir(char *outbuf, const size_t len) { char *prefPath = SDL_GetPrefPath(NULL, "86Box"); strncpy(outbuf, prefPath, len); @@ -853,7 +853,7 @@ plat_get_global_config_dir(char *outbuf, const uint8_t len) } void -plat_get_global_data_dir(char *outbuf, const uint8_t len) +plat_get_global_data_dir(char *outbuf, const size_t len) { char *prefPath = SDL_GetPrefPath(NULL, "86Box"); strncpy(outbuf, prefPath, len);