Fix ref-count underflow, PSP timezone units, thread restart race, color codegen
- util/ref.c: refUnlock's assert(count >= 0) on an unsigned count was tautological, so a double-unlock silently underflowed to UINT32_MAX instead of asserting. Now asserts count > 0 before decrementing. - duskpsp/time/timepsp.c: timeGetRealTimeZonePSP returned hours while every other platform (and timeepoch.c's math) expects seconds. - thread.c: threadHandler reset threadId outside the mutex, after signaling STOPPED, letting a caller's immediate threadStart() race threadStartRequest()'s "thread id not 0" assert. threadId is now reset inside the same locked section. - tools/color.py: whole-number CSV channels (0, 1) produced invalid C float literals (0f, 1f) for the generated COLOR_*_3F/_4F macros. Route through float() so they always stringify with a decimal point. Also adds .claude/code-check.md: a full review pass over every subsystem in src/dusk/, with the above (plus several other findings not yet acted on) written up in detail. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+7
-2
@@ -48,6 +48,11 @@ out = [
|
||||
js = []
|
||||
for name, (r, g, b, a) in colors.items():
|
||||
r8, g8, b8, a8 = (int(float(ch) * 255) for ch in (r, g, b, a))
|
||||
# Route through float() rather than the raw CSV string -- a whole-number
|
||||
# channel like "0" or "1" has no decimal point, and "0f"/"1f" aren't
|
||||
# valid C float literals (float() always stringifies with one, e.g.
|
||||
# "0.0"/"1.0").
|
||||
rf, gf, bf, af = (float(ch) for ch in (r, g, b, a))
|
||||
macro = "COLOR_" + name.upper()
|
||||
camel = "".join(p[0].upper() + p[1:].lower() for p in name.split("_"))
|
||||
|
||||
@@ -55,8 +60,8 @@ for name, (r, g, b, a) in colors.items():
|
||||
f"// {name}",
|
||||
f"#define {macro}_4B color4b({r8}, {g8}, {b8}, {a8})",
|
||||
f"#define {macro}_3B color3b({r8}, {g8}, {b8})",
|
||||
f"#define {macro}_3F color3f({r}f, {g}f, {b}f)",
|
||||
f"#define {macro}_4F color4f({r}f, {g}f, {b}f, {a}f)",
|
||||
f"#define {macro}_3F color3f({rf}f, {gf}f, {bf}f)",
|
||||
f"#define {macro}_4F color4f({rf}f, {gf}f, {bf}f, {af}f)",
|
||||
f"#define {macro} {macro}_4B",
|
||||
"",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user