summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/pseudo
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-15 12:12:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-15 12:12:15 (GMT)
commit4c5f0e1341b094fed40f9e6944134545f971b1eb (patch)
tree2a9e85f11c480410a336a2efc5c10cc3241c0434 /src/arch/dalvik/pseudo
parent00aab2fbd9d7d3d36890fda60029cad54ea589a4 (diff)
Built proper comments for all the Dalvik switch cases.
Diffstat (limited to 'src/arch/dalvik/pseudo')
-rw-r--r--src/arch/dalvik/pseudo/switch.c24
-rw-r--r--src/arch/dalvik/pseudo/switch.h2
2 files changed, 13 insertions, 13 deletions
diff --git a/src/arch/dalvik/pseudo/switch.c b/src/arch/dalvik/pseudo/switch.c
index fd7e442..70afb3e 100644
--- a/src/arch/dalvik/pseudo/switch.c
+++ b/src/arch/dalvik/pseudo/switch.c
@@ -39,8 +39,8 @@ struct _GDalvikSwitchInstr
uint16_t switch_size; /* Taille du switch considéré */
- uint32_t *keys; /* Table de clefs */
- uint32_t *targets; /* Table des sauts relatifs */
+ int32_t *keys; /* Table de clefs */
+ int32_t *targets; /* Table des sauts relatifs */
};
@@ -194,9 +194,9 @@ GArchInstruction *g_dalvik_switch_instr_new(uint16_t ident, GDalvikContext *ctx,
goto gdsin_bad;
if (ident != DPO_PACKED_SWITCH)
- consumed = (1 + result->switch_size) * sizeof(uint32_t);
+ consumed = (1 + result->switch_size) * sizeof(int32_t);
else
- consumed = (2 * result->switch_size) * sizeof(uint32_t);
+ consumed = (2 * result->switch_size) * sizeof(int32_t);
if (!g_dalvik_context_register_switch_data(ctx, pos, consumed))
goto gdsin_bad;
@@ -229,24 +229,24 @@ GArchInstruction *g_dalvik_switch_instr_new(uint16_t ident, GDalvikContext *ctx,
static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinContent *content, const vmpa2t *pos)
{
vmpa2t iter; /* Position modifiable */
- uint32_t first_key; /* Première clef */
+ int32_t first_key; /* Première clef */
uint16_t i; /* Boucle de parcours */
- instr->keys = (uint32_t *)calloc(instr->switch_size, sizeof(uint32_t));
- instr->targets = (uint32_t *)calloc(instr->switch_size, sizeof(uint32_t));
+ instr->keys = (int32_t *)calloc(instr->switch_size, sizeof(int32_t));
+ instr->targets = (int32_t *)calloc(instr->switch_size, sizeof(int32_t));
copy_vmpa(&iter, pos);
if (G_DALVIK_INSTRUCTION(instr)->ptype == DPO_PACKED_SWITCH)
{
- if (!g_binary_content_read_u32(content, &iter, SRE_LITTLE, &first_key))
+ if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &first_key))
goto gdsdd_bad;
for (i = 0; i < instr->switch_size; i++)
{
instr->keys[i] = first_key + i;
- if (!g_binary_content_read_u32(content, &iter, SRE_LITTLE, &instr->targets[i]))
+ if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &instr->targets[i]))
goto gdsdd_bad;
}
@@ -256,11 +256,11 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon
else
{
for (i = 0; i < instr->switch_size; i++)
- if (!g_binary_content_read_u32(content, &iter, SRE_LITTLE, &instr->keys[i]))
+ if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &instr->keys[i]))
goto gdsdd_bad;
for (i = 0; i < instr->switch_size; i++)
- if (!g_binary_content_read_u32(content, &iter, SRE_LITTLE, &instr->targets[i]))
+ if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &instr->targets[i]))
goto gdsdd_bad;
}
@@ -288,7 +288,7 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon
* *
******************************************************************************/
-uint16_t g_dalvik_switch_get_data(GDalvikSwitchInstr *instr, const uint32_t **keys, const uint32_t **targets)
+uint16_t g_dalvik_switch_get_data(GDalvikSwitchInstr *instr, const int32_t **keys, const int32_t **targets)
{
if (keys != NULL)
*keys = instr->keys;
diff --git a/src/arch/dalvik/pseudo/switch.h b/src/arch/dalvik/pseudo/switch.h
index ae52758..b0fb1b2 100644
--- a/src/arch/dalvik/pseudo/switch.h
+++ b/src/arch/dalvik/pseudo/switch.h
@@ -56,7 +56,7 @@ GType g_dalvik_switch_instr_get_type(void);
GArchInstruction *g_dalvik_switch_instr_new(uint16_t, GDalvikContext *, const GBinContent *, vmpa2t *);
/* Fournit les données associées à un branchement Dalvik. */
-uint16_t g_dalvik_switch_get_data(GDalvikSwitchInstr *, const uint32_t **, const uint32_t **);
+uint16_t g_dalvik_switch_get_data(GDalvikSwitchInstr *, const int32_t **, const int32_t **);