diff options
Diffstat (limited to 'src/format/dex/dex.c')
-rwxr-xr-x | src/format/dex/dex.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c index c5271e0..476e6f5 100755 --- a/src/format/dex/dex.c +++ b/src/format/dex/dex.c @@ -67,9 +67,7 @@ static bool g_dex_format_translate_offset_into_address(const GDexFormat *, off_t /****************************************************************************** * * -* 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. * * * @@ -79,14 +77,17 @@ static bool g_dex_format_translate_offset_into_address(const GDexFormat *, off_t * * ******************************************************************************/ -bool dex_is_matching(FormatType type, const uint8_t *content, off_t length) +bool dex_is_matching(GBinContent *content) { bool result; /* Bilan à faire connaître */ + vmpa2t addr; /* Tête de lecture initiale */ + char magic[DEX_FILE_MAGIC_LEN]; /* Idenfiant standard */ - result = false; + init_vmpa(&addr, 0, VMPA_NO_VIRTUAL); + + result = g_binary_content_get_raw(content, &addr, DEX_FILE_MAGIC_LEN, (bin_t *)magic); - if (length >= DEX_FILE_MAGIC_LEN) - result = (memcmp(content, DEX_FILE_MAGIC, DEX_FILE_MAGIC_LEN) == 0); + result &= (memcmp(magic, DEX_FILE_MAGIC, DEX_FILE_MAGIC_LEN) == 0); return result; @@ -166,7 +167,7 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length) result = g_object_new(G_TYPE_DEX_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; |