Commit Graph

9 Commits

Author SHA1 Message Date
David Korth
e3a427f6c2 [cmake] msvc.cmake: Make all warnings act as errors. (/W3 /WX)
The MSVC build (64-bit, at least...) now builds with no warnings.
Tested using MSVC 2022 17.6.5.

NOTE: /W4 adds a *lot* of warnings that are mostly just noise. Need to
check /W4 and selectively enable at least some of them...

Removed /wd4482. I don't think this warning is relevant anymore.

Warning fixes:

[extlib] Add (unsigned int) casts where necessary.

[librpbase] Config::ImgTypePrio_t, KeyManager::KeyData_t:
- Change `length` from unsigned int to size_t.
  The struct is 16 bytes on 64-bit either way, but making it size_t
  fixes some conversion warnings.

[librpbase] Hash::Process():
- crc32() returns `unsigned long`, not `uint32_t`, for some reason.
- Also, its length parameter is `unsigned int`, not `size_t`.
- KeyManager::hexStringToBytes(): Take a `size_t` length parameter.

[librpfile] scsi:
- Change cdb_len from `uint8_t` to `size_t`. Using a `uint8_t` argument
  doesn't actually save any memory, since it uses 4 bytes on the stack
  for 32-bit, and one register on 64-bit, regardless.
- Also, limit the maximum cdb size to 260.

[rp-download] Disable warning C4996 when calling GetVersionEx().

[librptexture] DirectDrawSurface:
- Change some `expected_size` variables from `unsigned int` to `size_t`.

[librptexture] PalmOS_Tbmp:
- Change d->bitmapTypeAddr from `off64_t` to `uint32_t`.
- Change some size variables from `unsigned int` to `size_t`.
- loadTbmp(): v3 transparency: Explicitly cast the transparency value
  to uint16_t. (It's stored as a big-endian 32-bit value, but only
  16 bits are used.)
- getNextTbmpAddress(): Cast addresses to `uint32_t`. PalmOS executables
  are 32-bit and cannot possibly exceed 4 GB.
  - FIXME: This function isn't used? (Was it ever used?)

[libromdata]
- DMGPrivate::CartType(): Make `end_offset` constexpr.
- NCCHReader: Add casts for EncSections when using sizeof().
- KeyStoreUIPrivate: binToHexStr(), verifyKeyData():
  - Take a `size_t` length parameter.
- WiiUPackagePrivate: Added a parseHexBinary32() wrapper function
  that returns `uint32_t` instead of `uint64_t`.

[librpbyteswap/tests]
- BitstuffTest: Cast time(nullptr) to `unsigned int`.
  srand() takes `unsigned int`, not `time_t`.

[librpbase/tests]
- RpPngFormatTest: crc32()'s length parameter is `unsigned int`,
  not `size_t`.

[libromdata/tests]
- SuperMagicDriveTest: zlib uses `unsigned int`, so cast array sizes
  to `unsigned int` instead of changing decompress() to take `size_t`.
2025-03-31 21:34:35 -04:00
David Korth
f0647da5eb Remove CheckHiddenVisibility.cmake.
The root CMakeLists.txt has a minimum CMake version of 3.5, and
CheckHiddenVisibility.cmake's workarounds are only needed for
CMake 3.2 and earlier.

Set CMP0063 unconditionally (added in CMake 3.3) and set the
CMAKE_<LANG>_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
variables where CHECK_HIDDEN_VISIBILITY() was called before.

There should effectively be no code changes with this commit.
2025-01-18 22:34:24 -05:00
David Korth
d470035e61 Switch to CMake's POSITION_INDEPENDENT_CODE property instead of manually adding "-fpic -fPIC".
Something changed that caused the build on Xubuntu 16.04 (32-bit) to fail:

[ 63%] Linking CXX shared library ../../lib/libromdata.so
/usr/bin/ld: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
src/libromdata/CMakeFiles/romdata.dir/build.make:3614: recipe for target 'lib/libromdata.so.6.0' failed
make[2]: *** [lib/libromdata.so.6.0] Error 1

Setting POSITION_INDEPENDENT_CODE instead of "-fpic -fPIC" fixes this.

[extlib] Correctly set properties on the 'mspack' target instead of
'libmspack'. Otherwise, libmspack won't have either EXCLUDE_FROM_ALL
or POSITION_INDEPENDENT_CODE.
2025-01-05 14:02:13 -05:00
David Korth
70945ed34a [uniwidth] Update to Unicode 16.0.0. 2024-09-25 21:56:44 -04:00
David Korth
afbddbdf1c [uniwidth] Update to Unicode 15.1.0 and assign width 1 to prepended concatenation marks. 2024-02-17 17:04:15 -05:00
David Korth
cb92c10a99 [uniwidth] width[02].h: Update license headers. 2023-02-10 18:15:31 -05:00
David Korth
ead260291e [uniwidth] Update to Unicode 15.0.0. 2022-10-16 17:27:54 -04:00
David Korth
1547c3e619 [uniwidth] Add streq.h for cjk.h.
We're not using cjk.h right now, but better to ensure that it *is* usable
in case we decide to use it later.

[debian] copyright: Update copyrights for uniwidth.
2022-08-28 21:23:45 -04:00
David Korth
e644206255 [uniwidth] Import of the uniwidth subset of gnulib.
uniwidth provides a uc_width() function, which is similar to wcwidth().
Our version removes the 'encoding' parameter, which isn't needed because
we're always using UTF-8.

Fixes #353: rpcli: bad table alignment on multibyte characters
Reported by @DankRank.
2022-08-28 18:47:34 -04:00