1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:37:44 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -9,7 +9,7 @@
namespace Crypto::ASN1 {
DeprecatedString kind_name(Kind kind)
ByteString kind_name(Kind kind)
{
switch (kind) {
case Kind::Eol:
@ -91,7 +91,7 @@ DeprecatedString kind_name(Kind kind)
return "InvalidKind";
}
DeprecatedString class_name(Class class_)
ByteString class_name(Class class_)
{
switch (class_) {
case Class::Application:
@ -107,7 +107,7 @@ DeprecatedString class_name(Class class_)
return "InvalidClass";
}
DeprecatedString type_name(Type type)
ByteString type_name(Type type)
{
switch (type) {
case Type::Constructed:

View file

@ -71,9 +71,9 @@ struct Tag {
Type type;
};
DeprecatedString kind_name(Kind);
DeprecatedString class_name(Class);
DeprecatedString type_name(Type);
ByteString kind_name(Kind);
ByteString class_name(Class);
ByteString type_name(Type);
Optional<Core::DateTime> parse_utc_time(StringView);
Optional<Core::DateTime> parse_generalized_time(StringView);

View file

@ -12,7 +12,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Authentication {
@ -48,7 +48,7 @@ public:
constexpr static size_t digest_size() { return TagType::Size; }
#ifndef KERNEL
DeprecatedString class_name() const
ByteString class_name() const
{
return "GHash";
}

View file

@ -13,7 +13,7 @@
#include <AK/Vector.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
constexpr static auto IPAD = 0x36;
@ -73,12 +73,12 @@ public:
}
#ifndef KERNEL
DeprecatedString class_name() const
ByteString class_name() const
{
StringBuilder builder;
builder.append("HMAC-"sv);
builder.append(m_inner_hasher.class_name());
return builder.to_deprecated_string();
return builder.to_byte_string();
}
#endif

View file

@ -5,7 +5,7 @@
*/
#include "BigFraction.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Math.h>
#include <AK/StringBuilder.h>
#include <LibCrypto/NumberTheory/ModularFunctions.h>
@ -184,7 +184,7 @@ void BigFraction::reduce()
m_denominator = denominator_divide.quotient;
}
DeprecatedString BigFraction::to_deprecated_string(unsigned rounding_threshold) const
ByteString BigFraction::to_byte_string(unsigned rounding_threshold) const
{
StringBuilder builder;
if (m_numerator.is_negative() && m_numerator != "0"_bigint)
@ -239,7 +239,7 @@ DeprecatedString BigFraction::to_deprecated_string(unsigned rounding_threshold)
builder.append(fractional_value);
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
BigFraction BigFraction::sqrt() const

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibCrypto/BigInt/SignedBigInteger.h>
namespace Crypto {
@ -54,7 +54,7 @@ public:
// - m_denominator = 10000
BigFraction rounded(unsigned rounding_threshold) const;
DeprecatedString to_deprecated_string(unsigned rounding_threshold) const;
ByteString to_byte_string(unsigned rounding_threshold) const;
double to_double() const;
private:

View file

@ -64,9 +64,9 @@ ErrorOr<String> SignedBigInteger::to_base(u16 N) const
return builder.to_string();
}
DeprecatedString SignedBigInteger::to_base_deprecated(u16 N) const
ByteString SignedBigInteger::to_base_deprecated(u16 N) const
{
return MUST(to_base(N)).to_deprecated_string();
return MUST(to_base(N)).to_byte_string();
}
u64 SignedBigInteger::to_u64() const

View file

@ -65,7 +65,7 @@ public:
[[nodiscard]] static SignedBigInteger from_base(u16 N, StringView str);
[[nodiscard]] ErrorOr<String> to_base(u16 N) const;
[[nodiscard]] DeprecatedString to_base_deprecated(u16 N) const;
[[nodiscard]] ByteString to_base_deprecated(u16 N) const;
[[nodiscard]] u64 to_u64() const;
[[nodiscard]] double to_double(UnsignedBigInteger::RoundingMode rounding_mode = UnsignedBigInteger::RoundingMode::IEEERoundAndTiesToEvenMantissa) const;

View file

@ -167,9 +167,9 @@ ErrorOr<String> UnsignedBigInteger::to_base(u16 N) const
return TRY(builder.to_string()).reverse();
}
DeprecatedString UnsignedBigInteger::to_base_deprecated(u16 N) const
ByteString UnsignedBigInteger::to_base_deprecated(u16 N) const
{
return MUST(to_base(N)).to_deprecated_string();
return MUST(to_base(N)).to_byte_string();
}
u64 UnsignedBigInteger::to_u64() const

View file

@ -9,8 +9,8 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/ByteString.h>
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/Types.h>
@ -65,7 +65,7 @@ public:
[[nodiscard]] static UnsignedBigInteger from_base(u16 N, StringView str);
[[nodiscard]] ErrorOr<String> to_base(u16 N) const;
[[nodiscard]] DeprecatedString to_base_deprecated(u16 N) const;
[[nodiscard]] ByteString to_base_deprecated(u16 N) const;
[[nodiscard]] u64 to_u64() const;

View file

@ -24,20 +24,20 @@ constexpr void swap_keys(u32* keys, size_t i, size_t j)
}
#ifndef KERNEL
DeprecatedString AESCipherBlock::to_deprecated_string() const
ByteString AESCipherBlock::to_byte_string() const
{
StringBuilder builder;
for (auto value : m_data)
builder.appendff("{:02x}", value);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString AESCipherKey::to_deprecated_string() const
ByteString AESCipherKey::to_byte_string() const
{
StringBuilder builder;
for (size_t i = 0; i < (rounds() + 1) * 4; ++i)
builder.appendff("{:02x}", m_rd_keys[i]);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
#endif

View file

@ -14,7 +14,7 @@
#include <LibCrypto/Cipher/Mode/GCM.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Cipher {
@ -48,7 +48,7 @@ public:
}
#ifndef KERNEL
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
#endif
private:
@ -64,7 +64,7 @@ struct AESCipherKey : public CipherKey {
static bool is_valid_key_size(size_t bits) { return bits == 128 || bits == 192 || bits == 256; }
#ifndef KERNEL
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
#endif
u32 const* round_keys() const
@ -120,7 +120,7 @@ public:
virtual void decrypt_block(BlockType const& in, BlockType& out) override;
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "AES";
}

View file

@ -112,7 +112,7 @@ public:
virtual void decrypt_block(BlockType const& in, BlockType& out) = 0;
#ifndef KERNEL
virtual DeprecatedString class_name() const = 0;
virtual ByteString class_name() const = 0;
#endif
protected:

View file

@ -11,7 +11,7 @@
#include <LibCrypto/Cipher/Mode/Mode.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Cipher {
@ -29,12 +29,12 @@ public:
}
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_CBC"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
#endif

View file

@ -11,7 +11,7 @@
#include <LibCrypto/Cipher/Mode/Mode.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Cipher {
@ -104,12 +104,12 @@ public:
}
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_CTR"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
#endif

View file

@ -15,7 +15,7 @@
#include <LibCrypto/Verification.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Cipher {
@ -44,12 +44,12 @@ public:
}
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_GCM"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
#endif

View file

@ -34,7 +34,7 @@ public:
}
#ifndef KERNEL
virtual DeprecatedString class_name() const = 0;
virtual ByteString class_name() const = 0;
#endif
T& cipher()

