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

Replace std::ostringstream usage with fmt::format #11972

Merged

Conversation

Minty-Meeo
Copy link
Contributor

Part C of splitting #11913

@Minty-Meeo Minty-Meeo marked this pull request as ready for review June 18, 2023 02:28
Comment on lines 556 to 557
return fmt::format("{:.{}f} {}", bytes / unit_size, decimals,
Common::GetStringT(unit_symbols[unit]));
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be {:.{}Lf} {} to be equivalent since this previously respected the user's locale for the decimal separator.

@AdmiralCurtiss
Copy link
Contributor

Apart from that locale thing this looks good to me.

@Minty-Meeo
Copy link
Contributor Author

I just noticed Joystick::Hat::GetName() is also doing some funky stuff with a char[] buffer that could possibly be simplified with fmt::format. Might I tack it onto this PR?

@AdmiralCurtiss
Copy link
Contributor

AdmiralCurtiss commented Jun 18, 2023

lol yeah that's very funky. Sure.

Is that even threadsafe? Does that produce a copy of the string?

@Minty-Meeo
Copy link
Contributor Author

My intuition tells me that it copies the string from rodata into the stack since it's not static.

@AdmiralCurtiss AdmiralCurtiss merged commit 5d7b582 into dolphin-emu:master Jun 19, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants