diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-05-11 13:29:31 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-05-11 20:05:10 +0200 |
commit | f2f3400384deebec9bc6a1197654b840e90b7cd2 (patch) | |
tree | 62b5755c2c87d91c53e4586b2a256e8e94d5ad5e | |
parent | bedd590de4b71ac466d7197a98a8315d491d527a (diff) | |
download | qtdeclarative-f2f3400384deebec9bc6a1197654b840e90b7cd2.tar.gz |
Replace {add,sub,mul}_overload with q{Add,Sub,Mul}Overload
These APIs started out as private APIs in qnumeric_p.h, but have since
been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just
forward to the qnumeric.h ones, so just use the latter.
This is in preparation of removing the {add,sub,mul}_overflow
versions, which, despite being defined in the unnamed namespace, don't
sport the q prefix, so potentially clash with global symbols.
The change is a simple textual search and replace.
Picking to 6.5 to avoid cherry-pick conflicts going forward.
Pick-to: 6.5
Change-Id: I2525619c14cb8eeadd08e2fa6c35968bcedd5171
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/qml/common/qv4stringtoarrayindex_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4math_p.h | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/common/qv4stringtoarrayindex_p.h b/src/qml/common/qv4stringtoarrayindex_p.h index fc71ca7072..7bdabd4f3f 100644 --- a/src/qml/common/qv4stringtoarrayindex_p.h +++ b/src/qml/common/qv4stringtoarrayindex_p.h @@ -43,7 +43,7 @@ uint stringToArrayIndex(const T *ch, const T *end) uint x = charToUInt(ch) - '0'; if (x > 9) return std::numeric_limits<uint>::max(); - if (mul_overflow(i, uint(10), &i) || add_overflow(i, x, &i)) // i = i * 10 + x + if (qMulOverflow(i, uint(10), &i) || qAddOverflow(i, x, &i)) // i = i * 10 + x return std::numeric_limits<uint>::max(); ++ch; } diff --git a/src/qml/jsruntime/qv4math_p.h b/src/qml/jsruntime/qv4math_p.h index 2692c2617b..b12990700d 100644 --- a/src/qml/jsruntime/qv4math_p.h +++ b/src/qml/jsruntime/qv4math_p.h @@ -34,7 +34,7 @@ namespace QV4 { static inline QMLJS_READONLY ReturnedValue add_int32(int a, int b) { int result; - if (Q_UNLIKELY(add_overflow(a, b, &result))) + if (Q_UNLIKELY(qAddOverflow(a, b, &result))) return StaticValue::fromDouble(static_cast<double>(a) + b).asReturnedValue(); return StaticValue::fromInt32(result).asReturnedValue(); } @@ -42,7 +42,7 @@ static inline QMLJS_READONLY ReturnedValue add_int32(int a, int b) static inline QMLJS_READONLY ReturnedValue sub_int32(int a, int b) { int result; - if (Q_UNLIKELY(sub_overflow(a, b, &result))) + if (Q_UNLIKELY(qSubOverflow(a, b, &result))) return StaticValue::fromDouble(static_cast<double>(a) - b).asReturnedValue(); return StaticValue::fromInt32(result).asReturnedValue(); } @@ -50,7 +50,7 @@ static inline QMLJS_READONLY ReturnedValue sub_int32(int a, int b) static inline QMLJS_READONLY ReturnedValue mul_int32(int a, int b) { int result; - if (Q_UNLIKELY(mul_overflow(a, b, &result))) + if (Q_UNLIKELY(qMulOverflow(a, b, &result))) return StaticValue::fromDouble(static_cast<double>(a) * b).asReturnedValue(); // need to handle the case where one number is negative and the other 0 ==> -0 if (((a < 0) xor (b < 0)) && (result == 0)) diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 3027cdf94f..43dc0fae4f 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -373,7 +373,7 @@ ReturnedValue TypedArrayCtor::virtualCallAsConstructor(const FunctionObject *f, uint elementSize = operations[that->d()->type].bytesPerElement; size_t bufferSize; - if (mul_overflow(size_t(l), size_t(elementSize), &bufferSize)) + if (qMulOverflow(size_t(l), size_t(elementSize), &bufferSize)) return scope.engine->throwRangeError(QLatin1String("new TypedArray: invalid length")); Scoped<ArrayBuffer> newBuffer(scope, scope.engine->newArrayBuffer(bufferSize)); if (scope.hasException()) |