Pārlūkot izejas kodu

fix fmt parsing error on windows (#2481)

* fix fmt parsing error on windows

* introduce changes as patch

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Yiheng Wu 2 gadi atpakaļ
vecāks
revīzija
f3eeaa6609
2 mainītis faili ar 17 papildinājumiem un 0 dzēšanām
  1. 13 0
      packages/f/fmt/patches/10.1.0/utf8.patch
  2. 4 0
      packages/f/fmt/xmake.lua

+ 13 - 0
packages/f/fmt/patches/10.1.0/utf8.patch

@@ -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 - 0
packages/f/fmt/xmake.lua

@@ -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