pcsx-redux
pcsx-redux copied to clipboard
Fix compilation warnings
src/core/misc.cc: In function ‘bool CheckCdrom()’:
src/core/misc.cc:311:44: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const char8_t*’ [-Wformat=]
311 | sprintf(mcd1path, "memcards/games/%s-%02d.mcd",
| ~^
| |
| char*
| %hhn
312 | PCSX::g_emulator->settings.get<PCSX::Emulator::SettingPsxExe>().string().c_str(), 1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char8_t*
src/core/misc.cc:313:44: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const char8_t*’ [-Wformat=]
313 | sprintf(mcd2path, "memcards/games/%s-%02d.mcd",
| ~^
| |
| char*
| %hhn
314 | PCSX::g_emulator->settings.get<PCSX::Emulator::SettingPsxExe>().string().c_str(), 2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char8_t*
src/core/misc.cc: In function ‘void LoadLibPS()’:
src/core/misc.cc:356:20: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const char8_t*’ [-Wformat=]
356 | sprintf(buf, "%s/libps.exe",
| ~^
| |
| char*
| %hhn
357 | PCSX::g_emulator->settings.get<PCSX::Emulator::SettingBios>().value.parent_path().u8string().c_str());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char8_t*
...
src/core/cdriso.cc: In member function ‘int PCSX::CDRiso::LoadSBI(const char*)’:
src/core/cdriso.cc:1295:28: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const char8_t*’ [-Wformat=]
1295 | sprintf(sbifile, "%s%s", PCSX::g_emulator->settings.get<Emulator::SettingPpfDir>().string().c_str(), buffer);
| ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| char* const char8_t*
| %hhn
So unfortunately, hhn is a POSIX specific extension, and most likely won't work properly in a cross platform setting.
At this point, it might make more sense to start using fmt::format, like I've done in other locations of the code:
https://github.com/grumpycoders/pcsx-redux/blob/c3a4c4654409be2928704dbf43650e1b9190da99/src/gui/widgets/dwarf.cc#L40
https://fmt.dev/latest/index.html
Codecov Report
Merging #213 into master will decrease coverage by
0.00%. The diff coverage is0.00%.
@@ Coverage Diff @@
## master #213 +/- ##
=========================================
- Coverage 1.61% 1.61% -0.01%
=========================================
Files 134 134
Lines 35564 35568 +4
=========================================
Hits 574 574
- Misses 34990 34994 +4
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/core/cdriso.cc | 0.00% <0.00%> (ø) |
|
| src/core/misc.cc | 0.00% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c3a4c46...aa6795a. Read the comment docs.
@nicolasnoble I tried to understand this fmt, but please, help))
Right, well, moving over to fmt::format isn't a small undertaking :-) A lot of various algorithms and memory management routines around these functions need to change drastically. This is something that can be done at a later time. There's still much to be done :)
Yeah, we can save that for later.