mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-24 14:09:56 +00:00
add CS_ERR_OPTION type. cs_option() returns this error code on invalid option
This commit is contained in:
parent
f9e3216568
commit
041e25dd66
10
cs.c
10
cs.c
@ -209,20 +209,24 @@ cs_err cs_option(csh ud, cs_opt_type type, size_t value)
|
||||
|
||||
switch (handle->arch) {
|
||||
default:
|
||||
break;
|
||||
return CS_ERR_OPTION;
|
||||
|
||||
case CS_ARCH_X86:
|
||||
if (type & CS_OPT_SYNTAX) {
|
||||
switch(value) {
|
||||
default:
|
||||
break;
|
||||
return CS_ERR_OPTION;
|
||||
|
||||
case CS_OPT_SYNTAX_INTEL:
|
||||
handle->printer = X86_Intel_printInst;
|
||||
break;
|
||||
|
||||
case CS_OPT_SYNTAX_ATT:
|
||||
handle->printer = X86_ATT_printInst;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
return CS_ERR_OPTION;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,16 @@ typedef struct cs_insn {
|
||||
// These are values returned by cs_errno()
|
||||
typedef enum cs_err {
|
||||
CS_ERR_OK = 0, // No error: everything was fine
|
||||
CS_ERR_MEM, // Out-Of-Memory error
|
||||
CS_ERR_ARCH, // Unsupported architecture
|
||||
CS_ERR_HANDLE, // Invalid handle
|
||||
CS_ERR_CSH, // Invalid csh argument
|
||||
CS_ERR_MODE, // Invalid/unsupported mode
|
||||
CS_ERR_MEM, // Out-Of-Memory error: cs_open(), cs_disasm_dyn()
|
||||
CS_ERR_ARCH, // Unsupported architecture: cs_open()
|
||||
CS_ERR_HANDLE, // Invalid handle: cs_op_count(), cs_op_index()
|
||||
CS_ERR_CSH, // Invalid csh argument: cs_close(), cs_errno(), cs_option()
|
||||
CS_ERR_MODE, // Invalid/unsupported mode: cs_open()
|
||||
CS_ERR_OPTION, // Invalid/unsupported option: cs_option()
|
||||
} cs_err;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Return API version in major and minor numbers.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user