~ruther/guix-local

ref: next-master guix-local/gnu/packages/patches/icu4c-78-double-conversion.patch -rw-r--r-- 5.4 KiB
b989e013 — Andy Tai gnu: koboldcpp: Update to 1.106.2. 30 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
diff --git a/source/i18n/measunit_extra.cpp b/source/i18n/measunit_extra.cpp
--- a/source/i18n/measunit_extra.cpp
+++ b/source/i18n/measunit_extra.cpp
@@ -10,17 +10,21 @@
 
 // Allow implicit conversion from char16_t* to UnicodeString for this file:
 // Helpful in toString methods and elsewhere.
 #define UNISTR_FROM_STRING_EXPLICIT
 
 #include "charstr.h"
 #include "cmemory.h"
 #include "cstring.h"
+#ifdef JS_HAS_INTL_API
+#include "double-conversion/string-to-double.h"
+#else
 #include "double-conversion-string-to-double.h"
+#endif
 #include "measunit_impl.h"
 #include "resource.h"
 #include "uarrsort.h"
 #include "uassert.h"
 #include "ucln_in.h"
 #include "umutex.h"
 #include "unicode/bytestrie.h"
 #include "unicode/bytestriebuilder.h"
@@ -33,17 +37,21 @@
 #include "util.h"
 #include <limits.h>
 #include <cstdlib>
 U_NAMESPACE_BEGIN
 
 
 namespace {
 
+#ifdef JS_HAS_INTL_API
+using double_conversion::StringToDoubleConverter;
+#else
 using icu::double_conversion::StringToDoubleConverter;
+#endif
 
 // TODO: Propose a new error code for this?
 constexpr UErrorCode kUnitIdentifierSyntaxError = U_ILLEGAL_ARGUMENT_ERROR;
 
 // Trie value offset for SI or binary prefixes. This is big enough to ensure we only
 // insert positive integers into the trie.
 constexpr int32_t kPrefixOffset = 64;
 static_assert(kPrefixOffset + UMEASURE_PREFIX_INTERNAL_MIN_BIN > 0,
diff --git a/source/i18n/number_decimalquantity.cpp b/source/i18n/number_decimalquantity.cpp
--- a/source/i18n/number_decimalquantity.cpp
+++ b/source/i18n/number_decimalquantity.cpp
@@ -11,28 +11,37 @@
 #include <stdlib.h>
 
 #include "unicode/plurrule.h"
 #include "cmemory.h"
 #include "number_decnum.h"
 #include "putilimp.h"
 #include "number_decimalquantity.h"
 #include "number_roundingutils.h"
+#ifdef JS_HAS_INTL_API
+#include "double-conversion/double-conversion.h"
+#else
 #include "double-conversion.h"
+#endif
 #include "charstr.h"
 #include "number_utils.h"
 #include "uassert.h"
 #include "util.h"
 
 using namespace icu;
 using namespace icu::number;
 using namespace icu::number::impl;
 
+#ifdef JS_HAS_INTL_API
+using double_conversion::DoubleToStringConverter;
+using double_conversion::StringToDoubleConverter;
+#else
 using icu::double_conversion::DoubleToStringConverter;
 using icu::double_conversion::StringToDoubleConverter;
+#endif
 
 namespace {
 
 int8_t NEGATIVE_FLAG = 1;
 int8_t INFINITY_FLAG = 2;
 int8_t NAN_FLAG = 4;
 
 /** Helper function for safe subtraction (no overflow). */
diff --git a/source/i18n/number_rounding.cpp b/source/i18n/number_rounding.cpp
--- a/source/i18n/number_rounding.cpp
+++ b/source/i18n/number_rounding.cpp
@@ -5,17 +5,21 @@
 
 #if !UCONFIG_NO_FORMATTING
 
 #include "charstr.h"
 #include "uassert.h"
 #include "unicode/numberformatter.h"
 #include "number_types.h"
 #include "number_decimalquantity.h"
+#ifdef JS_HAS_INTL_API
+#include "double-conversion/double-conversion.h"
+#else
 #include "double-conversion.h"
+#endif
 #include "number_roundingutils.h"
 #include "number_skeletons.h"
 #include "number_decnum.h"
 #include "putilimp.h"
 #include "string_segment.h"
 
 using namespace icu;
 using namespace icu::number;
diff --git a/source/i18n/number_utils.cpp b/source/i18n/number_utils.cpp
--- a/source/i18n/number_utils.cpp
+++ b/source/i18n/number_utils.cpp
@@ -12,26 +12,34 @@
 #include <stdlib.h>
 #include <cmath>
 #include "number_decnum.h"
 #include "number_types.h"
 #include "number_utils.h"
 #include "charstr.h"
 #include "decContext.h"
 #include "decNumber.h"
+#ifdef JS_HAS_INTL_API
+#include "double-conversion/double-conversion.h"
+#else
 #include "double-conversion.h"
+#endif
 #include "fphdlimp.h"
 #include "uresimp.h"
 #include "ureslocs.h"
 
 using namespace icu;
 using namespace icu::number;
 using namespace icu::number::impl;
 
+#ifdef JS_HAS_INTL_API
+using double_conversion::DoubleToStringConverter;
+#else
 using icu::double_conversion::DoubleToStringConverter;
+#endif
 
 
 namespace {
 
 const char16_t*
 doGetPattern(UResourceBundle* res, const char* nsName, const char* patternKey, UErrorCode& publicStatus,
              UErrorCode& localStatus) {
     // Construct the path into the resource bundle
diff --git a/source/i18n/units_converter.cpp b/source/i18n/units_converter.cpp
--- a/source/i18n/units_converter.cpp
+++ b/source/i18n/units_converter.cpp
@@ -3,17 +3,21 @@
 
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
 
 #include "charstr.h"
 #include "cmemory.h"
 #include "cstring.h"
+#ifdef JS_HAS_INTL_API
+#include "double-conversion/string-to-double.h"
+#else
 #include "double-conversion-string-to-double.h"
+#endif
 #include "measunit_impl.h"
 #include "putilimp.h"
 #include "uassert.h"
 #include "unicode/errorcode.h"
 #include "unicode/localpointer.h"
 #include "unicode/stringpiece.h"
 #include "units_converter.h"
 #include <algorithm>
@@ -105,17 +109,21 @@ void Factor::substituteConstants() {
         this->constantExponents[i] = 0;
     }
 }
 
 namespace {
 
 /* Helpers */
 
+#ifdef JS_HAS_INTL_API
+using double_conversion::StringToDoubleConverter;
+#else
 using icu::double_conversion::StringToDoubleConverter;
+#endif
 
 // TODO: Make this a shared-utility function.
 // Returns `double` from a scientific number(i.e. "1", "2.01" or "3.09E+4")
 double strToDouble(StringPiece strNum, UErrorCode &status) {
     // We are processing well-formed input, so we don't need any special options to
     // StringToDoubleConverter.
     StringToDoubleConverter converter(0, 0, 0, "", "");
     int32_t count;