mingw doesnt accept .errno of cs_struct. this fixes make it happy, and enable Windows cross-compile again
diff --git a/cs.c b/cs.c
index 0a509d7..31fb548 100644
--- a/cs.c
+++ b/cs.c
@@ -38,7 +38,7 @@
cs_struct *ud = (cs_struct *)(uintptr_t)handle;
- return ud->errno;
+ return ud->errnum;
}
void cs_version(int *major, int *minor)
@@ -57,7 +57,7 @@
return CS_ERR_MEM;
}
- ud->errno = CS_ERR_OK;
+ ud->errnum = CS_ERR_OK;
ud->arch = arch;
ud->mode = mode;
ud->big_endian = mode & CS_MODE_BIG_ENDIAN;
@@ -198,11 +198,11 @@
if (!handle) {
// FIXME: handle this case?
- // handle->errno = CS_ERR_HANDLE;
+ // handle->errnum = CS_ERR_HANDLE;
return 0;
}
- handle->errno = CS_ERR_OK;
+ handle->errnum = CS_ERR_OK;
while (size > 0) {
MCInst_Init(&mci);
@@ -250,11 +250,11 @@
if (!handle) {
// FIXME: how to handle this case:
- // handle->errno = CS_ERR_HANDLE;
+ // handle->errnum = CS_ERR_HANDLE;
return 0;
}
- handle->errno = CS_ERR_OK;
+ handle->errnum = CS_ERR_OK;
while (size > 0) {
MCInst_Init(&mci);
@@ -278,7 +278,7 @@
void *tmp = realloc(total, total_size);
if (tmp == NULL) { // insufficient memory
free(total);
- handle->errno = CS_ERR_MEM;
+ handle->errnum = CS_ERR_MEM;
return 0;
}
@@ -304,7 +304,7 @@
void *tmp = realloc(total, total_size + f * sizeof(insn_cache[0]));
if (tmp == NULL) { // insufficient memory
free(total);
- handle->errno = CS_ERR_MEM;
+ handle->errnum = CS_ERR_MEM;
return 0;
}
@@ -399,11 +399,11 @@
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
unsigned int count = 0, i;
- handle->errno = CS_ERR_OK;
+ handle->errnum = CS_ERR_OK;
switch (handle->arch) {
default:
- handle->errno = CS_ERR_HANDLE;
+ handle->errnum = CS_ERR_HANDLE;
return -1;
case CS_ARCH_ARM:
for (i = 0; i < insn->arm.op_count; i++)
@@ -439,11 +439,11 @@
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
unsigned int count = 0, i;
- handle->errno = CS_ERR_OK;
+ handle->errnum = CS_ERR_OK;
switch (handle->arch) {
default:
- handle->errno = CS_ERR_HANDLE;
+ handle->errnum = CS_ERR_HANDLE;
return -1;
case CS_ARCH_ARM:
for (i = 0; i < insn->arm.op_count; i++) {