}
tkey = nextTKey;
} while (tkey != nullptr);
- tfields.sort([](UElement e1, UElement e2) -> int8_t {
- // uprv_strcmp return int and in some platform, such as arm64-v8a,
- // it may return positive values > 127 which cause the casted value
- // of int8_t negative.
- int res = uprv_strcmp(
- (const char*)e1.pointer, (const char*)e2.pointer);
- return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
+ tfields.sort([](UElement e1, UElement e2) -> int32_t {
+ return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer);
}, status);
for (int32_t i = 0; i < tfields.size(); i++) {
if (output.length() > 0) {
if (!notEmpty(script) && !notEmpty(region)) {
out.append(SEP_CHAR, status);
}
- variants.sort([](UElement e1, UElement e2) -> int8_t {
- // uprv_strcmp return int and in some platform, such as arm64-v8a,
- // it may return positive values > 127 which cause the casted value
- // of int8_t negative.
- int res = uprv_strcmp(
- (const char*)e1.pointer, (const char*)e2.pointer);
- return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
+ variants.sort([](UElement e1, UElement e2) -> int32_t {
+ return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer);
}, status);
int32_t variantsStart = out.length();
for (int32_t i = 0; i < variants.size(); i++) {
if (U_FAILURE(status)) { return false; }
// Sort the variants
- variants.sort([](UElement e1, UElement e2) -> int8_t {
- // uprv_strcmp return int and in some platform, such as arm64-v8a,
- // it may return positive values > 127 which cause the casted value
- // of int8_t negative.
- int res = uprv_strcmp(
- (const char*)e1.pointer, (const char*)e2.pointer);
- return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
+ variants.sort([](UElement e1, UElement e2) -> int32_t {
+ return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer);
}, status);
// A changed count to assert when loop too many times.
* An element sorting (three-way) comparison function.
* @param e1 An element (object or integer)
* @param e2 An element (object or integer)
- * @return 0 if the two elements are equal, -1 if e1 is < e2, or +1 if e1 is > e2.
+ * @return 32-bit signed integer comparison result:
+ * ==0 if the two elements are equal,
+ * <0 if e1 is < e2, or
+ * >0 if e1 is > e2.
*/
-typedef int8_t U_CALLCONV UElementComparator(UElement e1, UElement e2);
+typedef int32_t U_CALLCONV UElementComparator(UElement e1, UElement e2);
/**
* An element assignment function. It may copy an integer, copy
// by code point order.
// Conforms to the type signature for a USortComparator in uvector.h
-static int8_t U_CALLCONV SPUStringCompare(UHashTok left, UHashTok right) {
+static int32_t U_CALLCONV SPUStringCompare(UHashTok left, UHashTok right) {
const SPUString *sL = const_cast<const SPUString *>(
static_cast<SPUString *>(left.pointer));
const SPUString *sR = const_cast<const SPUString *>(