Skip to content

Conversation

@brennenputh
Copy link

This pull request improves upon the HTML report format already present in Centrallix by replacing table-based HTML with flexbox-based HTML. The goal is to generate a HTML document similar in format and style to the PDF report using CSS elements of recent browser support.

Code-A-Thon Team: Brennen Puth, Levi Larsen, Kai Delsing, Josiah Hardaway

LMaster765 and others added 30 commits March 4, 2025 10:00
@brennenputh
Copy link
Author

All objects which were seen were revamped, particularly strings, tables, images, areas, and the root layer.
If this subsystem is to be used for HTML emails in the future, it would be necessary to move back towards table layouts.

@brennenputh brennenputh marked this pull request as ready for review March 7, 2025 21:54
@brennenputh brennenputh changed the title Improve Non-Paginated HTML Report Formatting (Code-A-Thon 2025) feat(HTML): Improve Non-Paginated HTML Report Formatting Mar 7, 2025
@RubberDuckCoding
Copy link
Contributor

Creation of the function prt_htmlfm_GetFont should be reverted. To my knowledge it is not C-safe to return a string from a function (as you are returning a char * to the stack space that has just been released as the function returns).

@gbeeley
Copy link
Member

gbeeley commented Mar 26, 2025

Technically it is safe because the static strings are allocated in the BSS which is stable and readonly. It would be unsafe however to return a reference to the const char array - but references to the constant strings are safe. For good form, however, I would recommend either declaring the string array as a static or else move it and declare it as a static global and then GetFont can reference that instead of the automatic array.

@brennenputh
Copy link
Author

I had accidentally unchecked the "allow maintainers to edit" box it seems, and I just noticed, my bad. It's allowed now, and ya'll should be able to push to my branch to resolve these things.

@gbeeley
Copy link
Member

gbeeley commented Mar 26, 2025

@brennenputh - thanks! I think we'll likely end up moving your work to a new branch in the LightSys copy before merging into master, though. We're needing to separate reformatting and actual code into separate commits, which unfortunately would lose the current commit history with this PR, but in the long run it'll help us see things more clearly with git blame (e.g., having git blame ignore reformatting-only revs). @RubberDuckCoding is a former Code-a-Thon-er who is working on finishing this project & getting it working well in Gmail/etc.

@RubberDuckCoding
Copy link
Contributor

RubberDuckCoding commented Mar 27, 2025

Technically it is safe because the static strings are allocated in the BSS which is stable and readonly.

That's cool, I hadn't though a layer deeper to how things actually get arranged once compiled!

@gbeeley
Copy link
Member

gbeeley commented Mar 27, 2025

Here's another reference that can be helpful on C code safety. There's things we can all learn from this (even for me, who contributed to this effort some years ago): https://resources.sei.cmu.edu/downloads/secure-coding/assets/sei-cert-c-coding-standard-2016-v01.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants