pmt: reformat code
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
|
||||
namespace PartitionManager {
|
||||
RUN_ASYNC(backupFunction)(const std::string &partitionName,
|
||||
const std::string &outputName,
|
||||
const uint64_t bufferSize) {
|
||||
const std::string &outputName,
|
||||
const uint64_t bufferSize) {
|
||||
if (!Variables->PartMap->hasPartition(partitionName))
|
||||
return {format("Couldn't find partition: %s", partitionName.data()), false};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Copyright 2025 Yağız Zengin
|
||||
|
||||
namespace PartitionManager {
|
||||
RUN_ASYNC(eraseFunction)(const std::string &partitionName,
|
||||
const uint64_t bufferSize) {
|
||||
const uint64_t bufferSize) {
|
||||
if (!Variables->PartMap->hasPartition(partitionName))
|
||||
return {format("Couldn't find partition: %s", partitionName.data()), false};
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ Copyright 2025 Yağız Zengin
|
||||
|
||||
namespace PartitionManager {
|
||||
RUN_ASYNC(flashFunction)(const std::string &partitionName,
|
||||
const std::string &imageName,
|
||||
const uint64_t bufferSize) {
|
||||
const std::string &imageName,
|
||||
const uint64_t bufferSize) {
|
||||
if (!Helper::fileIsExists(imageName))
|
||||
return {format("Couldn't find image file: %s", imageName.data()), false};
|
||||
if (!Variables->PartMap->hasPartition(partitionName))
|
||||
|
||||
@@ -32,9 +32,9 @@ INIT(partitionSizeFunction) {
|
||||
<< "Initializing variables of partition size getter function."
|
||||
<< std::endl;
|
||||
cmd = _app.add_subcommand("sizeof", "Tell size(s) of input partition list")
|
||||
->footer("Use get-all or getvar-all as partition name for getting "
|
||||
"sizes of all "
|
||||
"partitions.");
|
||||
->footer("Use get-all or getvar-all as partition name for getting "
|
||||
"sizes of all "
|
||||
"partitions.");
|
||||
cmd->add_option("partition(s)", partitions, "Partition name(s).")
|
||||
->required()
|
||||
->delimiter(',');
|
||||
|
||||
@@ -25,14 +25,15 @@
|
||||
#define RUN(cls) bool cls::run()
|
||||
#define RUN_ASYNC(cls) pair cls::runAsync
|
||||
#define IS_USED(cls) bool cls::isUsed() const
|
||||
#define IS_USED_COMMON_BODY(cls) bool cls::isUsed() const { return cmd->parsed(); }
|
||||
#define IS_USED_COMMON_BODY(cls) \
|
||||
bool cls::isUsed() const { return cmd->parsed(); }
|
||||
#define NAME(cls) const char *cls::name() const
|
||||
|
||||
#define COMMON_FUNCTION_BODY() \
|
||||
CLI::App *cmd = nullptr; \
|
||||
bool init(CLI::App &_app) override; \
|
||||
bool run() override; \
|
||||
[[nodiscard]] bool isUsed() const override; \
|
||||
#define COMMON_FUNCTION_BODY() \
|
||||
CLI::App *cmd = nullptr; \
|
||||
bool init(CLI::App &_app) override; \
|
||||
bool run() override; \
|
||||
[[nodiscard]] bool isUsed() const override; \
|
||||
[[nodiscard]] const char *name() const override
|
||||
|
||||
namespace PartitionManager {
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
void delAfterProgress(char *&_ptr);
|
||||
void delAfterProgress(uint8_t *&_ptr);
|
||||
void delFileAfterProgress(const std::string& path);
|
||||
void delFileAfterProgress(const std::string &path);
|
||||
void closeAfterProgress(FILE *&_fp);
|
||||
void closeAfterProgress(int _fd);
|
||||
};
|
||||
@@ -244,11 +244,12 @@ std::string getLibVersion();
|
||||
if (condition) Helper::Logger(level, __func__, file, name, __FILE__, __LINE__)
|
||||
|
||||
#ifdef ANDROID_BUILD
|
||||
#define MKVERSION(name) \
|
||||
char vinfo[512]; \
|
||||
sprintf(vinfo, \
|
||||
"%s 1.2.0\nBuildType: Release\nCompiler: clang\n" \
|
||||
"BuildFlags: -Wall;-Werror;-Wno-deprecated-declarations;-Os", name); \
|
||||
#define MKVERSION(name) \
|
||||
char vinfo[512]; \
|
||||
sprintf(vinfo, \
|
||||
"%s 1.2.0\nBuildType: Release\nCompiler: clang\n" \
|
||||
"BuildFlags: -Wall;-Werror;-Wno-deprecated-declarations;-Os", \
|
||||
name); \
|
||||
return std::string(vinfo)
|
||||
#else
|
||||
#define MKVERSION(name) \
|
||||
|
||||
@@ -63,14 +63,14 @@ Logger::~Logger() {
|
||||
#else
|
||||
LoggingProperties::setLogFile("last_logs.log");
|
||||
#endif
|
||||
LOGN(HELPER, INFO) << "Cannot create log file: " << _logFile << ": "
|
||||
<< strerror(errno)
|
||||
LOGN(HELPER, INFO)
|
||||
<< "Cannot create log file: " << _logFile << ": " << strerror(errno)
|
||||
#ifdef ANDROID_BUILD
|
||||
<< " New logging file: /tmp/last_pmt_logs.log (this file)."
|
||||
<< " New logging file: /tmp/last_pmt_logs.log (this file)."
|
||||
#else
|
||||
<< " New logging file: last_logs.log (this file)."
|
||||
<< " New logging file: last_logs.log (this file)."
|
||||
#endif
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,8 @@ bool basic_partition_map_builder::readDefaultDirectories() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool basic_partition_map_builder::copyPartitionsToVector(std::vector<std::string> &vec) const {
|
||||
bool basic_partition_map_builder::copyPartitionsToVector(
|
||||
std::vector<std::string> &vec) const {
|
||||
if (_current_map.empty()) {
|
||||
LOGN(MAP, ERROR) << "Current map is empty.";
|
||||
return false;
|
||||
@@ -229,7 +230,8 @@ bool basic_partition_map_builder::copyPartitionsToVector(std::vector<std::string
|
||||
return true;
|
||||
}
|
||||
|
||||
bool basic_partition_map_builder::copyLogicalPartitionsToVector(std::vector<std::string> &vec) const {
|
||||
bool basic_partition_map_builder::copyLogicalPartitionsToVector(
|
||||
std::vector<std::string> &vec) const {
|
||||
if (_current_map.empty()) {
|
||||
LOGN(MAP, ERROR) << "Current map is empty.";
|
||||
return false;
|
||||
@@ -245,7 +247,8 @@ bool basic_partition_map_builder::copyLogicalPartitionsToVector(std::vector<std:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool basic_partition_map_builder::copyPhysicalPartitionsToVector(std::vector<std::string> &vec) const {
|
||||
bool basic_partition_map_builder::copyPhysicalPartitionsToVector(
|
||||
std::vector<std::string> &vec) const {
|
||||
if (_current_map.empty()) {
|
||||
LOGN(MAP, ERROR) << "Current map is empty.";
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user