1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +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

@ -68,9 +68,9 @@ ResultOr<Value> BinaryOperatorExpression::evaluate(ExecutionContext& context) co
return Result { SQLCommand::Unknown, SQLErrorCode::BooleanOperatorTypeMismatch, BinaryOperator_name(type()) };
AK::StringBuilder builder;
builder.append(lhs_value.to_deprecated_string());
builder.append(rhs_value.to_deprecated_string());
return Value(builder.to_deprecated_string());
builder.append(lhs_value.to_byte_string());
builder.append(rhs_value.to_byte_string());
return Value(builder.to_byte_string());
}
case BinaryOperator::Multiplication:
return lhs_value.multiply(rhs_value);
@ -181,7 +181,7 @@ ResultOr<Value> MatchExpression::evaluate(ExecutionContext& context) const
char escape_char = '\0';
if (escape()) {
auto escape_str = TRY(escape()->evaluate(context)).to_deprecated_string();
auto escape_str = TRY(escape()->evaluate(context)).to_byte_string();
if (escape_str.length() != 1)
return Result { SQLCommand::Unknown, SQLErrorCode::SyntaxError, "ESCAPE should be a single character" };
escape_char = escape_str[0];
@ -192,7 +192,7 @@ ResultOr<Value> MatchExpression::evaluate(ExecutionContext& context) const
bool escaped = false;
AK::StringBuilder builder;
builder.append('^');
for (auto c : rhs_value.to_deprecated_string()) {
for (auto c : rhs_value.to_byte_string()) {
if (escape() && c == escape_char && !escaped) {
escaped = true;
} else if (s_posix_basic_metacharacters.contains(c)) {
@ -211,25 +211,25 @@ ResultOr<Value> MatchExpression::evaluate(ExecutionContext& context) const
builder.append('$');
// FIXME: We should probably cache this regex.
auto regex = Regex<PosixBasic>(builder.to_deprecated_string());
auto result = regex.match(lhs_value.to_deprecated_string(), PosixFlags::Insensitive | PosixFlags::Unicode);
auto regex = Regex<PosixBasic>(builder.to_byte_string());
auto result = regex.match(lhs_value.to_byte_string(), PosixFlags::Insensitive | PosixFlags::Unicode);
return Value(invert_expression() ? !result.success : result.success);
}
case MatchOperator::Regexp: {
Value lhs_value = TRY(lhs()->evaluate(context));
Value rhs_value = TRY(rhs()->evaluate(context));
auto regex = Regex<PosixExtended>(rhs_value.to_deprecated_string());
auto regex = Regex<PosixExtended>(rhs_value.to_byte_string());
auto err = regex.parser_result.error;
if (err != regex::Error::NoError) {
StringBuilder builder;
builder.append("Regular expression: "sv);
builder.append(get_error_string(err));
return Result { SQLCommand::Unknown, SQLErrorCode::SyntaxError, builder.to_deprecated_string() };
return Result { SQLCommand::Unknown, SQLErrorCode::SyntaxError, builder.to_byte_string() };
}
auto result = regex.match(lhs_value.to_deprecated_string(), PosixFlags::Insensitive | PosixFlags::Unicode);
auto result = regex.match(lhs_value.to_byte_string(), PosixFlags::Insensitive | PosixFlags::Unicode);
return Value(invert_expression() ? !result.success : result.success);
}
case MatchOperator::Glob: