summaryrefslogtreecommitdiff
path: root/src/format/java/java.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/java/java.c')
-rwxr-xr-xsrc/format/java/java.c17
1 files changed, 9 insertions, 8 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;