summaryrefslogtreecommitdiff
path: root/src/format/java
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-11 17:05:54 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-11 17:05:54 (GMT)
commitbf879f2562545ab7de23f9d38364b7bd4b43fb2c (patch)
tree6154160307cbca304ea9e1de178d8c2dfc8e0928 /src/format/java
parentabd96dbbe27246e9303173e5e2f47b2e4cedbcb7 (diff)
Registered all the supported formats in the system code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@471 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/java')
-rwxr-xr-xsrc/format/java/java.c17
-rwxr-xr-xsrc/format/java/java.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/format/java/java.c b/src/format/java/java.c
index e477b82..4929b52 100755
--- a/src/format/java/java.c
+++ b/src/format/java/java.c
@@ -58,9 +58,7 @@ static bool g_java_format_translate_offset_into_address(const GJavaFormat *, off
/******************************************************************************
* *
-* Paramètres : type = type de format recherché. *
-* content = contenu binaire à parcourir. *
-* length = taille du contenu en question. *
+* Paramètres : content = contenu binaire à parcourir. *
* *
* Description : Indique si le format peut être pris en charge ici. *
* *
@@ -70,14 +68,17 @@ static bool g_java_format_translate_offset_into_address(const GJavaFormat *, off
* *
******************************************************************************/
-bool java_is_matching(FormatType type, const uint8_t *content, off_t length)
+bool java_is_matching(GBinContent *content)
{
bool result; /* Bilan à faire connaître */
+ vmpa2t addr; /* Tête de lecture initiale */
+ char magic[4]; /* Idenfiant standard */
- result = false;
+ init_vmpa(&addr, 0, VMPA_NO_VIRTUAL);
- if (length >= 4)
- result = (strncmp((const char *)content, "\xca\xfe\xba\xbe", 4) == 0);
+ result = g_binary_content_get_raw(content, &addr, 4, (bin_t *)magic);
+
+ result &= (memcmp(magic, "\xca\xfe\xba\xbe", 4) == 0);
return result;
@@ -152,7 +153,7 @@ GBinFormat *g_java_format_new(const bin_t *content, off_t length)
result = g_object_new(G_TYPE_JAVA_FORMAT, NULL);
- g_binary_format_set_content(G_BIN_FORMAT(result), content, length);
+ //g_binary_format_set_content(G_BIN_FORMAT(result), content, length);
offset = 0;
diff --git a/src/format/java/java.h b/src/format/java/java.h
index e19b03a..2ce8dba 100755
--- a/src/format/java/java.h
+++ b/src/format/java/java.h
@@ -49,7 +49,7 @@ typedef struct _GJavaFormatClass GJavaFormatClass;
/* Indique si le format peut être pris en charge ici. */
-bool java_is_matching(FormatType, const bin_t *, off_t);
+bool java_is_matching(GBinContent *);
/* Indique le type défini pour un format d'exécutable Java. */
GType g_java_format_get_type(void);