Delete platform.h and fix wrong identation.
diff --git a/cstool/cstool.c b/cstool/cstool.c
index 91a779e..9f3cfbf 100644
--- a/cstool/cstool.c
+++ b/cstool/cstool.c
@@ -1,4 +1,4 @@
-/* Tang Yuhang <1648200150@qq.com> 2016 */
+/* Tang Yuhang <tyh000011112222@gmail.com> 2016 */
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
@@ -7,7 +7,7 @@
#include <capstone/capstone.h>
-#define VERSION "1.0"
+#define VERSION "2.0"
void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins);
void print_insn_detail_arm(csh handle, cs_insn *ins);
@@ -22,7 +22,7 @@
static uint8_t char_to_hexnum(char c)
{
if (c >= '0' && c <= '9') {
- return (uint8_t)(c - '0');
+ return (uint8_t)(c - '0');
}
if (c >= 'a' && c <= 'f') {
@@ -37,7 +37,7 @@
// valid hexadecimal, and return actual length of uint8_t[] in @size.
static uint8_t *preprocess(char *code, size_t *size)
{
- size_t i = 0, j = 0;
+ size_t i = 0, j = 0;
uint8_t high, low;
uint8_t *result;
@@ -174,17 +174,17 @@
if (!strcmp(mode, "arm")) {
arch = "arm";
- err = cs_open(CS_ARCH_ARM, CS_MODE_ARM, &handle);
+ err = cs_open(CS_ARCH_ARM, CS_MODE_ARM, &handle);
}
if (!strcmp(mode, "armb")) {
arch = "arm";
- err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_BIG_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode, "arml")) {
arch = "arm";
- err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_LITTLE_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_LITTLE_ENDIAN, &handle);
}
if (!strcmp(mode, "thumb")) {
@@ -194,49 +194,49 @@
if (!strcmp(mode, "thumbbe")) {
arch = "arm";
- err = cs_open(CS_ARCH_ARM, CS_MODE_THUMB + CS_MODE_BIG_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_ARM, CS_MODE_THUMB + CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode, "thumble")) {
arch = "arm";
- err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_LITTLE_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_ARM, CS_MODE_ARM + CS_MODE_LITTLE_ENDIAN, &handle);
}
if (!strcmp(mode, "arm64")) {
arch = "arm64";
- err = cs_open(CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN, &handle);
}
if (!strcmp(mode, "mips")) {
arch = "mips";
- err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_LITTLE_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_LITTLE_ENDIAN, &handle);
}
if (!strcmp(mode, "mipsbe")) {
arch = "mips";
- err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode, "mips64")) {
arch = "mips";
- err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode, "mips64be")) {
arch = "mips";
- err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN, &handle);
+ err = cs_open(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode, "x16")) {
- md = CS_MODE_64;
- arch = "x86";
- err = cs_open(CS_ARCH_X86, CS_MODE_16, &handle);
+ md = CS_MODE_16;
+ arch = "x86";
+ err = cs_open(CS_ARCH_X86, CS_MODE_16, &handle);
}
if (!strcmp(mode, "x32")) {
md = CS_MODE_32;
- arch = "x86";
- err = cs_open(CS_ARCH_X86, CS_MODE_32, &handle);
+ arch = "x86";
+ err = cs_open(CS_ARCH_X86, CS_MODE_32, &handle);
}
if (!strcmp(mode, "x64")) {
@@ -248,9 +248,9 @@
if (!strcmp(mode, "x16att")) {
md = CS_MODE_16;
arch = "x86";
- err = cs_open(CS_ARCH_X86, CS_MODE_16, &handle);
- if (!err) {
- cs_option(handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
+ err = cs_open(CS_ARCH_X86, CS_MODE_16, &handle);
+ if (!err) {
+ cs_option(handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
}
}
@@ -278,8 +278,8 @@
}
if (!strcmp(mode,"ppc64be")) {
- arch = "ppc";
- err = cs_open(CS_ARCH_PPC,CS_MODE_64+CS_MODE_BIG_ENDIAN, &handle);
+ arch = "ppc";
+ err = cs_open(CS_ARCH_PPC,CS_MODE_64+CS_MODE_BIG_ENDIAN, &handle);
}
if (!strcmp(mode,"sparc")) {
diff --git a/cstool/cstool_arm.c b/cstool/cstool_arm.c
index 7f4f814..7dd926b 100644
--- a/cstool/cstool_arm.c
+++ b/cstool/cstool_arm.c
@@ -1,10 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_arm64.c b/cstool/cstool_arm64.c
index 138e7bb..cce0244 100644
--- a/cstool/cstool_arm64.c
+++ b/cstool/cstool_arm64.c
@@ -4,10 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_mips.c b/cstool/cstool_mips.c
index 07a362f..1679629 100644
--- a/cstool/cstool_mips.c
+++ b/cstool/cstool_mips.c
@@ -4,10 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_ppc.c b/cstool/cstool_ppc.c
index 3f639f1..cc802ac 100644
--- a/cstool/cstool_ppc.c
+++ b/cstool/cstool_ppc.c
@@ -3,7 +3,6 @@
#include <stdio.h>
-#include <platform.h>
#include <capstone.h>
static csh handle;
diff --git a/cstool/cstool_sparc.c b/cstool/cstool_sparc.c
index 9ee37ce..f53defe 100644
--- a/cstool/cstool_sparc.c
+++ b/cstool/cstool_sparc.c
@@ -3,10 +3,8 @@
#include <stdio.h>
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_systemz.c b/cstool/cstool_systemz.c
index c5c5f56..4256ff1 100644
--- a/cstool/cstool_systemz.c
+++ b/cstool/cstool_systemz.c
@@ -3,10 +3,8 @@
#include <stdio.h>
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_x86.c b/cstool/cstool_x86.c
index fefcfb2..20a9e11 100644
--- a/cstool/cstool_x86.c
+++ b/cstool/cstool_x86.c
@@ -4,11 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <platform.h>
#include <capstone.h>
-
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;
diff --git a/cstool/cstool_xcore.c b/cstool/cstool_xcore.c
index 8062137..4b45137 100644
--- a/cstool/cstool_xcore.c
+++ b/cstool/cstool_xcore.c
@@ -2,11 +2,8 @@
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
#include <stdio.h>
-
-#include <platform.h>
#include <capstone.h>
-
static void print_string_hex(char *comment, unsigned char *str, size_t len)
{
unsigned char *c;