summaryrefslogtreecommitdiff
path: root/src/format/dex/dex.c
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/dex/dex.c
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/dex/dex.c')
-rwxr-xr-xsrc/format/dex/dex.c17
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;