View file

@ -10,7 +10,7 @@
#include <LibCrypto/Hash/SHA2.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Hash {
@ -44,7 +44,7 @@ public:
static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "BLAKE2b";
}

View file

@ -55,7 +55,7 @@ public:
virtual void reset() = 0;
#ifndef KERNEL
virtual DeprecatedString class_name() const = 0;
virtual ByteString class_name() const = 0;
#endif
protected:

View file

@ -197,10 +197,10 @@ public:
}
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return m_algorithm.visit(
[&](Empty const&) -> DeprecatedString { return "UninitializedHashManager"; },
[&](Empty const&) -> ByteString { return "UninitializedHashManager"; },
[&](auto const& hash) { return hash.class_name(); });
}
#endif

View file

@ -10,7 +10,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Hash {
@ -56,7 +56,7 @@ public:
virtual DigestType peek() override;
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "MD5";
}

View file

@ -9,7 +9,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Hash {
@ -52,7 +52,7 @@ public:
static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "SHA1";
}

View file

@ -10,7 +10,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::Hash {
@ -100,9 +100,9 @@ public:
static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
return ByteString::formatted("SHA{}", DigestSize * 8);
}
#endif
@ -152,9 +152,9 @@ public:
static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
return ByteString::formatted("SHA{}", DigestSize * 8);
}
#endif
@ -204,9 +204,9 @@ public:
static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
return ByteString::formatted("SHA{}", DigestSize * 8);
}
#endif

View file

@ -9,7 +9,7 @@
#include <AK/ByteBuffer.h>
#ifndef KERNEL
# include <AK/DeprecatedString.h>
# include <AK/ByteString.h>
#endif
namespace Crypto::PK {
@ -36,7 +36,7 @@ public:
virtual void verify(ReadonlyBytes in, Bytes& out) = 0;
#ifndef KERNEL
virtual DeprecatedString class_name() const = 0;
virtual ByteString class_name() const = 0;
#endif
virtual size_t output_size() const = 0;

View file

@ -162,7 +162,7 @@ public:
virtual void verify(ReadonlyBytes in, Bytes& out) override;
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "RSA";
}
@ -214,7 +214,7 @@ public:
virtual void verify(ReadonlyBytes, Bytes&) override;
#ifndef KERNEL
virtual DeprecatedString class_name() const override
virtual ByteString class_name() const override
{
return "RSA_PKCS1-EME";
}