summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/context.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-14 16:24:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-14 16:24:34 (GMT)
commit722539ffc6005c6cd9c8ebd37f93999014ae6d24 (patch)
tree5f78dce6057f904d689c9ff073cc69f33d057abf /src/arch/dalvik/context.c
parent8dff3daac4d2dc98b90adaecea834fb65db4fb10 (diff)
Handled Dalvik simple switch cases without fallthrough.
Diffstat (limited to 'src/arch/dalvik/context.c')
-rw-r--r--src/arch/dalvik/context.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/arch/dalvik/context.c b/src/arch/dalvik/context.c
index b093345..dad9008 100644
--- a/src/arch/dalvik/context.c
+++ b/src/arch/dalvik/context.c
@@ -59,6 +59,7 @@ struct _GDalvikContext
raw_data_area *data; /* Liste de zones brutes */
size_t count; /* Taille de cette liste */
+ GMutex mutex; /* Accès à la liste */
};
@@ -179,6 +180,7 @@ static void g_dalvik_context_class_init(GDalvikContextClass *klass)
static void g_dalvik_context_init(GDalvikContext *ctx)
{
+ g_mutex_init(&ctx->mutex);
}
@@ -197,6 +199,8 @@ static void g_dalvik_context_init(GDalvikContext *ctx)
static void g_dalvik_context_dispose(GDalvikContext *ctx)
{
+ g_mutex_clear(&ctx->mutex);
+
G_OBJECT_CLASS(g_dalvik_context_parent_class)->dispose(G_OBJECT(ctx));
}
@@ -269,6 +273,8 @@ bool g_dalvik_context_register_switch_data(GDalvikContext *ctx, const vmpa2t *st
result = true;
+ g_mutex_lock(&ctx->mutex);
+
/* Vérification quant aux chevauchements */
init_mrange(&new.range, start, length);
@@ -287,6 +293,8 @@ bool g_dalvik_context_register_switch_data(GDalvikContext *ctx, const vmpa2t *st
}
+ g_mutex_unlock(&ctx->mutex);
+
return result;
}
@@ -315,6 +323,8 @@ bool g_dalvik_context_register_array_data(GDalvikContext *ctx, const vmpa2t *sta
result = true;
+ g_mutex_lock(&ctx->mutex);
+
/* Vérification quant aux chevauchements */
init_mrange(&new.range, start, length);
@@ -333,6 +343,8 @@ bool g_dalvik_context_register_array_data(GDalvikContext *ctx, const vmpa2t *sta
}
+ g_mutex_unlock(&ctx->mutex);
+
return result;
}
@@ -360,6 +372,8 @@ GArchInstruction *g_dalvik_context_get_raw_data(GDalvikContext *ctx, const GBinC
result = NULL;
+ g_mutex_lock(&ctx->mutex);
+
found = bsearch(pos, ctx->data, ctx->count, sizeof(raw_data_area),
(__compar_fn_t)cmp_mrange_with_vmpa_swapped);
@@ -396,6 +410,8 @@ GArchInstruction *g_dalvik_context_get_raw_data(GDalvikContext *ctx, const GBinC
}
+ g_mutex_unlock(&ctx->mutex);
+
return result;
}