summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-13 10:52:17 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-15 01:00:20 +0000
commit0ddc2e1f503e8566c7f153741739d380fc05a09f (patch)
treebb88a46c6d9071c779ad9464ddd572733a19f4f4
parent63c814fa2f05e6278fdbeb084f99e851c28006c8 (diff)
downloadserenity-0ddc2e1f503e8566c7f153741739d380fc05a09f.zip
LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecated
-rw-r--r--Tests/LibCrypto/TestBigInteger.cpp6
-rw-r--r--Userland/Applications/Calculator/Keypad.cpp4
-rw-r--r--Userland/Libraries/LibCrypto/BigFraction/BigFraction.cpp2
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp4
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h2
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp2
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigInt.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Date.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp2
-rw-r--r--Userland/Libraries/LibTLS/Certificate.cpp2
-rw-r--r--Userland/Libraries/LibTLS/HandshakeClient.cpp2
17 files changed, 24 insertions, 24 deletions
diff --git a/Tests/LibCrypto/TestBigInteger.cpp b/Tests/LibCrypto/TestBigInteger.cpp
index d2103ae8cd..338ec233d1 100644
--- a/Tests/LibCrypto/TestBigInteger.cpp
+++ b/Tests/LibCrypto/TestBigInteger.cpp
@@ -243,7 +243,7 @@ TEST_CASE(test_unsigned_bigint_base10_to_string)
{
auto result = Crypto::UnsignedBigInteger {
Vector<u32> { 3806301393, 954919431, 3879607298, 721 }
- }.to_base(10);
+ }.to_base_deprecated(10);
EXPECT_EQ(result, "57195071295721390579057195715793");
}
@@ -386,10 +386,10 @@ TEST_CASE(test_bigint_random_distribution)
"100000000000000000000000000000"_bigint); // 10**29
if (actual_result < "100000000000000000000"_bigint) { // 10**20
FAIL("Too small");
- outln("The generated number {} is extremely small. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base(10));
+ outln("The generated number {} is extremely small. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base_deprecated(10));
} else if ("99999999900000000000000000000"_bigint < actual_result) { // 10**29 - 10**20
FAIL("Too large");
- outln("The generated number {} is extremely large. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base(10));
+ outln("The generated number {} is extremely large. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base_deprecated(10));
}
}
diff --git a/Userland/Applications/Calculator/Keypad.cpp b/Userland/Applications/Calculator/Keypad.cpp
index 66c911a771..ad8399c5cd 100644
--- a/Userland/Applications/Calculator/Keypad.cpp
+++ b/Userland/Applications/Calculator/Keypad.cpp
@@ -118,8 +118,8 @@ DeprecatedString Keypad::to_deprecated_string() const
StringBuilder builder;
- DeprecatedString const integer_value = m_int_value.to_base(10);
- DeprecatedString const frac_value = m_frac_value.to_base(10);
+ DeprecatedString const integer_value = m_int_value.to_base_deprecated(10);
+ DeprecatedString const frac_value = m_frac_value.to_base_deprecated(10);
unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1);
builder.append(integer_value);
diff --git a/Userland/Libraries/LibCrypto/BigFraction/BigFraction.cpp b/Userland/Libraries/LibCrypto/BigFraction/BigFraction.cpp
index ce85134792..028ec45e47 100644
--- a/Userland/Libraries/LibCrypto/BigFraction/BigFraction.cpp
+++ b/Userland/Libraries/LibCrypto/BigFraction/BigFraction.cpp
@@ -203,7 +203,7 @@ DeprecatedString BigFraction::to_deprecated_string(unsigned rounding_threshold)
auto const rounded_fraction = rounded(rounding_threshold);
// We take the unsigned value as we already manage the '-'
- auto const full_value = rounded_fraction.m_numerator.unsigned_value().to_base(10);
+ auto const full_value = rounded_fraction.m_numerator.unsigned_value().to_base_deprecated(10);
int split = full_value.length() - (number_of_digits(rounded_fraction.m_denominator) - 1);
if (split < 0)
diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
index 020ce8b6f3..db4b2fa7bb 100644
--- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
+++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
@@ -51,14 +51,14 @@ SignedBigInteger SignedBigInteger::from_base(u16 N, StringView str)
return { move(unsigned_data), sign };
}
-DeprecatedString SignedBigInteger::to_base(u16 N) const
+DeprecatedString SignedBigInteger::to_base_deprecated(u16 N) const
{
StringBuilder builder;
if (m_sign)
builder.append('-');
- builder.append(m_unsigned_data.to_base(N));
+ builder.append(m_unsigned_data.to_base_deprecated(N));
return builder.to_deprecated_string();
}
diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h
index 92b8833891..a1dc4e9a3c 100644
--- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h
+++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h
@@ -63,7 +63,7 @@ public:
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
[[nodiscard]] static SignedBigInteger from_base(u16 N, StringView str);
- [[nodiscard]] DeprecatedString to_base(u16 N) const;
+ [[nodiscard]] DeprecatedString to_base_deprecated(u16 N) const;
[[nodiscard]] u64 to_u64() const;
[[nodiscard]] double to_double(UnsignedBigInteger::RoundingMode rounding_mode = UnsignedBigInteger::RoundingMode::IEEERoundAndTiesToEvenMantissa) const;
diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp
index 003b40e27b..b4572a8f50 100644
--- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp
+++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp
@@ -146,7 +146,7 @@ UnsignedBigInteger UnsignedBigInteger::from_base(u16 N, StringView str)
return result;
}
-DeprecatedString UnsignedBigInteger::to_base(u16 N) const
+DeprecatedString UnsignedBigInteger::to_base_deprecated(u16 N) const
{
VERIFY(N <= 36);
if (*this == UnsignedBigInteger { 0 })
diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h
index c9a4c38021..2738d5e18e 100644
--- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h
+++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h
@@ -63,7 +63,7 @@ public:
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
[[nodiscard]] static UnsignedBigInteger from_base(u16 N, StringView str);
- [[nodiscard]] DeprecatedString to_base(u16 N) const;
+ [[nodiscard]] DeprecatedString to_base_deprecated(u16 N) const;
[[nodiscard]] u64 to_u64() const;
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp
index 8799b39c31..e86342e110 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp
@@ -1065,7 +1065,7 @@ DeprecatedString Store::to_deprecated_string_impl(Bytecode::Executable const&) c
DeprecatedString NewBigInt::to_deprecated_string_impl(Bytecode::Executable const&) const
{
- return DeprecatedString::formatted("NewBigInt \"{}\"", m_bigint.to_base(10));
+ return DeprecatedString::formatted("NewBigInt \"{}\"", m_bigint.to_base_deprecated(10));
}
DeprecatedString NewArray::to_deprecated_string_impl(Bytecode::Executable const&) const
diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.h b/Userland/Libraries/LibJS/Runtime/BigInt.h
index 8a853933fa..b5df053366 100644
--- a/Userland/Libraries/LibJS/Runtime/BigInt.h
+++ b/Userland/Libraries/LibJS/Runtime/BigInt.h
@@ -21,7 +21,7 @@ public:
virtual ~BigInt() override = default;
Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
- const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base(10)); }
+ const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base_deprecated(10)); }
private:
explicit BigInt(Crypto::SignedBigInteger);
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
index a77962adf3..52b6a8d1a6 100644
--- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
@@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
if (radix < 2 || radix > 36)
return vm.throw_completion<RangeError>(ErrorType::InvalidRadix);
}
- return PrimitiveString::create(vm, bigint->big_integer().to_base(radix));
+ return PrimitiveString::create(vm, bigint->big_integer().to_base_deprecated(radix));
}
// 21.2.3.2 BigInt.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tolocalestring
diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp
index 27ee92e872..2f38a3aaaa 100644
--- a/Userland/Libraries/LibJS/Runtime/Date.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Date.cpp
@@ -305,7 +305,7 @@ static i64 clip_bigint_to_sane_time(Crypto::SignedBigInteger const& value)
return NumericLimits<i64>::max();
// FIXME: Can we do this without string conversion?
- return value.to_base(10).to_int<i64>().value();
+ return value.to_base_deprecated(10).to_int<i64>().value();
}
// 21.4.1.8 GetNamedTimeZoneEpochNanoseconds ( timeZoneIdentifier, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond ), https://tc39.es/ecma262/#sec-getnamedtimezoneepochnanoseconds
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp
index ca4705baa8..5d863f7dc5 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp
@@ -237,7 +237,7 @@ int MathematicalValue::logarithmic_floor() const
},
[](Crypto::SignedBigInteger const& value) {
// FIXME: Can we do this without string conversion?
- return static_cast<int>(value.to_base(10).length() - 1);
+ return static_cast<int>(value.to_base_deprecated(10).length() - 1);
},
[](auto) -> int { VERIFY_NOT_REACHED(); });
}
@@ -297,7 +297,7 @@ DeprecatedString MathematicalValue::to_deprecated_string() const
{
return m_value.visit(
[](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); },
- [](Crypto::SignedBigInteger const& value) { return value.to_base(10); },
+ [](Crypto::SignedBigInteger const& value) { return value.to_base_deprecated(10); },
[](auto) -> DeprecatedString { VERIFY_NOT_REACHED(); });
}
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp
index 591fd69667..13f2742a13 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp
@@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_seconds_getter)
auto [s, _] = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000'000 });
// 5. Return 𝔽(s).
- return Value((double)s.to_base(10).to_int<i64>().value());
+ return Value((double)s.to_base_deprecated(10).to_int<i64>().value());
}
// 8.3.4 get Temporal.Instant.prototype.epochMilliseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochmilliseconds
@@ -84,7 +84,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_milliseconds_getter)
auto [ms, _] = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000 });
// 5. Return 𝔽(ms).
- return Value((double)ms.to_base(10).to_int<i64>().value());
+ return Value((double)ms.to_base_deprecated(10).to_int<i64>().value());
}
// 8.3.5 get Temporal.Instant.prototype.epochMicroseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochmicroseconds
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp
index 1d6325ab0a..f242d38fd9 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp
@@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_seconds_getter)
auto s = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000'000 }).quotient;
// 5. Return 𝔽(s).
- return Value((double)s.to_base(10).to_int<i64>().value());
+ return Value((double)s.to_base_deprecated(10).to_int<i64>().value());
}
// 6.3.16 get Temporal.ZonedDateTime.prototype.epochMilliseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.epochmilliseconds
@@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_milliseconds_getter)
auto ms = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000 }).quotient;
// 5. Return 𝔽(ms).
- return Value((double)ms.to_base(10).to_int<i64>().value());
+ return Value((double)ms.to_base_deprecated(10).to_int<i64>().value());
}
// 6.3.17 get Temporal.ZonedDateTime.prototype.epochMicroseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.epochmicroseconds
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index 4c840429cb..47662f99d8 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -401,7 +401,7 @@ ThrowCompletionOr<DeprecatedString> Value::to_string(VM& vm) const
return DeprecatedString::number(as_i32());
// 8. If argument is a BigInt, return BigInt::toString(argument, 10).
case BIGINT_TAG:
- return as_bigint().big_integer().to_base(10);
+ return as_bigint().big_integer().to_base_deprecated(10);
// 9. Assert: argument is an Object.
case OBJECT_TAG: {
// 10. Let primValue be ? ToPrimitive(argument, string).
diff --git a/Userland/Libraries/LibTLS/Certificate.cpp b/Userland/Libraries/LibTLS/Certificate.cpp
index 52e0db28a3..da675a963a 100644
--- a/Userland/Libraries/LibTLS/Certificate.cpp
+++ b/Userland/Libraries/LibTLS/Certificate.cpp
@@ -128,7 +128,7 @@ Optional<Certificate> Certificate::parse_asn1(ReadonlyBytes buffer, bool)
ENTER_SCOPE_WITHOUT_TYPECHECK("Certificate::version");
READ_OBJECT_OR_FAIL(Integer, Crypto::UnsignedBigInteger, value, "Certificate::version");
if (!(value < 3)) {
- dbgln_if(TLS_DEBUG, "Certificate::version Invalid value for version: {}", value.to_base(10));
+ dbgln_if(TLS_DEBUG, "Certificate::version Invalid value for version: {}", value.to_base_deprecated(10));
return {};
}
certificate.version = value.words()[0];
diff --git a/Userland/Libraries/LibTLS/HandshakeClient.cpp b/Userland/Libraries/LibTLS/HandshakeClient.cpp
index c9ad5c49f8..55287b7df7 100644
--- a/Userland/Libraries/LibTLS/HandshakeClient.cpp
+++ b/Userland/Libraries/LibTLS/HandshakeClient.cpp
@@ -240,7 +240,7 @@ void TLSv12::build_dhe_rsa_pre_master_secret(PacketBuilder& builder)
dh.Ys.clear();
if constexpr (TLS_DEBUG) {
- dbgln("dh_random: {}", dh_random.to_base(16));
+ dbgln("dh_random: {}", dh_random.to_base_deprecated(16));
dbgln("dh_Yc: {:hex-dump}", (ReadonlyBytes)dh_Yc_bytes);
dbgln("premaster key: {:hex-dump}", (ReadonlyBytes)m_context.premaster_key);
}