mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:37:44 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -12,8 +12,8 @@ namespace Archive {
|
|||
unsigned TarFileHeader::expected_checksum() const
|
||||
{
|
||||
auto checksum = 0u;
|
||||
const u8* u8_this = reinterpret_cast<const u8*>(this);
|
||||
const u8* u8_m_checksum = reinterpret_cast<const u8*>(&m_checksum);
|
||||
u8 const* u8_this = reinterpret_cast<u8 const*>(this);
|
||||
u8 const* u8_m_checksum = reinterpret_cast<u8 const*>(&m_checksum);
|
||||
for (auto i = 0u; i < sizeof(TarFileHeader); ++i) {
|
||||
if (u8_this + i >= u8_m_checksum && u8_this + i < u8_m_checksum + sizeof(m_checksum)) {
|
||||
checksum += ' ';
|
||||
|
|
|
@ -38,7 +38,7 @@ constexpr StringView posix1_tar_magic = ""; // POSIX.1-1988 format magic
|
|||
constexpr StringView posix1_tar_version = ""; // POSIX.1-1988 format version
|
||||
|
||||
template<size_t N>
|
||||
static size_t get_field_as_integral(const char (&field)[N])
|
||||
static size_t get_field_as_integral(char const (&field)[N])
|
||||
{
|
||||
size_t value = 0;
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
|
@ -53,7 +53,7 @@ static size_t get_field_as_integral(const char (&field)[N])
|
|||
}
|
||||
|
||||
template<size_t N>
|
||||
static StringView get_field_as_string_view(const char (&field)[N])
|
||||
static StringView get_field_as_string_view(char const (&field)[N])
|
||||
{
|
||||
return { field, min(__builtin_strlen(field), N) };
|
||||
}
|
||||
|
@ -95,23 +95,23 @@ public:
|
|||
// FIXME: support ustar filename prefix
|
||||
StringView prefix() const { return get_field_as_string_view(m_prefix); }
|
||||
|
||||
void set_filename(const String& filename) { set_field(m_filename, filename); }
|
||||
void set_filename(String const& filename) { set_field(m_filename, filename); }
|
||||
void set_mode(mode_t mode) { set_octal_field(m_mode, mode); }
|
||||
void set_uid(uid_t uid) { set_octal_field(m_uid, uid); }
|
||||
void set_gid(gid_t gid) { set_octal_field(m_gid, gid); }
|
||||
void set_size(size_t size) { set_octal_field(m_size, size); }
|
||||
void set_timestamp(time_t timestamp) { set_octal_field(m_timestamp, timestamp); }
|
||||
void set_type_flag(TarFileType type) { m_type_flag = to_underlying(type); }
|
||||
void set_link_name(const String& link_name) { set_field(m_link_name, link_name); }
|
||||
void set_link_name(String const& link_name) { set_field(m_link_name, link_name); }
|
||||
// magic doesn't necessarily include a null byte
|
||||
void set_magic(StringView magic) { set_field(m_magic, magic); }
|
||||
// version doesn't necessarily include a null byte
|
||||
void set_version(StringView version) { set_field(m_version, version); }
|
||||
void set_owner_name(const String& owner_name) { set_field(m_owner_name, owner_name); }
|
||||
void set_group_name(const String& group_name) { set_field(m_group_name, group_name); }
|
||||
void set_owner_name(String const& owner_name) { set_field(m_owner_name, owner_name); }
|
||||
void set_group_name(String const& group_name) { set_field(m_group_name, group_name); }
|
||||
void set_major(int major) { set_octal_field(m_major, major); }
|
||||
void set_minor(int minor) { set_octal_field(m_minor, minor); }
|
||||
void set_prefix(const String& prefix) { set_field(m_prefix, prefix); }
|
||||
void set_prefix(String const& prefix) { set_field(m_prefix, prefix); }
|
||||
|
||||
unsigned expected_checksum() const;
|
||||
void calculate_checksum();
|
||||
|
|
|
@ -128,7 +128,7 @@ TarOutputStream::TarOutputStream(OutputStream& stream)
|
|||
{
|
||||
}
|
||||
|
||||
void TarOutputStream::add_directory(const String& path, mode_t mode)
|
||||
void TarOutputStream::add_directory(String const& path, mode_t mode)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
TarFileHeader header {};
|
||||
|
@ -144,7 +144,7 @@ void TarOutputStream::add_directory(const String& path, mode_t mode)
|
|||
VERIFY(m_stream.write_or_error(Bytes { &padding, block_size - sizeof(header) }));
|
||||
}
|
||||
|
||||
void TarOutputStream::add_file(const String& path, mode_t mode, ReadonlyBytes bytes)
|
||||
void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes bytes)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
TarFileHeader header {};
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
void advance();
|
||||
bool finished() const { return m_finished; }
|
||||
bool valid() const;
|
||||
const TarFileHeader& header() const { return m_header; }
|
||||
TarFileHeader const& header() const { return m_header; }
|
||||
TarFileStream file_contents();
|
||||
|
||||
template<VoidFunction<StringView, StringView> F>
|
||||
|
@ -56,8 +56,8 @@ private:
|
|||
class TarOutputStream {
|
||||
public:
|
||||
TarOutputStream(OutputStream&);
|
||||
void add_file(const String& path, mode_t, ReadonlyBytes);
|
||||
void add_directory(const String& path, mode_t);
|
||||
void add_file(String const& path, mode_t, ReadonlyBytes);
|
||||
void add_directory(String const& path, mode_t);
|
||||
void finish();
|
||||
|
||||
private:
|
||||
|
|
|
@ -80,7 +80,7 @@ Optional<Zip> Zip::try_create(ReadonlyBytes buffer)
|
|||
};
|
||||
}
|
||||
|
||||
bool Zip::for_each_member(Function<IterationDecision(const ZipMember&)> callback)
|
||||
bool Zip::for_each_member(Function<IterationDecision(ZipMember const&)> callback)
|
||||
{
|
||||
size_t member_offset = m_members_start_offset;
|
||||
for (size_t i = 0; i < m_member_count; i++) {
|
||||
|
@ -119,7 +119,7 @@ static u16 minimum_version_needed(ZipCompressionMethod method)
|
|||
return method == ZipCompressionMethod::Deflate ? 20 : 10;
|
||||
}
|
||||
|
||||
void ZipOutputStream::add_member(const ZipMember& member)
|
||||
void ZipOutputStream::add_member(ZipMember const& member)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
VERIFY(member.name.length() <= UINT16_MAX);
|
||||
|
@ -151,7 +151,7 @@ void ZipOutputStream::finish()
|
|||
|
||||
auto file_header_offset = 0u;
|
||||
auto central_directory_size = 0u;
|
||||
for (const ZipMember& member : m_members) {
|
||||
for (ZipMember const& member : m_members) {
|
||||
auto zip_version = minimum_version_needed(member.compression_method);
|
||||
CentralDirectoryRecord central_directory_record {
|
||||
.made_by_version = zip_version,
|
||||
|
|
|
@ -42,7 +42,7 @@ struct [[gnu::packed]] EndOfCentralDirectory {
|
|||
u32 central_directory_size;
|
||||
u32 central_directory_offset;
|
||||
u16 comment_length;
|
||||
const u8* comment;
|
||||
u8 const* comment;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -103,9 +103,9 @@ struct [[gnu::packed]] CentralDirectoryRecord {
|
|||
u16 internal_attributes;
|
||||
u32 external_attributes;
|
||||
u32 local_file_header_offset;
|
||||
const u8* name;
|
||||
const u8* extra_data;
|
||||
const u8* comment;
|
||||
u8 const* name;
|
||||
u8 const* extra_data;
|
||||
u8 const* comment;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -167,9 +167,9 @@ struct [[gnu::packed]] LocalFileHeader {
|
|||
u32 uncompressed_size;
|
||||
u16 name_length;
|
||||
u16 extra_data_length;
|
||||
const u8* name;
|
||||
const u8* extra_data;
|
||||
const u8* compressed_data;
|
||||
u8 const* name;
|
||||
u8 const* extra_data;
|
||||
u8 const* compressed_data;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ struct ZipMember {
|
|||
class Zip {
|
||||
public:
|
||||
static Optional<Zip> try_create(ReadonlyBytes buffer);
|
||||
bool for_each_member(Function<IterationDecision(const ZipMember&)>);
|
||||
bool for_each_member(Function<IterationDecision(ZipMember const&)>);
|
||||
|
||||
private:
|
||||
static bool find_end_of_central_directory_offset(ReadonlyBytes, size_t& offset);
|
||||
|
@ -237,7 +237,7 @@ private:
|
|||
class ZipOutputStream {
|
||||
public:
|
||||
ZipOutputStream(OutputStream&);
|
||||
void add_member(const ZipMember&);
|
||||
void add_member(ZipMember const&);
|
||||
void finish();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue