summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-12 21:44:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-12 21:44:38 (GMT)
commit682159e73cfbf8ec61d2f2aba765be1016a30ded (patch)
tree9477af8765263667b20a48c53835aa9b3be73a2a /src
parent57f6179e22f880bbcff031714e8576cf9bd488ac (diff)
Extended the Python API for update databases.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c19
-rw-r--r--src/analysis/binary.h2
-rw-r--r--src/analysis/db/collection.c2
-rw-r--r--src/analysis/db/collection.h17
-rw-r--r--src/analysis/db/items/bookmark.c2
-rw-r--r--src/analysis/db/items/comment.c2
-rw-r--r--src/analysis/db/items/move.c2
-rw-r--r--src/analysis/db/items/switcher.c2
-rw-r--r--src/gui/dialogs/storage.c2
-rw-r--r--src/gui/panels/bookmarks.c2
-rw-r--r--src/gui/panels/history.c6
11 files changed, 31 insertions, 27 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index ac7556c..822510c 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -995,7 +995,7 @@ GHubClient *g_loaded_binary_get_client(const GLoadedBinary *binary, bool interna
* *
******************************************************************************/
-GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary, size_t *count)
+GDbCollection **g_loaded_binary_get_collections(const GLoadedBinary *binary, size_t *count)
{
GDbCollection **result; /* Liste à retourner */
GList *c; /* Boucle de parcours #1 */
@@ -1003,14 +1003,21 @@ GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary,
*count = g_list_length(binary->collections);
- result = malloc(*count * sizeof(GDbCollection *));
+ if (*count == 0)
+ result = NULL;
- for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++)
+ else
{
- assert(i < *count);
+ result = malloc(*count * sizeof(GDbCollection *));
- result[i] = G_DB_COLLECTION(c->data);
- g_object_ref(G_OBJECT(result[i]));
+ for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++)
+ {
+ assert(i < *count);
+
+ result[i] = G_DB_COLLECTION(c->data);
+ g_object_ref(G_OBJECT(result[i]));
+
+ }
}
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 36966c9..dd3dfc6 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -120,7 +120,7 @@ bool g_loaded_binary_save_cache(const GLoadedBinary *);
GHubClient *g_loaded_binary_get_client(const GLoadedBinary *, bool);
/* Fournit l'ensemble des collections utilisées par un binaire. */
-GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *, size_t *);
+GDbCollection **g_loaded_binary_get_collections(const GLoadedBinary *, size_t *);
/* Trouve une collection assurant une fonctionnalité donnée. */
GDbCollection *g_loaded_binary_find_collection(const GLoadedBinary *, DBFeatures);
diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c
index 3ac70fa..33145a6 100644
--- a/src/analysis/db/collection.c
+++ b/src/analysis/db/collection.c
@@ -564,7 +564,7 @@ void g_db_collection_lock_unlock(GDbCollection *collec, bool write, bool lock)
* *
******************************************************************************/
-GList *g_db_collection_list_items(const GDbCollection *collec)
+GList *g_db_collection_get_items(const GDbCollection *collec)
{
/**
* Un verrou doit être posé !
diff --git a/src/analysis/db/collection.h b/src/analysis/db/collection.h
index cbcf42c..60e5c26 100644
--- a/src/analysis/db/collection.h
+++ b/src/analysis/db/collection.h
@@ -37,15 +37,12 @@
-#define G_TYPE_DB_COLLECTION g_db_collection_get_type()
-#define G_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_db_collection_get_type(), GDbCollection))
-#define G_IS_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_db_collection_get_type()))
-#define G_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_COLLECTION, GDbCollectionClass))
-#define G_IS_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_COLLECTION))
-#define G_DB_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_COLLECTION, GDbCollectionClass))
-
-
-
+#define G_TYPE_DB_COLLECTION g_db_collection_get_type()
+#define G_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DB_COLLECTION, GDbCollection))
+#define G_IS_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DB_COLLECTION))
+#define G_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_COLLECTION, GDbCollectionClass))
+#define G_IS_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_COLLECTION))
+#define G_DB_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_COLLECTION, GDbCollectionClass))
/* Collection générique d'éléments (instance) */
@@ -96,7 +93,7 @@ void g_db_collection_lock_unlock(GDbCollection *, bool, bool);
#define g_db_collection_runlock(col) g_db_collection_lock_unlock(col, false, false);
/* Renvoie la liste des éléments rassemblés. */
-GList *g_db_collection_list_items(const GDbCollection *);
+GList *g_db_collection_get_items(const GDbCollection *);
/* Détermine si un élément est déjà présent ou non. */
GDbItem *g_db_collection_has_key(GDbCollection *, ...);
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c
index 5715737..20f98ea 100644
--- a/src/analysis/db/items/bookmark.c
+++ b/src/analysis/db/items/bookmark.c
@@ -916,7 +916,7 @@ static GDbItem *g_bookmark_collection_has_key(GBookmarkCollection *collec, va_li
ref = va_arg(ap, vmpa2t *);
- items = g_db_collection_list_items(G_DB_COLLECTION(collec));
+ items = g_db_collection_get_items(G_DB_COLLECTION(collec));
for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter))
{
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c
index 22ae46f..a987464 100644
--- a/src/analysis/db/items/comment.c
+++ b/src/analysis/db/items/comment.c
@@ -1735,7 +1735,7 @@ static GDbItem *g_comment_collection_has_key(GCommentCollection *collec, va_list
ref = va_arg(ap, vmpa2t *);
- items = g_db_collection_list_items(G_DB_COLLECTION(collec));
+ items = g_db_collection_get_items(G_DB_COLLECTION(collec));
for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter))
{
diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c
index c213786..a5d2773 100644
--- a/src/analysis/db/items/move.c
+++ b/src/analysis/db/items/move.c
@@ -835,7 +835,7 @@ static GDbItem *g_move_collection_has_key(GMoveCollection *collec, va_list ap)
ref = va_arg(ap, const GLineCursor *);
- items = g_db_collection_list_items(G_DB_COLLECTION(collec));
+ items = g_db_collection_get_items(G_DB_COLLECTION(collec));
for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter))
{
diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c
index 49486f4..043effd 100644
--- a/src/analysis/db/items/switcher.c
+++ b/src/analysis/db/items/switcher.c
@@ -998,7 +998,7 @@ static GDbItem *g_switcher_collection_has_key(GSwitcherCollection *collec, va_li
ref = va_arg(ap, vmpa2t *);
- items = g_db_collection_list_items(G_DB_COLLECTION(collec));
+ items = g_db_collection_get_items(G_DB_COLLECTION(collec));
for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter))
{
diff --git a/src/gui/dialogs/storage.c b/src/gui/dialogs/storage.c
index 4aed524..b66f0ab 100644
--- a/src/gui/dialogs/storage.c
+++ b/src/gui/dialogs/storage.c
@@ -107,7 +107,7 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent, GtkBu
store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store"));
- collections = g_loaded_binary_get_all_collections(binary, &count);
+ collections = g_loaded_binary_get_collections(binary, &count);
for (i = 0; i < count; i++)
{
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 112afe9..5fbc2fc 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -473,7 +473,7 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
g_db_collection_rlock(collec);
- items = g_db_collection_list_items(collec);
+ items = g_db_collection_get_items(collec);
for (b = g_list_first(items); b != NULL; b = g_list_next(b))
{
diff --git a/src/gui/panels/history.c b/src/gui/panels/history.c
index cfea509..3bdf77e 100644
--- a/src/gui/panels/history.c
+++ b/src/gui/panels/history.c
@@ -292,7 +292,7 @@ static void change_history_panel_current_content(GHistoryPanel *panel, GLoadedCo
if (panel->binary != NULL)
{
- collections = g_loaded_binary_get_all_collections(panel->binary, &count);
+ collections = g_loaded_binary_get_collections(panel->binary, &count);
for (k = 0; k < count; k++)
{
@@ -324,13 +324,13 @@ static void change_history_panel_current_content(GHistoryPanel *panel, GLoadedCo
/* Actualisation de l'affichage */
- collections = g_loaded_binary_get_all_collections(binary, &count);
+ collections = g_loaded_binary_get_collections(binary, &count);
for (k = 0; k < count; k++)
{
g_db_collection_rlock(collections[k]);
- items = g_db_collection_list_items(collections[k]);
+ items = g_db_collection_get_items(collections[k]);
for (i = g_list_first(items); i != NULL; i = g_list_next(i))
{