Skip to content
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

Output to console all failed to load objects #1565

Merged
merged 1 commit into from
Jul 24, 2022

Conversation

duncanspumpkin
Copy link
Contributor

No description provided.

Comment on lines +1085 to +1086
std::string str(header.getName());
Console::error("Failed to load: %s", str.c_str());
Copy link
Member

Choose a reason for hiding this comment

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

Given getName returns a string_view, would this copy/allocate a string twice?

Copy link
Collaborator

@IntelOrca IntelOrca Jul 24, 2022

Choose a reason for hiding this comment

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

The problem is you need a null terminated string to pass to Console::error which string_view does not guarantee. Unless you use a fixed buffer on the stack which would have length limit and code that doesn't look so nice, you probably need to do it this way.

Copy link
Member

@AaronVanGeffen AaronVanGeffen left a comment

Choose a reason for hiding this comment

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

Untested, but LGTM

@AaronVanGeffen AaronVanGeffen added this to the v22.06.1+ milestone Jul 24, 2022
@duncanspumpkin duncanspumpkin merged commit 48f1afb into OpenLoco:master Jul 24, 2022
@duncanspumpkin duncanspumpkin deleted the output branch July 24, 2022 11:34
AaronVanGeffen added a commit that referenced this pull request Jul 29, 2022
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.

None yet

3 participants