1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +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

@ -29,7 +29,7 @@ static_assert(false, "This file must only be used for macOS");
namespace Core {
struct MonitoredPath {
DeprecatedString path;
ByteString path;
FileWatcherEvent::Type event_mask { FileWatcherEvent::Type::Invalid };
};
@ -55,7 +55,7 @@ public:
{
auto context = TRY(try_make<FSEventStreamContext>());
auto queue_name = DeprecatedString::formatted("Serenity.FileWatcher.{:p}", context.ptr());
auto queue_name = ByteString::formatted("Serenity.FileWatcher.{:p}", context.ptr());
auto dispatch_queue = dispatch_queue_create(queue_name.characters(), DISPATCH_QUEUE_SERIAL);
if (dispatch_queue == nullptr)
return Error::from_errno(errno);
@ -67,7 +67,7 @@ public:
return adopt_nonnull_ref_or_enomem(new (nothrow) FileWatcherMacOS(move(context), dispatch_queue, move(notifier)));
}
ErrorOr<bool> add_watch(DeprecatedString path, FileWatcherEvent::Type event_mask)
ErrorOr<bool> add_watch(ByteString path, FileWatcherEvent::Type event_mask)
{
if (m_path_to_inode_id.contains(path)) {
dbgln_if(FILE_WATCHER_DEBUG, "add_watch: path '{}' is already being watched", path);
@ -84,7 +84,7 @@ public:
return true;
}
ErrorOr<bool> remove_watch(DeprecatedString path)
ErrorOr<bool> remove_watch(ByteString path)
{
auto it = m_path_to_inode_id.find(path);
if (it == m_path_to_inode_id.end()) {
@ -101,7 +101,7 @@ public:
return true;
}
ErrorOr<MonitoredPath> canonicalize_path(DeprecatedString path)
ErrorOr<MonitoredPath> canonicalize_path(ByteString path)
{
LexicalPath lexical_path { move(path) };
auto parent_path = lexical_path.parent();
@ -200,7 +200,7 @@ private:
dispatch_queue_t m_dispatch_queue { nullptr };
FSEventStreamRef m_stream { nullptr };
HashMap<DeprecatedString, ino_t> m_path_to_inode_id;
HashMap<ByteString, ino_t> m_path_to_inode_id;
HashMap<ino_t, MonitoredPath> m_inode_id_to_path;
};
@ -219,7 +219,7 @@ void on_file_system_event(ConstFSEventStreamRef, void* user_data, size_t event_s
continue;
}
auto maybe_monitored_path = file_watcher.canonicalize_path(DeprecatedString { file_path_buffer });
auto maybe_monitored_path = file_watcher.canonicalize_path(ByteString { file_path_buffer });
if (maybe_monitored_path.is_error()) {
dbgln_if(FILE_WATCHER_DEBUG, "Could not canonicalize path {}: {}", file_path_buffer, maybe_monitored_path.error());
continue;
@ -265,13 +265,13 @@ FileWatcher::FileWatcher(int watcher_fd, NonnullRefPtr<Notifier> notifier)
FileWatcher::~FileWatcher() = default;
ErrorOr<bool> FileWatcherBase::add_watch(DeprecatedString path, FileWatcherEvent::Type event_mask)
ErrorOr<bool> FileWatcherBase::add_watch(ByteString path, FileWatcherEvent::Type event_mask)
{
auto& file_watcher = verify_cast<FileWatcherMacOS>(*this);
return file_watcher.add_watch(move(path), event_mask);
}
ErrorOr<bool> FileWatcherBase::remove_watch(DeprecatedString path)
ErrorOr<bool> FileWatcherBase::remove_watch(ByteString path)
{
auto& file_watcher = verify_cast<FileWatcherMacOS>(*this);
return file_watcher.remove_watch(move(path));