1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:47:34 +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

@ -812,7 +812,7 @@ PDFErrorOr<Vector<u8>> CFF::parse_encoding(Reader&& reader, HashMap<Card8, SID>&
TRY(encoding_codes.try_append(code));
}
} else
return error(DeprecatedString::formatted("Invalid encoding format: {}", format));
return error(ByteString::formatted("Invalid encoding format: {}", format));
if (format_raw & 0x80) {
// CFF spec, "Table 14 Supplemental Encoding Data"
@ -975,6 +975,6 @@ PDFErrorOr<CFF::DictOperand> CFF::load_dict_operand(u8 b0, Reader& reader)
return load_float_dict_operand(reader);
if (b0 >= 28)
return load_int_dict_operand(b0, reader);
return Error { Error::Type::MalformedPDF, DeprecatedString::formatted("Unknown CFF dict element prefix: {}", b0) };
return Error { Error::Type::MalformedPDF, ByteString::formatted("Unknown CFF dict element prefix: {}", b0) };
}
}

View file

@ -23,7 +23,7 @@ public:
virtual ~PDFFont() = default;
virtual void set_font_size(float font_size) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) = 0;
protected:
virtual PDFErrorOr<void> initialize(Document* document, NonnullRefPtr<DictObject> const& dict, float font_size);

View file

@ -167,7 +167,7 @@ PDFErrorOr<Vector<float>> PS1FontProgram::parse_number_array(Reader& reader, siz
return array;
}
PDFErrorOr<DeprecatedString> PS1FontProgram::parse_word(Reader& reader)
PDFErrorOr<ByteString> PS1FontProgram::parse_word(Reader& reader)
{
reader.consume_whitespace();
@ -186,7 +186,7 @@ PDFErrorOr<DeprecatedString> PS1FontProgram::parse_word(Reader& reader)
PDFErrorOr<float> PS1FontProgram::parse_float(Reader& reader)
{
auto word = TRY(parse_word(reader));
return strtof(DeprecatedString(word).characters(), nullptr);
return strtof(ByteString(word).characters(), nullptr);
}
PDFErrorOr<int> PS1FontProgram::parse_int(Reader& reader)
@ -216,7 +216,7 @@ PDFErrorOr<ByteBuffer> PS1FontProgram::decrypt(ReadonlyBytes const& encrypted, u
return decrypted;
}
bool PS1FontProgram::seek_name(Reader& reader, DeprecatedString const& name)
bool PS1FontProgram::seek_name(Reader& reader, ByteString const& name)
{
auto start = reader.offset();

View file

@ -26,12 +26,12 @@ private:
PDFErrorOr<void> parse_encrypted_portion(ByteBuffer const&);
PDFErrorOr<Vector<ByteBuffer>> parse_subroutines(Reader&) const;
static PDFErrorOr<Vector<float>> parse_number_array(Reader&, size_t length);
static PDFErrorOr<DeprecatedString> parse_word(Reader&);
static PDFErrorOr<ByteString> parse_word(Reader&);
static PDFErrorOr<float> parse_float(Reader&);
static PDFErrorOr<int> parse_int(Reader&);
static PDFErrorOr<ByteBuffer> decrypt(ReadonlyBytes const&, u16 key, size_t skip);
static bool seek_name(Reader&, DeprecatedString const&);
static bool seek_name(Reader&, ByteString const&);
u16 m_encryption_key { 4330 };
int m_lenIV { 4 };

View file

@ -46,7 +46,7 @@ PDFErrorOr<void> SimpleFont::initialize(Document* document, NonnullRefPtr<DictOb
return {};
}
PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, DeprecatedString const& string, Renderer const& renderer)
PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, ByteString const& string, Renderer const& renderer)
{
auto const& text_rendering_matrix = renderer.calculate_text_rendering_matrix();
auto font_size = text_rendering_matrix.x_scale() * renderer.text_state().font_size;

View file

@ -13,7 +13,7 @@ namespace PDF {
class SimpleFont : public PDFFont {
public:
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) override;
protected:
PDFErrorOr<void> initialize(Document* document, NonnullRefPtr<DictObject> const& dict, float font_size) override;

View file

@ -13,15 +13,15 @@ namespace PDF {
class CIDFontType {
public:
virtual ~CIDFontType() = default;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) = 0;
};
class CIDFontType0 : public CIDFontType {
public:
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) override;
};
PDFErrorOr<Gfx::FloatPoint> CIDFontType0::draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&)
PDFErrorOr<Gfx::FloatPoint> CIDFontType0::draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&)
{
// ISO 32000 (PDF 2.0) 9.7.4.2 Glyph selection in CIDFonts
// "When the CIDFont contains an embedded font program that is represented in the Compact Font Format (CFF),
@ -39,7 +39,7 @@ class CIDFontType2 : public CIDFontType {
public:
static PDFErrorOr<NonnullOwnPtr<CIDFontType2>> create(Document*, NonnullRefPtr<DictObject> const& descendant, float font_size);
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) override;
};
PDFErrorOr<NonnullOwnPtr<CIDFontType2>> CIDFontType2::create(Document* document, NonnullRefPtr<DictObject> const& descendant, float font_size)
@ -70,7 +70,7 @@ PDFErrorOr<NonnullOwnPtr<CIDFontType2>> CIDFontType2::create(Document* document,
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) CIDFontType2()));
}
PDFErrorOr<Gfx::FloatPoint> CIDFontType2::draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&)
PDFErrorOr<Gfx::FloatPoint> CIDFontType2::draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&)
{
// ISO 32000 (PDF 2.0) 9.7.4.2 Glyph selection in CIDFonts
// "For Type 2, the CIDFont program is actually a TrueType font program, which has no native notion of CIDs.
@ -175,7 +175,7 @@ void Type0Font::set_font_size(float)
{
}
PDFErrorOr<Gfx::FloatPoint> Type0Font::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, DeprecatedString const& string, Renderer const&)
PDFErrorOr<Gfx::FloatPoint> Type0Font::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, ByteString const& string, Renderer const&)
{
// Type0 fonts map bytes to character IDs ("CIDs"), and then CIDs to glyphs.

View file

@ -15,8 +15,8 @@ namespace PDF {
class CIDFontType;
struct CIDSystemInfo {
DeprecatedString registry;
DeprecatedString ordering;
ByteString registry;
ByteString ordering;
u8 supplement;
};
@ -26,7 +26,7 @@ public:
~Type0Font();
void set_font_size(float font_size) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) override;
DeprecatedFlyString base_font_name() const { return m_base_font_name; }

View file

@ -387,7 +387,7 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
case CallGsubr:
if (!is_type2)
return error(DeprecatedString::formatted("CFF Gsubr only valid in type2 data"));
return error(ByteString::formatted("CFF Gsubr only valid in type2 data"));
[[fallthrough]];
case CallSubr: {
Vector<ByteBuffer> const& subroutines = v == CallSubr ? local_subroutines : global_subroutines;
@ -725,7 +725,7 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
}
Error Type1FontProgram::error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc

View file

@ -86,7 +86,7 @@ protected:
static PDFErrorOr<Glyph> parse_glyph(ReadonlyBytes const&, Vector<ByteBuffer> const& local_subroutines, Vector<ByteBuffer> const& global_subroutines, GlyphParserState&, bool is_type2);
static Error error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc = SourceLocation::current()