Skip to content

Commit

Permalink
fix fmt parsing error on windows (#2481)
Browse files Browse the repository at this point in the history
* fix fmt parsing error on windows

* introduce changes as patch

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
  • Loading branch information
jingkaimori and waruqi authored Aug 22, 2023
1 parent e7e2419 commit f3eeaa6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/f/fmt/patches/10.1.0/utf8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/include/fmt/format.h b/include/fmt/format.h
index e5bd8b1..1a05db3 100644
--- a/include/fmt/format.h
+++ b/include/fmt/format.h
@@ -1453,7 +1453,7 @@ template <typename WChar, typename Buffer = memory_buffer> class to_utf8 {
++p;
if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) {
if (policy == to_utf8_error_policy::abort) return false;
- buf.append(string_view("�"));
+ buf.append(string_view("\xEF\xBF\xBD"));
--p;
} else {
c = (c << 10) + static_cast<uint32_t>(*p) - 0x35fdc00;
4 changes: 4 additions & 0 deletions packages/f/fmt/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ package("fmt")
add_versions("6.0.0", "b4a16b38fa171f15dbfb958b02da9bbef2c482debadf64ac81ec61b5ac422440")
add_versions("5.3.0", "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c")

add_patches("10.1.0",
path.join(os.scriptdir(), "patches", "10.1.0", "utf8.patch" ),
"3280569bced9ec08933f0ea37b6a4fef4538944d9046fe197ad63e22d1357cd4")

add_configs("header_only", {description = "Use header only version.", default = false, type = "boolean"})

if is_plat("mingw") and is_subhost("msys") then
Expand Down

0 comments on commit f3eeaa6

Please sign in to comment.