mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:07:45 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -38,7 +38,7 @@ static String get_salt()
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
static Vector<gid_t> get_extra_gids(const passwd& pwd)
|
||||
static Vector<gid_t> get_extra_gids(passwd const& pwd)
|
||||
{
|
||||
StringView username { pwd.pw_name };
|
||||
Vector<gid_t> extra_gids;
|
||||
|
@ -57,7 +57,7 @@ static Vector<gid_t> get_extra_gids(const passwd& pwd)
|
|||
return extra_gids;
|
||||
}
|
||||
|
||||
ErrorOr<Account> Account::from_passwd(const passwd& pwd, const spwd& spwd)
|
||||
ErrorOr<Account> Account::from_passwd(passwd const& pwd, spwd const& spwd)
|
||||
{
|
||||
Account account(pwd, spwd, get_extra_gids(pwd));
|
||||
endpwent();
|
||||
|
@ -88,7 +88,7 @@ ErrorOr<Account> Account::self([[maybe_unused]] Read options)
|
|||
return Account(*pwd, spwd, extra_gids);
|
||||
}
|
||||
|
||||
ErrorOr<Account> Account::from_name(const char* username, [[maybe_unused]] Read options)
|
||||
ErrorOr<Account> Account::from_name(char const* username, [[maybe_unused]] Read options)
|
||||
{
|
||||
auto pwd = TRY(Core::System::getpwnam(username));
|
||||
if (!pwd.has_value())
|
||||
|
@ -175,7 +175,7 @@ void Account::delete_password()
|
|||
m_password_hash = "";
|
||||
}
|
||||
|
||||
Account::Account(const passwd& pwd, const spwd& spwd, Vector<gid_t> extra_gids)
|
||||
Account::Account(passwd const& pwd, spwd const& spwd, Vector<gid_t> extra_gids)
|
||||
: m_username(pwd.pw_name)
|
||||
, m_password_hash(spwd.sp_pwdp)
|
||||
, m_uid(pwd.pw_uid)
|
||||
|
|
|
@ -46,11 +46,11 @@ public:
|
|||
// You must call sync to apply changes.
|
||||
void set_password(SecretString const& password);
|
||||
void set_password_enabled(bool enabled);
|
||||
void set_home_directory(const char* home_directory) { m_home_directory = home_directory; }
|
||||
void set_home_directory(char const* home_directory) { m_home_directory = home_directory; }
|
||||
void set_uid(uid_t uid) { m_uid = uid; }
|
||||
void set_gid(gid_t gid) { m_gid = gid; }
|
||||
void set_shell(const char* shell) { m_shell = shell; }
|
||||
void set_gecos(const char* gecos) { m_gecos = gecos; }
|
||||
void set_shell(char const* shell) { m_shell = shell; }
|
||||
void set_gecos(char const* gecos) { m_gecos = gecos; }
|
||||
void delete_password();
|
||||
|
||||
// A null password means that this account was missing from /etc/shadow.
|
||||
|
@ -59,17 +59,17 @@ public:
|
|||
|
||||
uid_t uid() const { return m_uid; }
|
||||
gid_t gid() const { return m_gid; }
|
||||
const String& gecos() const { return m_gecos; }
|
||||
const String& home_directory() const { return m_home_directory; }
|
||||
const String& shell() const { return m_shell; }
|
||||
const Vector<gid_t>& extra_gids() const { return m_extra_gids; }
|
||||
String const& gecos() const { return m_gecos; }
|
||||
String const& home_directory() const { return m_home_directory; }
|
||||
String const& shell() const { return m_shell; }
|
||||
Vector<gid_t> const& extra_gids() const { return m_extra_gids; }
|
||||
|
||||
ErrorOr<void> sync();
|
||||
|
||||
private:
|
||||
static ErrorOr<Account> from_passwd(passwd const&, spwd const&);
|
||||
|
||||
Account(const passwd& pwd, const spwd& spwd, Vector<gid_t> extra_gids);
|
||||
Account(passwd const& pwd, spwd const& spwd, Vector<gid_t> extra_gids);
|
||||
|
||||
ErrorOr<String> generate_passwd_file() const;
|
||||
#ifndef AK_OS_BSD_GENERIC
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
int fd() const { return m_fd; }
|
||||
size_t size() const { return m_size; }
|
||||
void* data() { return m_data; }
|
||||
const void* data() const { return m_data; }
|
||||
void const* data() const { return m_data; }
|
||||
|
||||
private:
|
||||
AnonymousBufferImpl(int fd, size_t, void*);
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
|
||||
namespace IPC {
|
||||
|
||||
bool encode(Encoder&, const Core::AnonymousBuffer&);
|
||||
bool encode(Encoder&, Core::AnonymousBuffer const&);
|
||||
ErrorOr<void> decode(Decoder&, Core::AnonymousBuffer&);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static Optional<double> convert_to_double(const char* s)
|
||||
static Optional<double> convert_to_double(char const* s)
|
||||
{
|
||||
char* p;
|
||||
double v = strtod(s, &p);
|
||||
|
@ -103,7 +103,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
}
|
||||
VERIFY(found_option);
|
||||
|
||||
const char* arg = found_option->requires_argument ? optarg : nullptr;
|
||||
char const* arg = found_option->requires_argument ? optarg : nullptr;
|
||||
if (!found_option->accept_value(arg)) {
|
||||
warnln("\033[31mInvalid value for option \033[1m{}\033[22m\033[0m", found_option->name_for_display());
|
||||
fail();
|
||||
|
@ -171,7 +171,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
for (size_t i = 0; i < m_positional_args.size(); i++) {
|
||||
auto& arg = m_positional_args[i];
|
||||
for (int j = 0; j < num_values_for_arg[i]; j++) {
|
||||
const char* value = argv[optind++];
|
||||
char const* value = argv[optind++];
|
||||
if (!arg.accept_value(value)) {
|
||||
warnln("Invalid value for argument {}", arg.name);
|
||||
fail();
|
||||
|
@ -183,7 +183,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
|
|||
return true;
|
||||
}
|
||||
|
||||
void ArgsParser::print_usage(FILE* file, const char* argv0)
|
||||
void ArgsParser::print_usage(FILE* file, char const* argv0)
|
||||
{
|
||||
char const* env_preference = getenv("ARGSPARSER_EMIT_MARKDOWN");
|
||||
if (env_preference != nullptr && env_preference[0] == '1' && env_preference[1] == 0) {
|
||||
|
@ -193,7 +193,7 @@ void ArgsParser::print_usage(FILE* file, const char* argv0)
|
|||
}
|
||||
}
|
||||
|
||||
void ArgsParser::print_usage_terminal(FILE* file, const char* argv0)
|
||||
void ArgsParser::print_usage_terminal(FILE* file, char const* argv0)
|
||||
{
|
||||
out(file, "Usage:\n\t\033[1m{}\033[0m", argv0);
|
||||
|
||||
|
@ -264,7 +264,7 @@ void ArgsParser::print_usage_terminal(FILE* file, const char* argv0)
|
|||
}
|
||||
}
|
||||
|
||||
void ArgsParser::print_usage_markdown(FILE* file, const char* argv0)
|
||||
void ArgsParser::print_usage_markdown(FILE* file, char const* argv0)
|
||||
{
|
||||
outln(file, "## Name\n\n{}", argv0);
|
||||
|
||||
|
@ -347,7 +347,7 @@ void ArgsParser::add_option(Option&& option)
|
|||
m_options.append(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden)
|
||||
void ArgsParser::add_ignored(char const* long_name, char short_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
false,
|
||||
|
@ -355,7 +355,7 @@ void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden
|
|||
long_name,
|
||||
short_name,
|
||||
nullptr,
|
||||
[](const char*) {
|
||||
[](char const*) {
|
||||
return true;
|
||||
},
|
||||
hidden,
|
||||
|
@ -363,7 +363,7 @@ void ArgsParser::add_ignored(const char* long_name, char short_name, bool hidden
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(bool& value, const char* help_string, const char* long_name, char short_name, bool hidden)
|
||||
void ArgsParser::add_option(bool& value, char const* help_string, char const* long_name, char short_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
false,
|
||||
|
@ -371,7 +371,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo
|
|||
long_name,
|
||||
short_name,
|
||||
nullptr,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
VERIFY(s == nullptr);
|
||||
value = true;
|
||||
return true;
|
||||
|
@ -381,7 +381,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(const char*& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(char const*& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -389,7 +389,7 @@ void ArgsParser::add_option(const char*& value, const char* help_string, const c
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
},
|
||||
|
@ -398,7 +398,7 @@ void ArgsParser::add_option(const char*& value, const char* help_string, const c
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(String& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -406,7 +406,7 @@ void ArgsParser::add_option(String& value, const char* help_string, const char*
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
},
|
||||
|
@ -423,7 +423,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
},
|
||||
|
@ -432,7 +432,7 @@ void ArgsParser::add_option(StringView& value, char const* help_string, char con
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(int& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(int& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -440,7 +440,7 @@ void ArgsParser::add_option(int& value, const char* help_string, const char* lon
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = StringView(s).to_int();
|
||||
value = opt.value_or(0);
|
||||
return opt.has_value();
|
||||
|
@ -450,7 +450,7 @@ void ArgsParser::add_option(int& value, const char* help_string, const char* lon
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(unsigned& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(unsigned& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -458,7 +458,7 @@ void ArgsParser::add_option(unsigned& value, const char* help_string, const char
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = StringView(s).to_uint();
|
||||
value = opt.value_or(0);
|
||||
return opt.has_value();
|
||||
|
@ -468,7 +468,7 @@ void ArgsParser::add_option(unsigned& value, const char* help_string, const char
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(double& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(double& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -476,7 +476,7 @@ void ArgsParser::add_option(double& value, const char* help_string, const char*
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = convert_to_double(s);
|
||||
value = opt.value_or(0.0);
|
||||
return opt.has_value();
|
||||
|
@ -486,7 +486,7 @@ void ArgsParser::add_option(double& value, const char* help_string, const char*
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(Optional<double>& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(Optional<double>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -494,7 +494,7 @@ void ArgsParser::add_option(Optional<double>& value, const char* help_string, co
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = convert_to_double(s);
|
||||
return value.has_value();
|
||||
},
|
||||
|
@ -503,7 +503,7 @@ void ArgsParser::add_option(Optional<double>& value, const char* help_string, co
|
|||
add_option(move(option));
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(Optional<size_t>& value, const char* help_string, const char* long_name, char short_name, const char* value_name, bool hidden)
|
||||
void ArgsParser::add_option(Optional<size_t>& value, char const* help_string, char const* long_name, char short_name, char const* value_name, bool hidden)
|
||||
{
|
||||
Option option {
|
||||
true,
|
||||
|
@ -511,7 +511,7 @@ void ArgsParser::add_option(Optional<size_t>& value, const char* help_string, co
|
|||
long_name,
|
||||
short_name,
|
||||
value_name,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = AK::StringUtils::convert_to_uint<size_t>(s);
|
||||
return value.has_value();
|
||||
},
|
||||
|
@ -551,14 +551,14 @@ void ArgsParser::add_positional_argument(Arg&& arg)
|
|||
m_positional_args.append(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(const char*& value, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(char const*& value, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
}
|
||||
|
@ -566,14 +566,14 @@ void ArgsParser::add_positional_argument(const char*& value, const char* help_st
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(String& value, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(String& value, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void ArgsParser::add_positional_argument(StringView& value, char const* help_str
|
|||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
value = s;
|
||||
return true;
|
||||
}
|
||||
|
@ -596,14 +596,14 @@ void ArgsParser::add_positional_argument(StringView& value, char const* help_str
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(int& value, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(int& value, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = StringView(s).to_int();
|
||||
value = opt.value_or(0);
|
||||
return opt.has_value();
|
||||
|
@ -612,14 +612,14 @@ void ArgsParser::add_positional_argument(int& value, const char* help_string, co
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(unsigned& value, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(unsigned& value, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = StringView(s).to_uint();
|
||||
value = opt.value_or(0);
|
||||
return opt.has_value();
|
||||
|
@ -628,14 +628,14 @@ void ArgsParser::add_positional_argument(unsigned& value, const char* help_strin
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(double& value, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(double& value, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
1,
|
||||
[&value](const char* s) {
|
||||
[&value](char const* s) {
|
||||
auto opt = convert_to_double(s);
|
||||
value = opt.value_or(0.0);
|
||||
return opt.has_value();
|
||||
|
@ -644,14 +644,14 @@ void ArgsParser::add_positional_argument(double& value, const char* help_string,
|
|||
add_positional_argument(move(arg));
|
||||
}
|
||||
|
||||
void ArgsParser::add_positional_argument(Vector<const char*>& values, const char* help_string, const char* name, Required required)
|
||||
void ArgsParser::add_positional_argument(Vector<char const*>& values, char const* help_string, char const* name, Required required)
|
||||
{
|
||||
Arg arg {
|
||||
help_string,
|
||||
name,
|
||||
required == Required::Yes ? 1 : 0,
|
||||
INT_MAX,
|
||||
[&values](const char* s) {
|
||||
[&values](char const* s) {
|
||||
values.append(s);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ ErrorOr<CommandResult> command(String const& program, Vector<String> const& argu
|
|||
close(stderr_pipe[0]);
|
||||
});
|
||||
|
||||
Vector<const char*> parts = { program.characters() };
|
||||
for (const auto& part : arguments) {
|
||||
Vector<char const*> parts = { program.characters() };
|
||||
for (auto const& part : arguments) {
|
||||
parts.append(part.characters());
|
||||
}
|
||||
parts.append(nullptr);
|
||||
|
||||
const char** argv = parts.data();
|
||||
char const** argv = parts.data();
|
||||
|
||||
posix_spawn_file_actions_t action;
|
||||
posix_spawn_file_actions_init(&action);
|
||||
|
|
|
@ -89,7 +89,7 @@ String DateTime::to_string(StringView format) const
|
|||
struct tm tm;
|
||||
localtime_r(&m_timestamp, &tm);
|
||||
StringBuilder builder;
|
||||
const int format_len = format.length();
|
||||
int const format_len = format.length();
|
||||
|
||||
auto format_time_zone_offset = [&](bool with_separator) {
|
||||
#if defined(__serenity__)
|
||||
|
@ -190,20 +190,20 @@ String DateTime::to_string(StringView format) const
|
|||
builder.appendff("{}", tm.tm_wday ? tm.tm_wday : 7);
|
||||
break;
|
||||
case 'U': {
|
||||
const int wday_of_year_beginning = (tm.tm_wday + 6 * tm.tm_yday) % 7;
|
||||
const int week_number = (tm.tm_yday + wday_of_year_beginning) / 7;
|
||||
int const wday_of_year_beginning = (tm.tm_wday + 6 * tm.tm_yday) % 7;
|
||||
int const week_number = (tm.tm_yday + wday_of_year_beginning) / 7;
|
||||
builder.appendff("{:02}", week_number);
|
||||
break;
|
||||
}
|
||||
case 'V': {
|
||||
const int wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7;
|
||||
int const wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7;
|
||||
int week_number = (tm.tm_yday + wday_of_year_beginning) / 7 + 1;
|
||||
if (wday_of_year_beginning > 3) {
|
||||
if (tm.tm_yday >= 7 - wday_of_year_beginning)
|
||||
--week_number;
|
||||
else {
|
||||
const int days_of_last_year = days_in_year(tm.tm_year + 1900 - 1);
|
||||
const int wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7;
|
||||
int const days_of_last_year = days_in_year(tm.tm_year + 1900 - 1);
|
||||
int const wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7;
|
||||
week_number = (days_of_last_year + wday_of_last_year_beginning) / 7 + 1;
|
||||
if (wday_of_last_year_beginning > 3)
|
||||
--week_number;
|
||||
|
@ -216,8 +216,8 @@ String DateTime::to_string(StringView format) const
|
|||
builder.appendff("{}", tm.tm_wday);
|
||||
break;
|
||||
case 'W': {
|
||||
const int wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7;
|
||||
const int week_number = (tm.tm_yday + wday_of_year_beginning) / 7;
|
||||
int const wday_of_year_beginning = (tm.tm_wday + 6 + 6 * tm.tm_yday) % 7;
|
||||
int const week_number = (tm.tm_yday + wday_of_year_beginning) / 7;
|
||||
builder.appendff("{:02}", week_number);
|
||||
break;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ String DateTime::to_string(StringView format) const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
Optional<DateTime> DateTime::parse(StringView format, const String& string)
|
||||
Optional<DateTime> DateTime::parse(StringView format, String const& string)
|
||||
{
|
||||
unsigned format_pos = 0;
|
||||
unsigned string_pos = 0;
|
||||
|
|
|
@ -36,9 +36,9 @@ public:
|
|||
static DateTime create(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0);
|
||||
static DateTime now();
|
||||
static DateTime from_timestamp(time_t);
|
||||
static Optional<DateTime> parse(StringView format, const String& string);
|
||||
static Optional<DateTime> parse(StringView format, String const& string);
|
||||
|
||||
bool operator<(const DateTime& other) const { return m_timestamp < other.m_timestamp; }
|
||||
bool operator<(DateTime const& other) const { return m_timestamp < other.m_timestamp; }
|
||||
|
||||
private:
|
||||
time_t m_timestamp { 0 };
|
||||
|
@ -54,7 +54,7 @@ private:
|
|||
|
||||
namespace IPC {
|
||||
|
||||
bool encode(IPC::Encoder&, const Core::DateTime&);
|
||||
bool encode(IPC::Encoder&, Core::DateTime const&);
|
||||
ErrorOr<void> decode(IPC::Decoder&, Core::DateTime&);
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
bool has_error() const { return m_error != 0; }
|
||||
int error() const { return m_error; }
|
||||
const char* error_string() const { return strerror(m_error); }
|
||||
char const* error_string() const { return strerror(m_error); }
|
||||
bool has_next();
|
||||
String next_path();
|
||||
String next_full_path();
|
||||
|
|
|
@ -25,7 +25,7 @@ Object* ChildEvent::child()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Object* ChildEvent::child() const
|
||||
Object const* ChildEvent::child() const
|
||||
{
|
||||
if (auto ref = m_child.strong_ref())
|
||||
return ref.ptr();
|
||||
|
@ -39,7 +39,7 @@ Object* ChildEvent::insertion_before_child()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Object* ChildEvent::insertion_before_child() const
|
||||
Object const* ChildEvent::insertion_before_child() const
|
||||
{
|
||||
if (auto ref = m_insertion_before_child.strong_ref())
|
||||
return ref.ptr();
|
||||
|
|
|
@ -115,10 +115,10 @@ public:
|
|||
~ChildEvent() = default;
|
||||
|
||||
Object* child();
|
||||
const Object* child() const;
|
||||
Object const* child() const;
|
||||
|
||||
Object* insertion_before_child();
|
||||
const Object* insertion_before_child() const;
|
||||
Object const* insertion_before_child() const;
|
||||
|
||||
private:
|
||||
WeakPtr<Object> m_child;
|
||||
|
|
|
@ -53,8 +53,8 @@ struct EventLoopTimer {
|
|||
TimerShouldFireWhenNotVisible fire_when_not_visible { TimerShouldFireWhenNotVisible::No };
|
||||
WeakPtr<Object> owner;
|
||||
|
||||
void reload(const Time& now);
|
||||
bool has_expired(const Time& now) const;
|
||||
void reload(Time const& now);
|
||||
bool has_expired(Time const& now) const;
|
||||
};
|
||||
|
||||
struct EventLoop::Private {
|
||||
|
@ -208,16 +208,16 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
void send_response(const JsonObject& response)
|
||||
void send_response(JsonObject const& response)
|
||||
{
|
||||
auto serialized = response.to_string();
|
||||
u32 length = serialized.length();
|
||||
// FIXME: Propagate errors
|
||||
MUST(m_socket->write({ (const u8*)&length, sizeof(length) }));
|
||||
MUST(m_socket->write({ (u8 const*)&length, sizeof(length) }));
|
||||
MUST(m_socket->write(serialized.bytes()));
|
||||
}
|
||||
|
||||
void handle_request(const JsonObject& request)
|
||||
void handle_request(JsonObject const& request)
|
||||
{
|
||||
auto type = request.get("type").as_string_or({});
|
||||
|
||||
|
@ -792,12 +792,12 @@ try_select_again:
|
|||
}
|
||||
}
|
||||
|
||||
bool EventLoopTimer::has_expired(const Time& now) const
|
||||
bool EventLoopTimer::has_expired(Time const& now) const
|
||||
{
|
||||
return now > fire_time;
|
||||
}
|
||||
|
||||
void EventLoopTimer::reload(const Time& now)
|
||||
void EventLoopTimer::reload(Time const& now)
|
||||
{
|
||||
fire_time = now + interval;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ bool File::looks_like_shared_library() const
|
|||
return File::looks_like_shared_library(m_filename);
|
||||
}
|
||||
|
||||
bool File::looks_like_shared_library(const String& filename)
|
||||
bool File::looks_like_shared_library(String const& filename)
|
||||
{
|
||||
return filename.ends_with(".so"sv) || filename.contains(".so."sv);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
if (has_any_error())
|
||||
return 0;
|
||||
|
||||
const auto buffer = m_file->read(bytes.size());
|
||||
auto const buffer = m_file->read(bytes.size());
|
||||
return buffer.bytes().copy_to(bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ IODevice::IODevice(Object* parent)
|
|||
{
|
||||
}
|
||||
|
||||
const char* IODevice::error_string() const
|
||||
char const* IODevice::error_string() const
|
||||
{
|
||||
return strerror(m_error);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ ByteBuffer IODevice::read_all()
|
|||
set_eof(true);
|
||||
break;
|
||||
}
|
||||
data.append((const u8*)read_buffer, nread);
|
||||
data.append((u8 const*)read_buffer, nread);
|
||||
}
|
||||
|
||||
auto result = ByteBuffer::copy(data);
|
||||
|
@ -166,7 +166,7 @@ String IODevice::read_line(size_t max_size)
|
|||
dbgln("IODevice::read_line: At EOF but there's more than max_size({}) buffered", max_size);
|
||||
return {};
|
||||
}
|
||||
auto line = String((const char*)m_buffered_data.data(), m_buffered_data.size(), Chomp);
|
||||
auto line = String((char const*)m_buffered_data.data(), m_buffered_data.size(), Chomp);
|
||||
m_buffered_data.clear();
|
||||
return line;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ bool IODevice::truncate(off_t size)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool IODevice::write(const u8* data, int size)
|
||||
bool IODevice::write(u8 const* data, int size)
|
||||
{
|
||||
int rc = ::write(m_fd, data, size);
|
||||
if (rc < 0) {
|
||||
|
@ -294,7 +294,7 @@ void IODevice::set_fd(int fd)
|
|||
|
||||
bool IODevice::write(StringView v)
|
||||
{
|
||||
return write((const u8*)v.characters_without_null_termination(), v.length());
|
||||
return write((u8 const*)v.characters_without_null_termination(), v.length());
|
||||
}
|
||||
|
||||
LineIterator::LineIterator(IODevice& device, bool is_end)
|
||||
|
|
|
@ -23,7 +23,7 @@ class LineIterator {
|
|||
public:
|
||||
explicit LineIterator(IODevice&, bool is_end = false);
|
||||
|
||||
bool operator==(const LineIterator& other) const { return &other == this || (at_end() && other.is_end()) || (other.at_end() && is_end()); }
|
||||
bool operator==(LineIterator const& other) const { return &other == this || (at_end() && other.is_end()) || (other.at_end() && is_end()); }
|
||||
bool is_end() const { return m_is_end; }
|
||||
bool at_end() const;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
bool eof() const { return m_eof; }
|
||||
|
||||
int error() const { return m_error; }
|
||||
const char* error_string() const;
|
||||
char const* error_string() const;
|
||||
|
||||
bool has_error() const { return m_error != 0; }
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
ByteBuffer read_all();
|
||||
String read_line(size_t max_size = 16384);
|
||||
|
||||
bool write(const u8*, int size);
|
||||
bool write(u8 const*, int size);
|
||||
bool write(StringView);
|
||||
|
||||
bool truncate(off_t);
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
nread += 8;
|
||||
m_current_byte.clear();
|
||||
} else {
|
||||
const auto bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
auto const bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
result <<= 1;
|
||||
result |= bit;
|
||||
++nread;
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
}
|
||||
} else {
|
||||
// Always take this branch for booleans or u8: there's no purpose in reading more than a single bit
|
||||
const auto bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
auto const bit = (m_current_byte.value() >> (7 - m_bit_offset)) & 1;
|
||||
if constexpr (IsSame<bool, T>)
|
||||
result = bit;
|
||||
else {
|
||||
|
|
|
@ -61,7 +61,7 @@ void LocalServer::setup_notifier()
|
|||
};
|
||||
}
|
||||
|
||||
bool LocalServer::listen(const String& address)
|
||||
bool LocalServer::listen(String const& address)
|
||||
{
|
||||
if (m_listening)
|
||||
return false;
|
||||
|
@ -92,7 +92,7 @@ bool LocalServer::listen(const String& address)
|
|||
return false;
|
||||
}
|
||||
auto un = un_optional.value();
|
||||
rc = ::bind(m_fd, (const sockaddr*)&un, sizeof(un));
|
||||
rc = ::bind(m_fd, (sockaddr const*)&un, sizeof(un));
|
||||
if (rc < 0) {
|
||||
perror("bind");
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
ErrorOr<void> take_over_from_system_server(String const& path = String());
|
||||
bool is_listening() const { return m_listening; }
|
||||
bool listen(const String& address);
|
||||
bool listen(String const& address);
|
||||
|
||||
ErrorOr<NonnullOwnPtr<Stream::LocalSocket>> accept();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
~MappedFile();
|
||||
|
||||
void* data() { return m_data; }
|
||||
const void* data() const { return m_data; }
|
||||
void const* data() const { return m_data; }
|
||||
|
||||
size_t size() const { return m_size; }
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
virtual ErrorOr<size_t> write(ReadonlyBytes bytes) override
|
||||
{
|
||||
// FIXME: Can this not error?
|
||||
const auto nwritten = bytes.copy_trimmed_to(m_bytes.slice(m_offset));
|
||||
auto const nwritten = bytes.copy_trimmed_to(m_bytes.slice(m_offset));
|
||||
m_offset += nwritten;
|
||||
return nwritten;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ Vector<URL> MimeData::urls() const
|
|||
return urls;
|
||||
}
|
||||
|
||||
void MimeData::set_urls(const Vector<URL>& urls)
|
||||
void MimeData::set_urls(Vector<URL> const& urls)
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (auto& url : urls) {
|
||||
|
@ -46,7 +46,7 @@ String MimeData::text() const
|
|||
return String::copy(m_data.get("text/plain").value_or({}));
|
||||
}
|
||||
|
||||
void MimeData::set_text(const String& text)
|
||||
void MimeData::set_text(String const& text)
|
||||
{
|
||||
set_data("text/plain", text.to_byte_buffer());
|
||||
}
|
||||
|
|
|
@ -20,27 +20,27 @@ class MimeData : public Object {
|
|||
public:
|
||||
virtual ~MimeData() = default;
|
||||
|
||||
ByteBuffer data(const String& mime_type) const { return m_data.get(mime_type).value_or({}); }
|
||||
void set_data(const String& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
|
||||
ByteBuffer data(String const& mime_type) const { return m_data.get(mime_type).value_or({}); }
|
||||
void set_data(String const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
|
||||
|
||||
bool has_format(const String& mime_type) const { return m_data.contains(mime_type); }
|
||||
bool has_format(String const& mime_type) const { return m_data.contains(mime_type); }
|
||||
Vector<String> formats() const;
|
||||
|
||||
// Convenience helpers for "text/plain"
|
||||
bool has_text() const { return has_format("text/plain"); }
|
||||
String text() const;
|
||||
void set_text(const String&);
|
||||
void set_text(String const&);
|
||||
|
||||
// Convenience helpers for "text/uri-list"
|
||||
bool has_urls() const { return has_format("text/uri-list"); }
|
||||
Vector<URL> urls() const;
|
||||
void set_urls(const Vector<URL>&);
|
||||
void set_urls(Vector<URL> const&);
|
||||
|
||||
const HashMap<String, ByteBuffer>& all_data() const { return m_data; }
|
||||
HashMap<String, ByteBuffer> const& all_data() const { return m_data; }
|
||||
|
||||
private:
|
||||
MimeData() = default;
|
||||
explicit MimeData(const HashMap<String, ByteBuffer>& data)
|
||||
explicit MimeData(HashMap<String, ByteBuffer> const& data)
|
||||
: m_data(data)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ void NetworkJob::did_progress(Optional<u32> total_size, u32 downloaded)
|
|||
on_progress(total_size, downloaded);
|
||||
}
|
||||
|
||||
const char* to_string(NetworkJob::Error error)
|
||||
char const* to_string(NetworkJob::Error error)
|
||||
{
|
||||
switch (error) {
|
||||
case NetworkJob::Error::ProtocolFailed:
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
virtual ~NetworkJob() override = default;
|
||||
|
||||
// Could fire twice, after Headers and after Trailers!
|
||||
Function<void(const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> response_code)> on_headers_received;
|
||||
Function<void(HashMap<String, String, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code)> on_headers_received;
|
||||
Function<void(bool success)> on_finish;
|
||||
Function<void(Optional<u32>, u32)> on_progress;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
bool has_error() const { return m_error != Error::None; }
|
||||
Error error() const { return m_error; }
|
||||
NetworkResponse* response() { return m_response.ptr(); }
|
||||
const NetworkResponse* response() const { return m_response.ptr(); }
|
||||
NetworkResponse const* response() const { return m_response.ptr(); }
|
||||
|
||||
enum class ShutdownMode {
|
||||
DetachFromSocket,
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
Error m_error { Error::None };
|
||||
};
|
||||
|
||||
const char* to_string(NetworkJob::Error);
|
||||
char const* to_string(NetworkJob::Error);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ bool Object::set_property(String const& name, JsonValue const& value)
|
|||
return it->value->set(value);
|
||||
}
|
||||
|
||||
bool Object::is_ancestor_of(const Object& other) const
|
||||
bool Object::is_ancestor_of(Object const& other) const
|
||||
{
|
||||
if (&other == this)
|
||||
return false;
|
||||
|
@ -247,7 +247,7 @@ void Object::decrement_inspector_count(Badge<InspectorServerConnection>)
|
|||
did_end_inspection();
|
||||
}
|
||||
|
||||
void Object::register_property(const String& name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter)
|
||||
void Object::register_property(String const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
|
||||
{
|
||||
m_properties.set(name, make<Property>(name, move(getter), move(setter)));
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ ObjectClassRegistration::ObjectClassRegistration(StringView class_name, Function
|
|||
object_classes().set(class_name, this);
|
||||
}
|
||||
|
||||
bool ObjectClassRegistration::is_derived_from(const ObjectClassRegistration& base_class) const
|
||||
bool ObjectClassRegistration::is_derived_from(ObjectClassRegistration const& base_class) const
|
||||
{
|
||||
if (&base_class == this)
|
||||
return true;
|
||||
|
@ -280,14 +280,14 @@ bool ObjectClassRegistration::is_derived_from(const ObjectClassRegistration& bas
|
|||
return m_parent_class->is_derived_from(base_class);
|
||||
}
|
||||
|
||||
void ObjectClassRegistration::for_each(Function<void(const ObjectClassRegistration&)> callback)
|
||||
void ObjectClassRegistration::for_each(Function<void(ObjectClassRegistration const&)> callback)
|
||||
{
|
||||
for (auto& it : object_classes()) {
|
||||
callback(*it.value);
|
||||
}
|
||||
}
|
||||
|
||||
const ObjectClassRegistration* ObjectClassRegistration::find(StringView class_name)
|
||||
ObjectClassRegistration const* ObjectClassRegistration::find(StringView class_name)
|
||||
{
|
||||
return object_classes().get(class_name).value_or(nullptr);
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ public:
|
|||
~ObjectClassRegistration() = default;
|
||||
|
||||
StringView class_name() const { return m_class_name; }
|
||||
const ObjectClassRegistration* parent_class() const { return m_parent_class; }
|
||||
ObjectClassRegistration const* parent_class() const { return m_parent_class; }
|
||||
RefPtr<Object> construct() const { return m_factory(); }
|
||||
bool is_derived_from(const ObjectClassRegistration& base_class) const;
|
||||
bool is_derived_from(ObjectClassRegistration const& base_class) const;
|
||||
|
||||
static void for_each(Function<void(const ObjectClassRegistration&)>);
|
||||
static const ObjectClassRegistration* find(StringView class_name);
|
||||
static void for_each(Function<void(ObjectClassRegistration const&)>);
|
||||
static ObjectClassRegistration const* find(StringView class_name);
|
||||
|
||||
private:
|
||||
StringView m_class_name;
|
||||
|
@ -98,11 +98,11 @@ public:
|
|||
|
||||
virtual StringView class_name() const = 0;
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
String const& name() const { return m_name; }
|
||||
void set_name(String name) { m_name = move(name); }
|
||||
|
||||
NonnullRefPtrVector<Object>& children() { return m_children; }
|
||||
const NonnullRefPtrVector<Object>& children() const { return m_children; }
|
||||
NonnullRefPtrVector<Object> const& children() const { return m_children; }
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_child(Callback callback)
|
||||
|
@ -117,15 +117,15 @@ public:
|
|||
void for_each_child_of_type(Callback callback) requires IsBaseOf<Object, T>;
|
||||
|
||||
template<typename T>
|
||||
T* find_child_of_type_named(const String&) requires IsBaseOf<Object, T>;
|
||||
T* find_child_of_type_named(String const&) requires IsBaseOf<Object, T>;
|
||||
|
||||
template<typename T>
|
||||
T* find_descendant_of_type_named(const String&) requires IsBaseOf<Object, T>;
|
||||
T* find_descendant_of_type_named(String const&) requires IsBaseOf<Object, T>;
|
||||
|
||||
bool is_ancestor_of(const Object&) const;
|
||||
bool is_ancestor_of(Object const&) const;
|
||||
|
||||
Object* parent() { return m_parent; }
|
||||
const Object* parent() const { return m_parent; }
|
||||
Object const* parent() const { return m_parent; }
|
||||
|
||||
void start_timer(int ms, TimerShouldFireWhenNotVisible = TimerShouldFireWhenNotVisible::No);
|
||||
void stop_timer();
|
||||
|
@ -146,9 +146,9 @@ public:
|
|||
|
||||
void save_to(JsonObject&);
|
||||
|
||||
bool set_property(String const& name, const JsonValue& value);
|
||||
bool set_property(String const& name, JsonValue const& value);
|
||||
JsonValue property(String const& name) const;
|
||||
const HashMap<String, NonnullOwnPtr<Property>>& properties() const { return m_properties; }
|
||||
HashMap<String, NonnullOwnPtr<Property>> const& properties() const { return m_properties; }
|
||||
|
||||
static IntrusiveList<&Object::m_all_objects_list_node>& all_objects();
|
||||
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
protected:
|
||||
explicit Object(Object* parent = nullptr);
|
||||
|
||||
void register_property(const String& name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter = nullptr);
|
||||
void register_property(String const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
|
||||
|
||||
virtual void event(Core::Event&);
|
||||
|
||||
|
@ -213,7 +213,7 @@ private:
|
|||
|
||||
template<>
|
||||
struct AK::Formatter<Core::Object> : AK::Formatter<FormatString> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, const Core::Object& value)
|
||||
ErrorOr<void> format(FormatBuilder& builder, Core::Object const& value)
|
||||
{
|
||||
return AK::Formatter<FormatString>::format(builder, "{}({})", value.class_name(), &value);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ inline void Object::for_each_child_of_type(Callback callback) requires IsBaseOf<
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
T* Object::find_child_of_type_named(const String& name) requires IsBaseOf<Object, T>
|
||||
T* Object::find_child_of_type_named(String const& name) requires IsBaseOf<Object, T>
|
||||
{
|
||||
T* found_child = nullptr;
|
||||
for_each_child_of_type<T>([&](auto& child) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
Property::Property(String name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter)
|
||||
Property::Property(String name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter)
|
||||
: m_name(move(name))
|
||||
, m_getter(move(getter))
|
||||
, m_setter(move(setter))
|
||||
|
|
|
@ -16,10 +16,10 @@ class Property {
|
|||
AK_MAKE_NONCOPYABLE(Property);
|
||||
|
||||
public:
|
||||
Property(String name, Function<JsonValue()> getter, Function<bool(const JsonValue&)> setter = nullptr);
|
||||
Property(String name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);
|
||||
~Property() = default;
|
||||
|
||||
bool set(const JsonValue& value)
|
||||
bool set(JsonValue const& value)
|
||||
{
|
||||
if (!m_setter)
|
||||
return false;
|
||||
|
@ -28,13 +28,13 @@ public:
|
|||
|
||||
JsonValue get() const { return m_getter(); }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
String const& name() const { return m_name; }
|
||||
bool is_readonly() const { return !m_setter; }
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
Function<JsonValue()> m_getter;
|
||||
Function<bool(const JsonValue&)> m_setter;
|
||||
Function<bool(JsonValue const&)> m_setter;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
[[nodiscard]] bool is_empty() const { return m_secure_buffer.is_empty(); }
|
||||
[[nodiscard]] size_t length() const { return m_secure_buffer.size(); }
|
||||
[[nodiscard]] char const* characters() const { return reinterpret_cast<const char*>(m_secure_buffer.data()); }
|
||||
[[nodiscard]] char const* characters() const { return reinterpret_cast<char const*>(m_secure_buffer.data()); }
|
||||
[[nodiscard]] StringView view() const { return { characters(), length() }; }
|
||||
|
||||
SecretString() = default;
|
||||
|
|
|
@ -25,20 +25,20 @@ public:
|
|||
};
|
||||
|
||||
SocketAddress() = default;
|
||||
SocketAddress(const IPv4Address& address)
|
||||
SocketAddress(IPv4Address const& address)
|
||||
: m_type(Type::IPv4)
|
||||
, m_ipv4_address(address)
|
||||
{
|
||||
}
|
||||
|
||||
SocketAddress(const IPv4Address& address, u16 port)
|
||||
SocketAddress(IPv4Address const& address, u16 port)
|
||||
: m_type(Type::IPv4)
|
||||
, m_ipv4_address(address)
|
||||
, m_port(port)
|
||||
{
|
||||
}
|
||||
|
||||
static SocketAddress local(const String& address)
|
||||
static SocketAddress local(String const& address)
|
||||
{
|
||||
SocketAddress addr;
|
||||
addr.m_type = Type::Local;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
# include <linux/memfd.h>
|
||||
# include <sys/syscall.h>
|
||||
|
||||
static int memfd_create(const char* name, unsigned int flags)
|
||||
static int memfd_create(char const* name, unsigned int flags)
|
||||
{
|
||||
return syscall(SYS_memfd_create, name, flags);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ static void parse_sockets_from_system_server()
|
|||
VERIFY(!s_overtaken_sockets_parsed);
|
||||
|
||||
constexpr auto socket_takeover = "SOCKET_TAKEOVER";
|
||||
const char* sockets = getenv(socket_takeover);
|
||||
char const* sockets = getenv(socket_takeover);
|
||||
if (!sockets) {
|
||||
s_overtaken_sockets_parsed = true;
|
||||
return;
|
||||
|
|
|
@ -38,7 +38,7 @@ UDPServer::~UDPServer()
|
|||
::close(m_fd);
|
||||
}
|
||||
|
||||
bool UDPServer::bind(const IPv4Address& address, u16 port)
|
||||
bool UDPServer::bind(IPv4Address const& address, u16 port)
|
||||
{
|
||||
if (m_bound)
|
||||
return false;
|
||||
|
@ -46,7 +46,7 @@ bool UDPServer::bind(const IPv4Address& address, u16 port)
|
|||
auto saddr = SocketAddress(address, port);
|
||||
auto in = saddr.to_sockaddr_in();
|
||||
|
||||
if (::bind(m_fd, (const sockaddr*)&in, sizeof(in)) != 0) {
|
||||
if (::bind(m_fd, (sockaddr const*)&in, sizeof(in)) != 0) {
|
||||
perror("UDPServer::bind");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
bool is_bound() const { return m_bound; }
|
||||
|
||||
bool bind(const IPv4Address& address, u16 port);
|
||||
bool bind(IPv4Address const& address, u16 port);
|
||||
ByteBuffer receive(size_t size, sockaddr_in& from);
|
||||
ByteBuffer receive(size_t size)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue