summaryrefslogtreecommitdiff
path: root/src/analysis/contents
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/contents')
-rw-r--r--src/analysis/contents/encapsulated.c12
-rw-r--r--src/analysis/contents/file.c17
-rw-r--r--src/analysis/contents/memory.c8
3 files changed, 19 insertions, 18 deletions
diff --git a/src/analysis/contents/encapsulated.c b/src/analysis/contents/encapsulated.c
index 569df10..59b0c9e 100644
--- a/src/analysis/contents/encapsulated.c
+++ b/src/analysis/contents/encapsulated.c
@@ -74,7 +74,7 @@ static void g_encaps_content_finalize(GEncapsContent *);
static GBinContent *g_encaps_content_get_root(GEncapsContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_encaps_content_describe(const GEncapsContent *, bool);
+static char *g_encaps_content_describe(const GEncapsContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_encaps_content_save(const GEncapsContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -296,7 +296,7 @@ GBinContent *g_encaps_content_new(GBinContent *base, const char *path, GBinConte
/* Description complète */
- result->full_desc = stradd(result->full_desc, g_binary_content_describe(result->base, true));
+ result->full_desc = g_binary_content_describe(result->base, true);
result->full_desc = stradd(result->full_desc, G_DIR_SEPARATOR_S);
@@ -416,14 +416,14 @@ static GBinContent *g_encaps_content_get_root(GEncapsContent *content)
* *
******************************************************************************/
-static const char *g_encaps_content_describe(const GEncapsContent *content, bool full)
+static char *g_encaps_content_describe(const GEncapsContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
if (full)
- result = content->full_desc;
+ result = strdup(content->full_desc);
else
- result = content->desc;
+ result = strdup(content->desc);
return result;
diff --git a/src/analysis/contents/file.c b/src/analysis/contents/file.c
index b133336..7bb0be8 100644
--- a/src/analysis/contents/file.c
+++ b/src/analysis/contents/file.c
@@ -86,7 +86,7 @@ static GContentAttributes *g_file_content_get_attributes(const GFileContent *);
static GBinContent *g_file_content_get_root(GFileContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_file_content_describe(const GFileContent *, bool);
+static char *g_file_content_describe(const GFileContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_file_content_save(const GFileContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -489,22 +489,23 @@ static GBinContent *g_file_content_get_root(GFileContent *content)
* *
******************************************************************************/
-static const char *g_file_content_describe(const GFileContent *content, bool full)
+static char *g_file_content_describe(const GFileContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
+ const char *sep; /* Caractère de séparation */
if (full)
- result = content->filename;
+ result = strdup(content->filename);
else
{
- result = strrchr(content->filename, G_DIR_SEPARATOR);
+ sep = strrchr(content->filename, G_DIR_SEPARATOR);
- if (result == NULL)
- result = content->filename;
+ if (sep == NULL)
+ result = strdup(content->filename);
else
- result++;
+ result = strdup(++sep);
}
diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c
index 232a41d..a37a7d4 100644
--- a/src/analysis/contents/memory.c
+++ b/src/analysis/contents/memory.c
@@ -77,7 +77,7 @@ static void g_memory_content_finalize(GMemoryContent *);
static GBinContent *g_memory_content_get_root(GMemoryContent *);
/* Fournit le nom associé au contenu binaire. */
-static const char *g_memory_content_describe(const GMemoryContent *, bool);
+static char *g_memory_content_describe(const GMemoryContent *, bool);
/* Ecrit une sauvegarde de contenu binaire dans un fichier XML. */
static bool g_memory_content_save(const GMemoryContent *, xmlDocPtr, xmlXPathContextPtr, const char *, const char *);
@@ -399,11 +399,11 @@ static GBinContent *g_memory_content_get_root(GMemoryContent *content)
* *
******************************************************************************/
-static const char *g_memory_content_describe(const GMemoryContent *content, bool full)
+static char *g_memory_content_describe(const GMemoryContent *content, bool full)
{
- const char *result; /* Description à retourner */
+ char *result; /* Description à retourner */
- result = "In-memory content";
+ result = strdup("In-memory content");
return result;