-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove string splits with \r
from renderer resource parsers
#1667
Conversation
/** | ||
* Newline splitter that works with both \n and \r\n. | ||
*/ | ||
std::vector<std::string> split_newline(const std::string &txt); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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...
Adds a new dedicated
util::split_newline
function that can handle safe splits.