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

Add xchar support for write_escaped_string. #2904

Merged
merged 1 commit into from
May 27, 2022

Conversation

phprus
Copy link
Contributor

@phprus phprus commented May 22, 2022

Add xchar support for write_escaped_string.

@phprus phprus mentioned this pull request May 22, 2022
@phprus phprus marked this pull request as draft May 22, 2022 19:14
@phprus phprus force-pushed the ranges-xchar-1 branch 3 times, most recently from cc85396 to 474f12f Compare May 22, 2022 19:56
@phprus phprus marked this pull request as ready for review May 22, 2022 20:03
Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

include/fmt/format.h Outdated Show resolved Hide resolved
break;
default:
if (is_utf8()) {
if (escape.cp < 0x100) {
return format_to(out, FMT_STRING("\\x{:02x}"), escape.cp);
return write_codepoint<2>(out, static_cast<Char>('x'), escape.cp);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pass prefix as char to have the cast in one place (write_codepoint) instead of each call site.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@vitaut vitaut merged commit 1f9eae7 into fmtlib:master May 27, 2022
@vitaut
Copy link
Contributor

vitaut commented May 27, 2022

Thank you!

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

2 participants