You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: cf_literal_to_str keeps the closing quote after an escape; strref_cmp_strref asymmetric on empty #48
Two behaviours the Phase 3 characterization tests pin as "characterized, not endorsed":
cf-lexer.ccf_literal_to_str decrements count once per output char, not once per consumed char, so "a\nb" yields a<LF>b" (the closing quote is kept after an escape).
lexer.cstrref_cmp_strref returns -1 in both directions when only one side is empty.
Decide per case: fix in C (and update the pinned tests), or preserve them as documented differences in the lexer ports (#43).
Proposal for both, as the lexer ports (#41, #49) currently preserve them:
cf_literal_to_str keeping the closing quote: fix in C. It's a plain bug. The result for any literal with an escape has a stray " (or ') at the end, so callers get a<LF>b" for "a\nb". The fix is to decrement the remaining count by the characters actually consumed. I'd send it like libobs/util: Fix dstr_insert_ch overrun and dstr_replace hang #53: a C fix with an updated pinned assertion in test_cf_lexer.c and a note in the PR. Then the port follows C again.
strref_cmp_strref returning -1 both ways when one side is empty: keep as documented. Its only two callers in the tree (cf-lexer.c: macro parameter and define lookup) compare the result against 0, so the sign is never observed, and changing it has no benefit.
If that works for you, I'll open the cf_literal_to_str fix.
Activity
b7216309-jpg commentedon Oct 9, 2026
Proposal for both, as the lexer ports (#41, #49) currently preserve them:
cf_literal_to_strkeeping the closing quote: fix in C. It's a plain bug. The result for any literal with an escape has a stray"(or') at the end, so callers geta<LF>b"for"a\nb". The fix is to decrement the remaining count by the characters actually consumed. I'd send it like libobs/util: Fix dstr_insert_ch overrun and dstr_replace hang #53: a C fix with an updated pinned assertion intest_cf_lexer.cand a note in the PR. Then the port follows C again.strref_cmp_strrefreturning -1 both ways when one side is empty: keep as documented. Its only two callers in the tree (cf-lexer.c: macro parameter and define lookup) compare the result against 0, so the sign is never observed, and changing it has no benefit.If that works for you, I'll open the
cf_literal_to_strfix.test(libobs): RED cf_literal_to_str closing-quote test (#48)
libobs/util: Drop the closing quote in cf_literal_to_str
zackees commentedon Oct 9, 2026
Both halves are fixed in C:
cf_literal_to_strno longer keeps the closing quote after an escape (libobs/util: Drop the closing quote in cf_literal_to_str #54).strref_cmp_strrefandstrref_cmpi_strrefnow order an empty strref before any non-empty one in both argument orders (libobs/util: Order empty strrefs consistently in strref compares #60).Each started with a failing test and ended green. The lexer port (#41/#43) should follow the new behaviour.
test(libobs): RED strref compare empty-ordering test (obs-rust#48)
libobs/util: Order empty strrefs consistently in strref compares
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…
feat(rust): Port utf8, lexer, text-lookup, dstr and bmem to obs-util (#…