pmt: Improve pmt & libpartition_map

- Change some operator returnn types.
 - Use std::map instead of std::unordered on magic number maps.
 - Some improvements.
This commit is contained in:
2025-09-01 01:21:06 +03:00
parent fea9c834fc
commit e7baf4f5bc
15 changed files with 115 additions and 94 deletions

View File

@@ -16,11 +16,13 @@
#include "functions.hpp"
#include <PartitionManager/PartitionManager.hpp>
#include <map>
#define TFUN "typeFunction"
#define FUNCTION_CLASS typeFunction
namespace PartitionManager {
INIT(typeFunction) {
INIT {
LOGN(TFUN, INFO) << "Initializing variables of type function." << std::endl;
cmd = _app.add_subcommand("type", "Get type of the partition(s) or image(s)");
cmd->add_option("content(s)", contents, "Content(s)")
@@ -39,8 +41,8 @@ INIT(typeFunction) {
return true;
}
RUN(typeFunction) {
std::unordered_map<uint64_t, std::string> magics;
RUN {
std::map<uint64_t, std::string> magics;
if (onlyCheckAndroidMagics)
magics.merge(PartitionMap::Extras::AndroidMagicMap);
else if (onlyCheckFileSystemMagics)
@@ -74,8 +76,8 @@ RUN(typeFunction) {
return true;
}
IS_USED_COMMON_BODY(typeFunction)
IS_USED_COMMON_BODY
NAME(typeFunction) { return TFUN; }
NAME { return TFUN; }
} // namespace PartitionManager