From 4e9dc1d8e6f1e0b3e8a9052e9940b30736f8a3b4 Mon Sep 17 00:00:00 2001 From: Ryan Hileman Date: Tue, 5 Apr 2016 19:32:19 -0700 Subject: [PATCH] fix Go binding C99 regression --- bindings/go/unicorn/uc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bindings/go/unicorn/uc.c b/bindings/go/unicorn/uc.c index 7d67c798..d21e66fa 100644 --- a/bindings/go/unicorn/uc.c +++ b/bindings/go/unicorn/uc.c @@ -4,7 +4,8 @@ uc_err uc_reg_read_batch_helper(uc_engine *handle, int *regs, uint64_t *val_out, int count) { void **val_ref = malloc(sizeof(void *) * count); - for (int i = 0; i < count; i++) { + int i; + for (i = 0; i < count; i++) { val_ref[i] = (void *)&val_out[i]; } uc_err ret = uc_reg_read_batch(handle, regs, val_ref, count); @@ -13,11 +14,12 @@ uc_err uc_reg_read_batch_helper(uc_engine *handle, int *regs, uint64_t *val_out, } uc_err uc_reg_write_batch_helper(uc_engine *handle, int *regs, uint64_t *val_in, int count) { - const void **val_ref = malloc(sizeof(void *) * count); - for (int i = 0; i < count; i++) { + void **val_ref = malloc(sizeof(void *) * count); + int i; + for (i = 0; i < count; i++) { val_ref[i] = (void *)&val_in[i]; } - uc_err ret = uc_reg_write_batch(handle, regs, val_ref, count); + uc_err ret = uc_reg_write_batch(handle, regs, (void *const *)val_ref, count); free(val_ref); return ret; }