Skip to content

Conversation

@heinezen
Copy link
Member

@heinezen heinezen commented Aug 3, 2024

Adds a new dedicated util::split_newline function that can handle safe splits.

@heinezen heinezen added improvement Enhancement of an existing component area: renderer Concerns our graphics renderer bugfix Restores intended behavior labels Aug 3, 2024
@heinezen heinezen added this to the 0.6.0 milestone Aug 3, 2024
@heinezen heinezen linked an issue Aug 3, 2024 that may be closed by this pull request
/**
* Newline splitter that works with both \n and \r\n.
*/
std::vector<std::string> split_newline(const std::string &txt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be returning std::string_views instead :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but it is creating so many problems with existing code that relies on std::string which also makes the code harder to read :/

For example, std::stoul won't accept a string view as an argument, so you have this confusing back and forth conversion between std::string_view and std::string in the renderer parsers...

@TheJJ TheJJ merged commit 641127f into SFTtech:master Aug 7, 2024
@heinezen heinezen deleted the fix/newline_split branch November 25, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: renderer Concerns our graphics renderer bugfix Restores intended behavior improvement Enhancement of an existing component

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Remove string splits with \r from renderer resource parsers

2 participants