Fix lengths of interpreted HTML special-character entities#56
Fix lengths of interpreted HTML special-character entities#56jgoossen851 wants to merge 4 commits intoZZJHONS:masterfrom
Conversation
Previously, the closing semicolon was not being removed from the interpreted string, causing `'` to be replaced by `';` instead of `'`. A similar error appeared for the double-quote `"`.
Summary of ChangesHello @jgoossen851, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug in the HTML entity decoding logic where specific character entities, namely Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a bug in HTML entity decoding where " and ' were not fully consumed, leading to an extra semicolon in the output. The lengths for these entities in ccStrCmpSeq calls and the corresponding skip values have been corrected. I've added a couple of suggestions to replace the magic numbers for lengths with sizeof(...) - 1 to improve code maintainability and prevent similar issues in the future.
bsx.c
Outdated
| else if( ccStrCmpSeq( string, "quot;", 5 ) ) | ||
| { | ||
| *dst++ = '"'; | ||
| skip = 4; | ||
| skip = 5; |
There was a problem hiding this comment.
While the fix is correct, using sizeof("quot;") - 1 instead of the magic number 5 would make the code more robust and maintainable. This avoids potential mismatches between the string literal and its length, which was the source of the original bug.
else if( ccStrCmpSeq( string, "quot;", sizeof("quot;") - 1 ) )
{
*dst++ = '"';
skip = sizeof("quot;") - 1;
bsx.c
Outdated
| else if( ccStrCmpSeq( string, "apos;", 5 ) ) | ||
| { | ||
| *dst++ = '\''; | ||
| skip = 4; | ||
| skip = 5; |
There was a problem hiding this comment.
…e sequences that appear Many items in the catalog contained the sequences '&ZZJHONS#40;' and '&ZZJHONS#41;' when printed in the file logs (such as with `verify brickowl`). These are now printed with the characters '(' and ')'. Store names with an apostrophe were printed as '&ZZJHONS#39;' in the startup info messages. These now print using the correct puctuation.
Previously, the closing semicolon was not being removed from the interpreted string, causing
'to be replaced by';instead of'. A similar error appeared for the double-quote".