diff --git a/Tests/LibCrypto/TestBigInteger.cpp b/Tests/LibCrypto/TestBigInteger.cpp index d2103ae8cdd..338ec233d1c 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 { 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 66c911a7718..ad8399c5cdc 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 ce851347920..028ec45e473 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 020ce8b6f32..db4b2fa7bbd 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 92b8833891e..a1dc4e9a3c0 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 003b40e27b9..b4572a8f50e 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 c9a4c38021a..2738d5e18e9 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 8799b39c31a..e86342e110d 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 8a853933faa..b5df0533667 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 a77962adf30..52b6a8d1a6d 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(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 27ee92e872d..2f38a3aaaaf 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::max(); // FIXME: Can we do this without string conversion? - return value.to_base(10).to_int().value(); + return value.to_base_deprecated(10).to_int().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 ca4705baa87..5d863f7dc51 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(value.to_base(10).length() - 1); + return static_cast(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 591fd696678..13f2742a134 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().value()); + return Value((double)s.to_base_deprecated(10).to_int().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().value()); + return Value((double)ms.to_base_deprecated(10).to_int().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 1d6325ab0aa..f242d38fd99 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().value()); + return Value((double)s.to_base_deprecated(10).to_int().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().value()); + return Value((double)ms.to_base_deprecated(10).to_int().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 4c840429cbd..47662f99d8e 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -401,7 +401,7 @@ ThrowCompletionOr 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 52e0db28a30..da675a963a8 100644 --- a/Userland/Libraries/LibTLS/Certificate.cpp +++ b/Userland/Libraries/LibTLS/Certificate.cpp @@ -128,7 +128,7 @@ Optional 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 c9ad5c49f8c..55287b7df7d 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); }