summaryrefslogtreecommitdiff
path: root/src/glibext/gbinportion.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-29 22:54:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-29 22:54:42 (GMT)
commit49fcaf9ea6dc34382ac69b3eaf803c0617b652e0 (patch)
tree7fcd84f6f16ac8e646e01f266c66e0bff41106ad /src/glibext/gbinportion.c
parentce583a69951bf9a94ca46bcf9f598cdc94b80e29 (diff)
Introduced binary portion support for Python bindings.
Diffstat (limited to 'src/glibext/gbinportion.c')
-rw-r--r--src/glibext/gbinportion.c47
1 files changed, 13 insertions, 34 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 8826bd3..e020506 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -34,6 +34,7 @@
#include <i18n.h>
+#include "gbinportion-int.h"
#include "../analysis/human/asm/lang.h"
#include "../common/extstr.h"
#include "../common/sort.h"
@@ -45,37 +46,6 @@
/* ------------------------------- PORTION DE BINAIRE ------------------------------- */
-/* Portion de données binaires quelconques (instance) */
-struct _GBinPortion
-{
- GObject parent; /* A laisser en premier */
-
- char *code; /* Code de la couleur de fond */
-
- cairo_surface_t *icon; /* Image de représentation */
-
- char *desc; /* Désignation humaine */
- char **text; /* Lignes brutes à représenter */
- size_t lcount; /* Quantité de ces lignes */
-
- mrange_t range; /* Emplacement dans le code */
- bool continued; /* Suite d'une découpe ? */
-
- PortionAccessRights rights; /* Droits d'accès */
-
- GBinPortion **subs; /* Portions incluses */
- size_t count; /* Quantité d'inclusions */
-
-};
-
-/* Portion de données binaires quelconques (classe) */
-struct _GBinPortionClass
-{
- GObjectClass parent; /* A laisser en premier */
-
-};
-
-
/* Initialise la classe des portions de données binaires. */
static void g_binary_portion_class_init(GBinPortionClass *);
@@ -179,10 +149,17 @@ static void g_binary_portion_class_init(GBinPortionClass *klass)
static void g_binary_portion_init(GBinPortion *portion)
{
+ vmpa2t dummy; /* Coquille presque vide */
+
+ portion->code = NULL;
+
portion->desc = NULL;
portion->text = NULL;
portion->lcount = 0;
+ init_vmpa(&dummy, VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL);
+ init_mrange(&portion->range, &dummy, VMPA_NO_VIRTUAL);
+
portion->continued = false;
}
@@ -246,7 +223,8 @@ static void g_binary_portion_finalize(GBinPortion *portion)
{
size_t i; /* Boucle de parcours */
- free(portion->code);
+ if (portion->code != NULL)
+ free(portion->code);
if (portion->icon != NULL)
cairo_surface_destroy(portion->icon);
@@ -480,7 +458,7 @@ const char *g_binary_portion_get_desc(const GBinPortion *portion)
* *
* Description : Fournit l'emplacement d'une partie de code binaire. *
* *
-* Retour : - *
+* Retour : Espace de couverture associé à la portion. *
* *
* Remarques : - *
* *
@@ -748,7 +726,8 @@ void g_binary_portion_draw(const GBinPortion *portion, GtkStyleContext *context,
gtk_style_context_save(context);
- gtk_style_context_add_class(context, portion->code);
+ if (portion->code != NULL)
+ gtk_style_context_add_class(context, portion->code);
gtk_render_background(context, cr, area->x, area->y, area->width, area->height);