Adds support for RZ_SIGDB path and fixes sorting on some columns (#2923)

This commit is contained in:
Giovanni 2022-04-05 11:35:45 +02:00 committed by GitHub
parent 243eded243
commit 861c784600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 12 deletions

View File

@ -3054,19 +3054,10 @@ QList<HeaderDescription> CutterCore::getAllHeaders()
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;
RzListIter *iter = NULL;
rz_list_foreach(list, iter, ptr)
{
RzSigDBEntry *sig = static_cast<RzSigDBEntry *>(ptr);
@ -3081,6 +3072,30 @@ QList<FlirtDescription> CutterCore::getSignaturesDB()
flirt.arch_bits = QString::number(sig->arch_bits);
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;
}

View File

@ -107,9 +107,9 @@ bool FlirtProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right
case FlirtModel::ArchNameColumn:
return leftEntry.arch_name < rightEntry.arch_name;
case FlirtModel::ArchBitsColumn:
return leftEntry.arch_bits < rightEntry.arch_bits;
return leftEntry.arch_bits.toULongLong() < rightEntry.arch_bits.toULongLong();
case FlirtModel::NumModulesColumn:
return leftEntry.n_modules < rightEntry.n_modules;
return leftEntry.n_modules.toULongLong() < rightEntry.n_modules.toULongLong();
case FlirtModel::NameColumn:
return leftEntry.base_name < rightEntry.base_name;
case FlirtModel::DetailsColumn: