Use const on all read-only buffers
diff --git a/cs.c b/cs.c
index 4504bf2..71ed9d8 100644
--- a/cs.c
+++ b/cs.c
@@ -164,7 +164,7 @@
// fill insn with mnemonic & operands info
static void fill_insn(cs_struct *handle, cs_insn *insn, char *buffer, MCInst *mci,
- PostPrinter_t printer, unsigned char *code)
+ PostPrinter_t printer, const uint8_t *code)
{
memcpy(insn, &mci->pub_insn, sizeof(*insn));
@@ -231,7 +231,7 @@
return CS_ERR_OK;
}
-size_t cs_disasm(csh ud, unsigned char *buffer, size_t size, uint64_t offset, size_t count, cs_insn *insn)
+size_t cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn *insn)
{
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
MCInst mci;
@@ -281,7 +281,7 @@
// dynamicly allocate memory to contain disasm insn
// NOTE: caller must free() the allocated memory itself to avoid memory leaking
-size_t cs_disasm_dyn(csh ud, unsigned char *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
+size_t cs_disasm_dyn(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
{
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
MCInst mci;
@@ -369,7 +369,7 @@
}
// return friendly name of regiser in a string
-char *cs_reg_name(csh ud, unsigned int reg)
+const char *cs_reg_name(csh ud, unsigned int reg)
{
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
@@ -380,7 +380,7 @@
return handle->reg_name(ud, reg);
}
-char *cs_insn_name(csh ud, unsigned int insn)
+const char *cs_insn_name(csh ud, unsigned int insn)
{
cs_struct *handle = (cs_struct *)(uintptr_t)ud;