summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c30
-rw-r--r--src/analysis/content.c5
-rw-r--r--src/analysis/loaded-int.h6
-rw-r--r--src/analysis/loaded.c20
-rw-r--r--src/analysis/loaded.h6
-rw-r--r--src/analysis/project.c11
-rw-r--r--src/gui/dialogs/loading.c12
-rw-r--r--src/gui/editor.c8
-rw-r--r--src/gui/menus/project.c4
-rw-r--r--src/gui/menus/view.c6
-rw-r--r--src/gui/panel.c4
11 files changed, 72 insertions, 40 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index ad4ec1f..aee4499 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -167,7 +167,7 @@ static bool g_loaded_binary_save(GLoadedBinary *, xmlDoc *, xmlXPathContext *, c
static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *);
/* Fournit le contenu représenté de l'élément chargé. */
-static const char *g_loaded_binary_get_format_name(const GLoadedBinary *);
+static char *g_loaded_binary_get_format_name(const GLoadedBinary *);
/* Assure le désassemblage en différé. */
static bool g_loaded_binary_analyze(GLoadedBinary *, bool, bool, wgroup_id_t, GtkStatusStack *);
@@ -176,13 +176,13 @@ static bool g_loaded_binary_analyze(GLoadedBinary *, bool, bool, wgroup_id_t, Gt
static void on_binary_processor_changed(GArchProcessor *, GArchInstruction *, gboolean, GLoadedBinary *);
/* Fournit le désignation associée à l'élément chargé. */
-static const char *g_loaded_binary_describe(const GLoadedBinary *, bool);
+static char *g_loaded_binary_describe(const GLoadedBinary *, bool);
/* Détermine le nombre de vues disponibles pour un contenu. */
static unsigned int g_loaded_binary_count_views(const GLoadedBinary *);
/* Fournit le nom d'une vue donnée d'un contenu chargé. */
-static const char *g_loaded_binary_get_view_name(const GLoadedBinary *, unsigned int);
+static char *g_loaded_binary_get_view_name(const GLoadedBinary *, unsigned int);
/* Met en place la vue initiale pour un contenu binaire. */
static GtkWidget *g_loaded_binary_build_default_view(GLoadedBinary *);
@@ -1616,9 +1616,9 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary)
* *
******************************************************************************/
-static const char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
+static char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
{
- const char *result; /* Désignation à retourner */
+ char *result; /* Désignation à retourner */
result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format));
@@ -1845,9 +1845,9 @@ static void on_binary_processor_changed(GArchProcessor *proc, GArchInstruction *
* *
******************************************************************************/
-static const char *g_loaded_binary_describe(const GLoadedBinary *binary, bool full)
+static char *g_loaded_binary_describe(const GLoadedBinary *binary, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
GBinContent *content; /* Contenu binaire mannipulé */
content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
@@ -1875,7 +1875,11 @@ static const char *g_loaded_binary_describe(const GLoadedBinary *binary, bool fu
static unsigned int g_loaded_binary_count_views(const GLoadedBinary *binary)
{
- return BVW_COUNT;
+ unsigned int result; /* Quantité de vues à renvoyer */
+
+ result = BVW_COUNT;
+
+ return result;
}
@@ -1893,22 +1897,22 @@ static unsigned int g_loaded_binary_count_views(const GLoadedBinary *binary)
* *
******************************************************************************/
-static const char *g_loaded_binary_get_view_name(const GLoadedBinary *binary, unsigned int index)
+static char *g_loaded_binary_get_view_name(const GLoadedBinary *binary, unsigned int index)
{
- const char *result; /* Désignation à retourner */
+ char *result; /* Désignation à retourner */
switch (index)
{
case BVW_HEX:
- result = _("Hex view");
+ result = strdup(_("Hex view"));
break;
case BVW_BLOCK:
- result = _("Text view");
+ result = strdup(_("Text view"));
break;
case BVW_GRAPH:
- result = _("Graph view");
+ result = strdup(_("Graph view"));
break;
default:
diff --git a/src/analysis/content.c b/src/analysis/content.c
index 007d46a..86fa490 100644
--- a/src/analysis/content.c
+++ b/src/analysis/content.c
@@ -199,11 +199,14 @@ GBinContent *g_binary_content_get_root(GBinContent *content)
const char *g_binary_content_describe(const GBinContent *content, bool full)
{
+ char *result; /* Description à retourner */
GBinContentIface *iface; /* Interface utilisée */
iface = G_BIN_CONTENT_GET_IFACE(content);
- return iface->describe(content, full);
+ result = strdup(iface->describe(content, full));
+
+ return result;
}
diff --git a/src/analysis/loaded-int.h b/src/analysis/loaded-int.h
index 0aacc3f..0476af5 100644
--- a/src/analysis/loaded-int.h
+++ b/src/analysis/loaded-int.h
@@ -40,19 +40,19 @@ typedef bool (* save_content_fc) (GLoadedContent *, xmlDoc *, xmlXPathContext *,
typedef GBinContent * (* get_content_fc) (const GLoadedContent *);
/* Fournit le format associé à l'élément chargé. */
-typedef const char * (* get_format_name_fc) (const GLoadedContent *);
+typedef char * (* get_format_name_fc) (const GLoadedContent *);
/* Assure l'analyse d'un contenu chargé en différé. */
typedef bool (* analyze_loaded_fc) (GLoadedContent *, bool, bool, wgroup_id_t, GtkStatusStack *);
/* Fournit le désignation associée à l'élément chargé. */
-typedef const char * (* describe_loaded_fc) (const GLoadedContent *, bool);
+typedef char * (* describe_loaded_fc) (const GLoadedContent *, bool);
/* Détermine le nombre de vues disponibles pour un contenu. */
typedef unsigned int (* count_loaded_views_fc) (const GLoadedContent *);
/* Fournit le nom d'une vue donnée d'un contenu chargé. */
-typedef const char * (* get_loaded_view_name_fc) (const GLoadedContent *, unsigned int);
+typedef char * (* get_loaded_view_name_fc) (const GLoadedContent *, unsigned int);
/* Met en place la vue initiale pour un contenu chargé. */
typedef GtkWidget * (* build_loaded_def_view_fc) (GLoadedContent *);
diff --git a/src/analysis/loaded.c b/src/analysis/loaded.c
index 79a311f..71b1838 100644
--- a/src/analysis/loaded.c
+++ b/src/analysis/loaded.c
@@ -245,9 +245,9 @@ GBinContent *g_loaded_content_get_content(const GLoadedContent *content)
* *
******************************************************************************/
-const char *g_loaded_content_get_format_name(const GLoadedContent *content)
+char *g_loaded_content_get_format_name(const GLoadedContent *content)
{
- const char *result; /* Contenu interne à renvoyer */
+ char *result; /* Contenu interne à renvoyer */
GLoadedContentIface *iface; /* Interface utilisée */
iface = G_LOADED_CONTENT_GET_IFACE(content);
@@ -365,13 +365,16 @@ bool g_loaded_content_analyze_and_wait(GLoadedContent *content, bool connect, bo
* *
******************************************************************************/
-const char *g_loaded_content_describe(const GLoadedContent *content, bool full)
+char *g_loaded_content_describe(const GLoadedContent *content, bool full)
{
+ char *result; /* Description à retourner */
GLoadedContentIface *iface; /* Interface utilisée */
iface = G_LOADED_CONTENT_GET_IFACE(content);
- return iface->describe(content, full);
+ result = iface->describe(content, full);
+
+ return result;
}
@@ -424,11 +427,14 @@ char **g_loaded_content_detect_obfuscators(const GLoadedContent *content, bool v
unsigned int g_loaded_content_count_views(const GLoadedContent *content)
{
+ unsigned int result; /* Quantité de vues à renvoyer */
GLoadedContentIface *iface; /* Interface utilisée */
iface = G_LOADED_CONTENT_GET_IFACE(content);
- return iface->count_views(content);
+ result = iface->count_views(content);
+
+ return result;
}
@@ -446,9 +452,9 @@ unsigned int g_loaded_content_count_views(const GLoadedContent *content)
* *
******************************************************************************/
-const char *g_loaded_content_get_view_name(const GLoadedContent *content, unsigned int index)
+char *g_loaded_content_get_view_name(const GLoadedContent *content, unsigned int index)
{
- const char *result; /* Désignation à retourner */
+ char *result; /* Désignation à retourner */
GLoadedContentIface *iface; /* Interface utilisée */
iface = G_LOADED_CONTENT_GET_IFACE(content);
diff --git a/src/analysis/loaded.h b/src/analysis/loaded.h
index 9df647b..9d446c4 100644
--- a/src/analysis/loaded.h
+++ b/src/analysis/loaded.h
@@ -68,7 +68,7 @@ bool g_loaded_content_save(GLoadedContent *, xmlDoc *, xmlXPathContext *, const
GBinContent *g_loaded_content_get_content(const GLoadedContent *);
/* Fournit le format associé à l'élément chargé. */
-const char *g_loaded_content_get_format_name(const GLoadedContent *);
+char *g_loaded_content_get_format_name(const GLoadedContent *);
/* Lance l'analyse propre à l'élément chargé. */
void g_loaded_content_analyze(GLoadedContent *, bool, bool);
@@ -77,7 +77,7 @@ void g_loaded_content_analyze(GLoadedContent *, bool, bool);
bool g_loaded_content_analyze_and_wait(GLoadedContent *, bool, bool);
/* Fournit le désignation associée à l'élément chargé. */
-const char *g_loaded_content_describe(const GLoadedContent *, bool);
+char *g_loaded_content_describe(const GLoadedContent *, bool);
/* Etablit une liste d'obscurcissements présents. */
char **g_loaded_content_detect_obfuscators(const GLoadedContent *, bool, size_t *);
@@ -91,7 +91,7 @@ char **g_loaded_content_detect_obfuscators(const GLoadedContent *, bool, size_t
unsigned int g_loaded_content_count_views(const GLoadedContent *);
/* Fournit le nom d'une vue donnée d'un contenu chargé. */
-const char *g_loaded_content_get_view_name(const GLoadedContent *, unsigned int);
+char *g_loaded_content_get_view_name(const GLoadedContent *, unsigned int);
/* Met en place la vue initiale pour un contenu chargé. */
GtkWidget *g_loaded_content_build_default_view(GLoadedContent *);
diff --git a/src/analysis/project.c b/src/analysis/project.c
index 71e0f43..13985f3 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -388,7 +388,7 @@ bool g_study_project_save(GStudyProject *project, const char *filename)
const gchar *hash; /* Empreinte d'un contenu */
char *access; /* Chemin pour une sous-config.*/
xmlXPathObjectPtr xobject; /* Cible d'une recherche */
- const char *format; /* Format associé à un élément */
+ char *format; /* Format associé à un élément */
/* Forme générale */
@@ -470,6 +470,7 @@ bool g_study_project_save(GStudyProject *project, const char *filename)
{
format = g_loaded_content_get_format_name(project->contents[i]);
result = add_string_attribute_to_node(xdoc, context, access, "format", format);
+ free(format);
}
if (result)
@@ -597,7 +598,7 @@ void g_study_project_discover_binary_content(GStudyProject *project, GBinContent
void on_loaded_content_analyzed(GLoadedContent *content, gboolean success, GStudyProject *project)
{
- const char *desc; /* Description du contenu */
+ char *desc; /* Description du contenu */
desc = g_loaded_content_describe(content, true);
@@ -610,6 +611,8 @@ void on_loaded_content_analyzed(GLoadedContent *content, gboolean success, GStud
else
log_variadic_message(LMT_ERROR, _("Failed to load '%s'"), desc);
+ free(desc);
+
/**
* Le contenu a normalement été sur-référencé pour ne pas disparaître
* en cours d'analyse.
@@ -1291,7 +1294,7 @@ static void on_new_content_resolved(GContentResolver *resolver, wgroup_id_t wid,
size_t i; /* Boucle de parcours */
GBinContent *content; /* Contenu brut à manipuler */
const gchar *hash; /* Empreinte d'un contenu */
- const char *format; /* Format associé à un élément */
+ char *format; /* Format associé à un élément */
char *access; /* Chemin pour une sous-config.*/
xmlXPathObjectPtr xobject; /* Cible d'une recherche */
bool status; /* Bilan d'une restauration */
@@ -1316,6 +1319,8 @@ static void on_new_content_resolved(GContentResolver *resolver, wgroup_id_t wid,
asprintf(&access, "/ChrysalideProject/LoadedContents/Content[@hash='%s' and @format='%s']",
hash, format);
+ free(format);
+
xobject = get_node_xpath_object(handler->context, access);
if (XPATH_OBJ_NODES_COUNT(xobject) > 0)
diff --git a/src/gui/dialogs/loading.c b/src/gui/dialogs/loading.c
index 3e71df4..97cd892 100644
--- a/src/gui/dialogs/loading.c
+++ b/src/gui/dialogs/loading.c
@@ -457,6 +457,8 @@ static void update_loading_dialog_counter(GtkBuilder *builder)
void add_content_to_loading_dialog(GtkBuilder *builder, GLoadedContent *content, GStudyProject *project)
{
GtkListStore *store; /* Modèle de gestion */
+ char *desc; /* Description d'un contenu */
+ char *format; /* Format associé à un contenu */
char *name; /* Désignation complète */
gboolean recognized; /* Nature du contenu */
GtkTreeIter iter; /* Point d'insertion */
@@ -472,9 +474,13 @@ void add_content_to_loading_dialog(GtkBuilder *builder, GLoadedContent *content,
/* Inscription */
- asprintf(&name, "%s (%s)",
- g_loaded_content_describe(content, false),
- g_loaded_content_get_format_name(content));
+ desc = g_loaded_content_describe(content, false);
+ format = g_loaded_content_get_format_name(content);
+
+ asprintf(&name, "%s (%s)", desc, format);
+
+ free(format);
+ free(desc);
recognized = TRUE;
diff --git a/src/gui/editor.c b/src/gui/editor.c
index bdd9a78..8e20cc1 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -926,8 +926,8 @@ static void on_editor_content_available(GStudyProject *project, GLoadedContent *
static void on_editor_loaded_content_added(GStudyProject *project, GLoadedContent *content, void *unused)
{
GtkWidget *selected; /* Interface de prédilection */
- const char *name; /* Titre associé au binaire */
- const char *lname; /* Description du binaire */
+ char *name; /* Titre associé au binaire */
+ char *lname; /* Description du binaire */
GPanelItem *panel; /* Nouveau panneau à integrer */
selected = g_loaded_content_build_default_view(content);
@@ -936,6 +936,10 @@ static void on_editor_loaded_content_added(GStudyProject *project, GLoadedConten
lname = g_loaded_content_describe(content, true);
panel = g_panel_item_new(PIP_BINARY_VIEW, name, lname, selected, true, "M");
+
+ free(lname);
+ free(name);
+
register_panel_item(panel, get_main_configuration());
g_signal_connect(selected, "size-allocate", G_CALLBACK(scroll_for_the_first_time), content);
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index f0b9c17..a5992bf 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -117,7 +117,7 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
size_t count; /* Nombre de contenus attachés */
GLoadedContent **contents; /* Liste de ces contenus */
size_t i; /* Boucle de parcours #2 */
- const char *desc; /* Description à afficher */
+ char *desc; /* Description à afficher */
GtkWidget *submenuitem; /* Sous-menu à ajouter */
menuitem = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "menu_prj_remove_bin"));
@@ -145,6 +145,8 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
g_object_set_data_full(G_OBJECT(submenuitem), "content", contents[i], g_object_unref);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ free(desc);
+
/**
* Note : l'appel à g_object_unref() est réalisé lorsque la référence
* est retirée du menu.
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index bc833a3..b9451e0 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -198,6 +198,7 @@ void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedConte
GList *iter; /* Boucle de parcours */
unsigned int count; /* Nombre d'itérations à mener */
GSList *rgroup; /* Groupe des boutons radio */
+ char *caption; /* Etiquette pour un menu */
/* Retrait d'éventuels anciens menus */
@@ -246,12 +247,13 @@ void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedConte
for (i = 0; i < count; i++)
{
asprintf(&key, "mnu_view_panel_%u", i);
+ caption = g_loaded_content_get_view_name(new, i);
- submenuitem = qck_create_radio_menu_item(ref, key, rgroup,
- g_loaded_content_get_view_name(new, i),
+ submenuitem = qck_create_radio_menu_item(ref, key, rgroup, caption,
G_CALLBACK(mcb_view_change_support), NULL);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(i));
+ free(caption);
free(key);
asprintf(&key, "F%u", 3 + i);
diff --git a/src/gui/panel.c b/src/gui/panel.c
index a98119f..2ebcdad 100644
--- a/src/gui/panel.c
+++ b/src/gui/panel.c
@@ -258,13 +258,13 @@ GPanelItem *g_panel_item_new(PanelItemPersonality personality, const char *name,
parent = G_EDITOR_ITEM(result);
- parent->name = name;
+ parent->name = strdup(name);
parent->widget = widget;
assert(personality > PIP_INVALID && personality < PIP_COUNT);
result->personality = personality;
- result->lname = lname;
+ result->lname = strdup(lname);
result->dock_at_startup = startup;
result->path = strdup(path);