mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +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:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace WindowServer {
|
||||
|
||||
bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
|
||||
bool ScreenLayout::is_valid(ByteString* error_msg) const
|
||||
{
|
||||
if (screens.is_empty()) {
|
||||
if (error_msg)
|
||||
|
@ -24,7 +24,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
|
|||
}
|
||||
if (main_screen_index >= screens.size()) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Invalid main screen index: {}", main_screen_index);
|
||||
*error_msg = ByteString::formatted("Invalid main screen index: {}", main_screen_index);
|
||||
return false;
|
||||
}
|
||||
int smallest_x = 0;
|
||||
|
@ -33,7 +33,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
|
|||
auto& screen = screens[i];
|
||||
if (screen.mode == Screen::Mode::Device && screen.device->is_empty()) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} has no path", i);
|
||||
*error_msg = ByteString::formatted("Screen #{} has no path", i);
|
||||
return false;
|
||||
}
|
||||
for (size_t j = 0; j < screens.size(); j++) {
|
||||
|
@ -42,28 +42,28 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
|
|||
continue;
|
||||
if (screen.device == other_screen.device) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} is using same device as screen #{}", i, j);
|
||||
*error_msg = ByteString::formatted("Screen #{} is using same device as screen #{}", i, j);
|
||||
return false;
|
||||
}
|
||||
if (screen.virtual_rect().intersects(other_screen.virtual_rect())) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} overlaps with screen #{}", i, j);
|
||||
*error_msg = ByteString::formatted("Screen #{} overlaps with screen #{}", i, j);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (screen.location.x() < 0 || screen.location.y() < 0) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} has invalid location: {}", i, screen.location);
|
||||
*error_msg = ByteString::formatted("Screen #{} has invalid location: {}", i, screen.location);
|
||||
return false;
|
||||
}
|
||||
if (screen.resolution.width() <= 0 || screen.resolution.height() <= 0) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution);
|
||||
*error_msg = ByteString::formatted("Screen #{} has invalid resolution: {}", i, screen.resolution);
|
||||
return false;
|
||||
}
|
||||
if (screen.scale_factor < 1) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor);
|
||||
*error_msg = ByteString::formatted("Screen #{} has invalid scale factor: {}", i, screen.scale_factor);
|
||||
return false;
|
||||
}
|
||||
if (i == 0 || screen.location.x() < smallest_x)
|
||||
|
@ -96,7 +96,7 @@ bool ScreenLayout::is_valid(DeprecatedString* error_msg) const
|
|||
auto& screen = screens[i];
|
||||
if (!reachable_screens.contains_slow(&screen)) {
|
||||
if (error_msg)
|
||||
*error_msg = DeprecatedString::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect());
|
||||
*error_msg = ByteString::formatted("Screen #{} {} cannot be reached from main screen #{} {}", i, screen.virtual_rect(), main_screen_index, screens[main_screen_index].virtual_rect());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -225,12 +225,12 @@ bool ScreenLayout::normalize()
|
|||
return did_change;
|
||||
}
|
||||
|
||||
bool ScreenLayout::load_config(Core::ConfigFile const& config_file, DeprecatedString* error_msg)
|
||||
bool ScreenLayout::load_config(Core::ConfigFile const& config_file, ByteString* error_msg)
|
||||
{
|
||||
screens.clear_with_capacity();
|
||||
main_screen_index = config_file.read_num_entry("Screens", "MainScreen", 0);
|
||||
for (size_t index = 0;; index++) {
|
||||
auto group_name = DeprecatedString::formatted("Screen{}", index);
|
||||
auto group_name = ByteString::formatted("Screen{}", index);
|
||||
if (!config_file.has_group(group_name))
|
||||
break;
|
||||
auto str_mode = config_file.read_entry(group_name, "Mode");
|
||||
|
@ -242,11 +242,11 @@ bool ScreenLayout::load_config(Core::ConfigFile const& config_file, DeprecatedSt
|
|||
}
|
||||
|
||||
if (mode == Screen::Mode::Invalid) {
|
||||
*error_msg = DeprecatedString::formatted("Invalid screen mode '{}'", str_mode);
|
||||
*error_msg = ByteString::formatted("Invalid screen mode '{}'", str_mode);
|
||||
*this = {};
|
||||
return false;
|
||||
}
|
||||
auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<DeprecatedString> {};
|
||||
auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<ByteString> {};
|
||||
screens.append({ mode, device,
|
||||
{ config_file.read_num_entry(group_name, "Left"), config_file.read_num_entry(group_name, "Top") },
|
||||
{ config_file.read_num_entry(group_name, "Width"), config_file.read_num_entry(group_name, "Height") },
|
||||
|
@ -266,7 +266,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const
|
|||
size_t index = 0;
|
||||
while (index < screens.size()) {
|
||||
auto& screen = screens[index];
|
||||
auto group_name = DeprecatedString::formatted("Screen{}", index);
|
||||
auto group_name = ByteString::formatted("Screen{}", index);
|
||||
config_file.write_entry(group_name, "Mode", Screen::mode_to_string(screen.mode));
|
||||
if (screen.mode == Screen::Mode::Device)
|
||||
config_file.write_entry(group_name, "Device", screen.device.value());
|
||||
|
@ -279,7 +279,7 @@ bool ScreenLayout::save_config(Core::ConfigFile& config_file, bool sync) const
|
|||
}
|
||||
// Prune screens no longer in the layout
|
||||
for (;;) {
|
||||
auto group_name = DeprecatedString::formatted("Screen{}", index++);
|
||||
auto group_name = ByteString::formatted("Screen{}", index++);
|
||||
if (!config_file.has_group(group_name))
|
||||
break;
|
||||
config_file.remove_group(group_name);
|
||||
|
@ -305,7 +305,7 @@ bool ScreenLayout::operator!=(ScreenLayout const& other) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ScreenLayout::try_auto_add_display_connector(DeprecatedString const& device_path)
|
||||
bool ScreenLayout::try_auto_add_display_connector(ByteString const& device_path)
|
||||
{
|
||||
int display_connector_fd = open(device_path.characters(), O_RDWR | O_CLOEXEC);
|
||||
if (display_connector_fd < 0) {
|
||||
|
@ -408,7 +408,7 @@ template<>
|
|||
ErrorOr<WindowServer::ScreenLayout::Screen> decode(Decoder& decoder)
|
||||
{
|
||||
auto mode = TRY(decoder.decode<WindowServer::ScreenLayout::Screen::Mode>());
|
||||
auto device = TRY(decoder.decode<Optional<DeprecatedString>>());
|
||||
auto device = TRY(decoder.decode<Optional<ByteString>>());
|
||||
auto location = TRY(decoder.decode<Gfx::IntPoint>());
|
||||
auto resolution = TRY(decoder.decode<Gfx::IntSize>());
|
||||
auto scale_factor = TRY(decoder.decode<int>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue