sys: Added clang-format file, formatted entire project

This commit is contained in:
WerWolv
2022-01-24 20:53:17 +01:00
parent a66fec489c
commit 0e08b0226b
168 changed files with 5178 additions and 4866 deletions

View File

@@ -44,12 +44,12 @@ namespace hex::plugin::builtin::prv {
std::set<std::string> m_availableDrives;
fs::path m_path;
#if defined(OS_WINDOWS)
HANDLE m_diskHandle = INVALID_HANDLE_VALUE;
#else
std::string m_pathBuffer;
int m_diskHandle = -1;
#endif
#if defined(OS_WINDOWS)
HANDLE m_diskHandle = INVALID_HANDLE_VALUE;
#else
std::string m_pathBuffer;
int m_diskHandle = -1;
#endif
size_t m_diskSize;
size_t m_sectorSize;

View File

@@ -7,11 +7,11 @@
#include <sys/stat.h>
#if defined(OS_WINDOWS)
#include <windows.h>
#include <windows.h>
#else
#include <sys/mman.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <sys/fcntl.h>
#endif
namespace hex::plugin::builtin::prv {
@@ -49,12 +49,12 @@ namespace hex::plugin::builtin::prv {
void close() override;
protected:
#if defined(OS_WINDOWS)
#if defined(OS_WINDOWS)
HANDLE m_file = INVALID_HANDLE_VALUE;
HANDLE m_mapping = INVALID_HANDLE_VALUE;
#else
#else
int m_file = -1;
#endif
#endif
fs::path m_path;
void *m_mappedFile = nullptr;

View File

@@ -9,7 +9,7 @@
namespace hex::plugin::builtin::prv {
class GDBProvider : public hex::prv::Provider {
class GDBProvider : public hex::prv::Provider {
public:
explicit GDBProvider();
~GDBProvider() override;

View File

@@ -7,7 +7,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewBookmarks : public View {
public:

View File

@@ -10,7 +10,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewDataInspector : public View {
public:
@@ -28,7 +30,7 @@ namespace hex::plugin::builtin {
bool m_shouldInvalidate = true;
std::endian m_endian = std::endian::native;
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle =ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
u64 m_startAddress = 0;
size_t m_validBytes = 0;

View File

@@ -12,7 +12,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewDataProcessor : public View {
public:
@@ -22,11 +24,11 @@ namespace hex::plugin::builtin {
void drawContent() override;
private:
std::list<dp::Node*> m_endNodes;
std::list<dp::Node*> m_nodes;
std::list<dp::Link> m_links;
std::list<dp::Node *> m_endNodes;
std::list<dp::Node *> m_nodes;
std::list<dp::Link> m_links;
std::vector<hex::prv::Overlay*> m_dataOverlays;
std::vector<hex::prv::Overlay *> m_dataOverlays;
int m_rightClickedId = -1;
ImVec2 m_rightClickedCoords;

View File

@@ -11,7 +11,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewDiff : public View {
public:

View File

@@ -10,7 +10,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
struct Disassembly {
u64 address;

View File

@@ -8,7 +8,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewHashes : public View {
public:
@@ -18,7 +20,17 @@ namespace hex::plugin::builtin {
void drawContent() override;
private:
enum class HashFunctions { Crc8, Crc16, Crc32, Md5, Sha1, Sha224, Sha256, Sha384, Sha512 };
enum class HashFunctions {
Crc8,
Crc16,
Crc32,
Md5,
Sha1,
Sha224,
Sha256,
Sha384,
Sha512
};
bool m_shouldInvalidate = true;
int m_currHashFunction = 0;
@@ -26,15 +38,15 @@ namespace hex::plugin::builtin {
bool m_shouldMatchSelection = false;
static constexpr std::array hashFunctionNames {
std::pair{HashFunctions::Crc8, "CRC8"},
std::pair{HashFunctions::Crc16, "CRC16"},
std::pair{HashFunctions::Crc32, "CRC32"},
std::pair{HashFunctions::Md5, "MD5"},
std::pair{HashFunctions::Sha1, "SHA-1"},
std::pair{HashFunctions::Sha224, "SHA-224"},
std::pair{HashFunctions::Sha256, "SHA-256"},
std::pair{HashFunctions::Sha384, "SHA-384"},
std::pair{HashFunctions::Sha512, "SHA-512"},
std::pair {HashFunctions::Crc8, "CRC8" },
std::pair { HashFunctions::Crc16, "CRC16" },
std::pair { HashFunctions::Crc32, "CRC32" },
std::pair { HashFunctions::Md5, "MD5" },
std::pair { HashFunctions::Sha1, "SHA-1" },
std::pair { HashFunctions::Sha224, "SHA-224"},
std::pair { HashFunctions::Sha256, "SHA-256"},
std::pair { HashFunctions::Sha384, "SHA-384"},
std::pair { HashFunctions::Sha512, "SHA-512"},
};
};

View File

@@ -11,7 +11,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewHelp : public View {
public:

View File

@@ -10,13 +10,15 @@
#include <random>
#include <vector>
namespace hex::prv { class Provider; }
namespace hex::prv {
class Provider;
}
namespace hex::plugin::builtin {
using SearchFunction = std::vector<std::pair<u64, u64>> (*)(prv::Provider* &provider, std::string string);
using SearchFunction = std::vector<std::pair<u64, u64>> (*)(prv::Provider *&provider, std::string string);
class ViewHexEditor : public View {
public:
@@ -44,7 +46,7 @@ namespace hex::plugin::builtin {
u64 m_resizeSize = 0;
std::vector<u8> m_dataToSave;
std::set<pl::PatternData*> m_highlightedPatterns;
std::set<pl::PatternData *> m_highlightedPatterns;
std::string m_loaderScriptScriptPath;
std::string m_loaderScriptFilePath;

View File

@@ -10,7 +10,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewInformation : public View {
public:

View File

@@ -9,7 +9,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewPatches : public View {
public:

View File

@@ -11,8 +11,12 @@
namespace hex {
namespace prv { class Provider; }
namespace lang { class PatternData; }
namespace prv {
class Provider;
}
namespace lang {
class PatternData;
}
}
@@ -27,7 +31,7 @@ namespace hex::plugin::builtin {
void drawContent() override;
private:
std::vector<pl::PatternData*> m_sortedPatternData;
std::vector<pl::PatternData *> m_sortedPatternData;
};
}

View File

@@ -7,7 +7,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
struct FoundString {
u64 offset;

View File

@@ -10,7 +10,9 @@
namespace hex::plugin::builtin {
namespace prv { class Provider; }
namespace prv {
class Provider;
}
class ViewTools : public View {
public:
@@ -18,7 +20,6 @@ namespace hex::plugin::builtin {
~ViewTools() override;
void drawContent() override;
};
}

View File

@@ -20,31 +20,31 @@ namespace hex {
};
enum class Operator : u16 {
Invalid = 0x000,
Assign = 0x010,
Or = 0x020,
Xor = 0x030,
And = 0x040,
BitwiseOr = 0x050,
BitwiseXor = 0x060,
BitwiseAnd = 0x070,
Equals = 0x080,
NotEquals = 0x081,
GreaterThan = 0x090,
LessThan = 0x091,
GreaterThanOrEquals = 0x092,
LessThanOrEquals = 0x093,
ShiftLeft = 0x0A0,
ShiftRight = 0x0A1,
Addition = 0x0B0,
Subtraction = 0x0B1,
Multiplication = 0x0C0,
Division = 0x0C1,
Modulus = 0x0C2,
Exponentiation = 0x1D0,
Combine = 0x0E0,
BitwiseNot = 0x0F0,
Not = 0x0F1
Invalid = 0x000,
Assign = 0x010,
Or = 0x020,
Xor = 0x030,
And = 0x040,
BitwiseOr = 0x050,
BitwiseXor = 0x060,
BitwiseAnd = 0x070,
Equals = 0x080,
NotEquals = 0x081,
GreaterThan = 0x090,
LessThan = 0x091,
GreaterThanOrEquals = 0x092,
LessThanOrEquals = 0x093,
ShiftLeft = 0x0A0,
ShiftRight = 0x0A1,
Addition = 0x0B0,
Subtraction = 0x0B1,
Multiplication = 0x0C0,
Division = 0x0C1,
Modulus = 0x0C2,
Exponentiation = 0x1D0,
Combine = 0x0E0,
BitwiseNot = 0x0F0,
Not = 0x0F1
};
enum class BracketType : std::uint8_t {
@@ -74,7 +74,7 @@ namespace hex {
void setVariable(std::string name, long double value);
void setFunction(std::string name, std::function<std::optional<long double>(std::vector<long double>)> function, size_t minNumArgs, size_t maxNumArgs);
std::unordered_map<std::string, long double>& getVariables() { return this->m_variables; }
std::unordered_map<std::string, long double> &getVariables() { return this->m_variables; }
private:
std::queue<Token> parseInput(const char *input);