Rangi
21eaa2d2cc
Fix a > to >=, and avoid underflow in some sanity checks
2026-07-13 13:14:06 -04:00
Rangi
e9fa1e4e94
Avoid closing stdin/stdout/stderr standard streams
2026-07-13 13:02:46 -04:00
Rangi
4857ad1e00
Fix crash on image without any colors (all transparent)
2026-07-11 13:18:40 -04:00
Rangi
3b33c942ae
Fix a crash and a limitation in RGBGFX unoptimized output
...
- If both banks 0 and 1 were completely filled, then
`assume(bank == 0)` would false and potentially crash.
- If the input image had fully-background tiles, they would be
incorrectly counted towards `nbTiles` and could cause the
"Image contains N tiles, exceeding the limit" check to fail.
2026-07-11 12:32:31 -04:00
Rangi
be4c1161bd
Fix RGBGFX crash when trimming more tiles than exist after deduplication
2026-07-10 17:35:32 -04:00
Rangi
0e1e5e80f6
Use correct PRIu32 format spec for uint32_t usedTotal
2026-07-10 17:01:43 -04:00
Rangi
118f1f7543
Correct option letter in error message
2026-07-10 16:59:30 -04:00
Rangi
eaa35ed26d
Remove dead return after no-return fatal call
2026-07-10 14:36:46 -04:00
Rangi
7b39bcd412
Refactor expression for clarity
...
`tileData[realY + 1 % options.bitDepth]` relied on order of
operations and the fact that `1 % 1 == 0` but `1 % 2 == 1` for
correct indexing. However, it was not obvious at first glance,
and confusable with the more common `(base + offset) % size`
pattern. (And would need changing anyway if we ever support 4bpp.)
2026-07-10 14:30:25 -04:00
Rangi
255cd7f7f6
Fix a typo in a comment
2026-07-10 14:29:32 -04:00
Rangi
b8011947a8
Correct assumption to avoid UB with 1 << 31
2026-07-09 21:36:34 -04:00
Rangi
39e7e064c9
Print correct color set limit value in error message
2026-07-09 21:29:02 -04:00
Rangi
7b97d7ce15
Fix RGBGFX crash on deduplicating transparent tiles
2026-07-09 21:24:59 -04:00
Rangi
c667bac93a
Use trailing return type for begin()/end()
2026-07-08 16:57:52 -04:00
Rangi
db96144d49
Use [[nodiscard]] instead of [[gnu::warn_unused_result]]
2026-07-08 16:44:15 -04:00
Rangi
276a1a7952
Use const_cast more precisely to remove const without changing type
2026-07-08 16:42:53 -04:00
Rangi
b219e03b38
Use more structured bindings
2026-07-08 16:38:32 -04:00
Rangi
824ebd80f9
Use [[fallthrough]]; attribute instead of // fallthrough comment
2026-07-08 16:30:52 -04:00
Rangi
5aedf31b46
Prevent 32-bit multiplication overflow
...
Basically impossible to achieve, but just in case
2026-07-07 17:02:46 -04:00
Rangi
ed8e3e4d02
Reset errno = 0 before parseWholeNumber calls and errno == ERANGE checks
2026-07-07 17:02:46 -04:00
Rangi
30fd4514dc
Add fail-safe for invalid RPN commands in bad object files
2026-07-07 17:02:46 -04:00
Rangi
08e83601f5
Fix CRLF check in parsing SDAS objects
2026-07-07 17:02:46 -04:00
Rangi
e606f4e997
Fix condition for invalid bank range check ( #2016 )
2026-07-07 17:02:35 -04:00
Rangi
21682e8814
Consistently handle negative shifted macro args ( #2014 )
...
Negative macro arguments count from the end, i.e. `\<-1>`
is equivalent to `\<_NARG>`, even after `shift`ing them.
Negative arguments cannot be used to access shifted values.
2026-07-07 02:19:37 -04:00
Rangi
f82b0838a1
Disallow minus sign before symbol name in bracketed macro arguments ( #2015 )
...
This was being silently allowed but without actually negating the symbol's value
2026-07-07 00:42:09 -04:00
Rangi
dabd0a08d2
Remove impossible condition (uint64_t > UINT64_MAX)
2026-07-06 23:08:05 -04:00
Rangi
c3e10dbb03
Safeguard against localtime or gmtime failure
2026-07-06 23:05:19 -04:00
Rangi
3883c2a2b8
Reuse scrambleLimit instead of its equivalent expression
2026-07-06 22:50:31 -04:00
Rangi
cd0caaaceb
Clarify comment about -Wno-* behavior with parametric warnings
2026-07-06 22:44:39 -04:00
Rangi
1e4a060d9e
Guard against undefined behavior in double2fix
...
I haven't found input which triggers any, but this is more
technically correct just in case.
2026-07-06 22:38:06 -04:00
Rangi
fe3b238dea
Do not allow defining labels outside sections ( #2013 )
...
Creating a `Symbol` with `type = SYM_LABEL` but `section = nullptr`
is inconsistent and dangerous. I was not able to cause any buggy
behavior so far, but it's safer and reasonable to not create such
a symbol in the first place.
The main consequence is that `DEF(LabelOutsideSection)` will now
evaluate as 0.
2026-07-06 16:18:42 -04:00
Rangi
46a6966b70
Fix $8000_0000 % -1 to warn with -Wdiv like $8000_0000 / -1 does ( #2012 )
2026-07-06 15:08:44 -04:00
Rangi
be3fc61859
Fix included linker scripts with no newline at EOF ( #2011 )
2026-07-06 14:01:40 -04:00
Rangi
6e643406a2
Refactor warning diagnostic code to reduce repeated output logic
2026-07-04 23:02:16 -04:00
Rangi
de36a11be7
Prevent rgblink -Wno-* disabled warnings from printing a location trace anyway
...
Fixes #2005
2026-07-04 23:02:16 -04:00
Rangi
799c55b4dd
Add [[gnu::format(printf, 1, 2)]] attribute to variadic function sectError
2026-07-04 23:02:16 -04:00
Rangi
ddd8f37508
Remove unnecessary default constructor for Token
2026-07-04 18:48:03 -04:00
Rangi
0996a2f5ed
Encapuslate UTF-8 decoder state in a struct
2026-07-03 19:35:23 -04:00
Rangi
daba94b495
Remove pointless std::move from non-move constructor
2026-07-03 13:12:29 -04:00
Rangi
2f604bfa9a
Fix error message when an rgbgfx output file cannot be created
2026-07-03 13:08:28 -04:00
Rangi
9bbb2247a7
Fix rgbasm -Werror=... not adding to the final error count
2026-07-03 13:05:33 -04:00
Rangi
caf561457d
Warn about CMake <3.27 for Windows-targeted builds ( #1989 )
...
We only use `$<INSTALL_PREFIX>`` when cross-compiling for MinGW on Linux,
so the relevant block is now wrapped in `if(WIN32)`
so a user can more easily lower the `cmake_minimum_required` version.
2026-06-24 23:53:11 +02:00
Rangi
fc7d9ad573
Handle more numeric literal syntax errors in linker scripts
2026-06-09 18:46:51 -04:00
Rangi
0b91bf654b
Rename BaseV to ValidBaseV
2026-06-09 17:55:38 -04:00
Rangi
6b2b6e6000
Fix off-by-one error with INCLUDEd linker script line numbers
2026-06-09 16:16:21 -04:00
Rangi42
f72a4d53e2
Add -Wlarge-constant to RGBLINK as it is for RGBASM
2026-06-09 16:16:21 -04:00
vulcandth
998f636495
Fix rgbgfx -Z palette overgeneration on merged color sets ( #1912 )
...
- Fix logic for color set comparison (which affects sorting them)
- Prune color sets which are proper subsets of newly-encountered ones
(a comment implied we were already doing this, but we weren't)
- Add more verbose logging to debug this behavior
2026-06-07 09:55:05 -04:00
Rangi
075f132d77
Use a smaller unordered_map just for looking up line-leading keywords
2026-05-27 22:01:20 -04:00
Rangi
31e1d2ec87
Do not build up a std::string when skipping leading keywords
2026-05-27 22:01:20 -04:00
Rangi
673c62414f
Use std::string_view keys for UpperMap
...
This avoids constructing temporary `std::string` objects on lookup
2026-05-27 22:01:20 -04:00