mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Adds support for RZ_SIGDB path and fixes sorting on some columns (#2923)
This commit is contained in:
parent
243eded243
commit
861c784600
@ -3054,19 +3054,10 @@ QList<HeaderDescription> CutterCore::getAllHeaders()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<FlirtDescription> CutterCore::getSignaturesDB()
|
static void sigdb_insert_element_into_qlist(RzList *list, QList<FlirtDescription> &sigdb)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
|
||||||
QList<FlirtDescription> sigdb;
|
|
||||||
const char *sigdb_path = rz_config_get(core->config, "flirt.sigdb.path");
|
|
||||||
if (RZ_STR_ISEMPTY(sigdb_path)) {
|
|
||||||
return sigdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
RzList *list = rz_sign_sigdb_load_database(sigdb_path, true);
|
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
RzListIter *iter = NULL;
|
RzListIter *iter = NULL;
|
||||||
|
|
||||||
rz_list_foreach(list, iter, ptr)
|
rz_list_foreach(list, iter, ptr)
|
||||||
{
|
{
|
||||||
RzSigDBEntry *sig = static_cast<RzSigDBEntry *>(ptr);
|
RzSigDBEntry *sig = static_cast<RzSigDBEntry *>(ptr);
|
||||||
@ -3081,6 +3072,30 @@ QList<FlirtDescription> CutterCore::getSignaturesDB()
|
|||||||
flirt.arch_bits = QString::number(sig->arch_bits);
|
flirt.arch_bits = QString::number(sig->arch_bits);
|
||||||
sigdb << flirt;
|
sigdb << flirt;
|
||||||
}
|
}
|
||||||
|
rz_list_free(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<FlirtDescription> CutterCore::getSignaturesDB()
|
||||||
|
{
|
||||||
|
CORE_LOCK();
|
||||||
|
QList<FlirtDescription> sigdb;
|
||||||
|
RzList *list = nullptr;
|
||||||
|
|
||||||
|
char *system_sigdb = rz_path_system(RZ_SIGDB);
|
||||||
|
if (RZ_STR_ISNOTEMPTY(system_sigdb) && rz_file_is_directory(system_sigdb)) {
|
||||||
|
list = rz_sign_sigdb_load_database(system_sigdb, true);
|
||||||
|
sigdb_insert_element_into_qlist(list, sigdb);
|
||||||
|
}
|
||||||
|
free(system_sigdb);
|
||||||
|
|
||||||
|
const char *sigdb_path = rz_config_get(core->config, "flirt.sigdb.path");
|
||||||
|
if (RZ_STR_ISEMPTY(sigdb_path)) {
|
||||||
|
return sigdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
list = rz_sign_sigdb_load_database(sigdb_path, true);
|
||||||
|
sigdb_insert_element_into_qlist(list, sigdb);
|
||||||
|
|
||||||
return sigdb;
|
return sigdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,9 +107,9 @@ bool FlirtProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right
|
|||||||
case FlirtModel::ArchNameColumn:
|
case FlirtModel::ArchNameColumn:
|
||||||
return leftEntry.arch_name < rightEntry.arch_name;
|
return leftEntry.arch_name < rightEntry.arch_name;
|
||||||
case FlirtModel::ArchBitsColumn:
|
case FlirtModel::ArchBitsColumn:
|
||||||
return leftEntry.arch_bits < rightEntry.arch_bits;
|
return leftEntry.arch_bits.toULongLong() < rightEntry.arch_bits.toULongLong();
|
||||||
case FlirtModel::NumModulesColumn:
|
case FlirtModel::NumModulesColumn:
|
||||||
return leftEntry.n_modules < rightEntry.n_modules;
|
return leftEntry.n_modules.toULongLong() < rightEntry.n_modules.toULongLong();
|
||||||
case FlirtModel::NameColumn:
|
case FlirtModel::NameColumn:
|
||||||
return leftEntry.base_name < rightEntry.base_name;
|
return leftEntry.base_name < rightEntry.base_name;
|
||||||
case FlirtModel::DetailsColumn:
|
case FlirtModel::DetailsColumn:
|
||||||
|
Loading…
Reference in New Issue
Block a user