summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-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
6 files changed, 48 insertions, 30 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)