cs_op_count() & cs_op_index() report CS_ERR_DETAIL when detail = OFF

This commit is contained in:
Nguyen Anh Quynh 2014-01-15 21:27:23 +08:00
parent 56aba591cc
commit 24e122778c
1 changed files with 10 additions and 3 deletions

13
cs.c
View File

@ -410,7 +410,6 @@ bool cs_insn_group(csh ud, cs_insn *insn, unsigned int group_id)
return false;
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
if (!handle->detail) {
handle->errnum = CS_ERR_DETAIL;
return false;
@ -425,7 +424,6 @@ bool cs_reg_read(csh ud, cs_insn *insn, unsigned int reg_id)
return false;
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
if (!handle->detail) {
handle->errnum = CS_ERR_DETAIL;
return false;
@ -440,7 +438,6 @@ bool cs_reg_write(csh ud, cs_insn *insn, unsigned int reg_id)
return false;
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
if (!handle->detail) {
handle->errnum = CS_ERR_DETAIL;
return false;
@ -455,6 +452,11 @@ int cs_op_count(csh ud, cs_insn *insn, unsigned int op_type)
return -1;
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
if (!handle->detail) {
handle->errnum = CS_ERR_DETAIL;
return -1;
}
unsigned int count = 0, i;
handle->errnum = CS_ERR_OK;
@ -500,6 +502,11 @@ int cs_op_index(csh ud, cs_insn *insn, unsigned int op_type,
return -1;
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
if (!handle->detail) {
handle->errnum = CS_ERR_DETAIL;
return -1;
}
unsigned int count = 0, i;
handle->errnum = CS_ERR_OK;