Fix some compiler warnings: char*->const char*, default in swtch.

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@713 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
SiyangXie@gmail.com 2010-10-15 19:43:07 +00:00
parent d95350e97a
commit 361f24eac7
4 changed files with 27 additions and 20 deletions

View File

@ -68,8 +68,6 @@ struct StackFrame {
// by the stackwalker. // by the stackwalker.
string trust_description() const { string trust_description() const {
switch (trust) { switch (trust) {
case StackFrame::FRAME_TRUST_NONE:
return "unknown";
case StackFrame::FRAME_TRUST_CONTEXT: case StackFrame::FRAME_TRUST_CONTEXT:
return "given as instruction pointer in context"; return "given as instruction pointer in context";
case StackFrame::FRAME_TRUST_CFI: case StackFrame::FRAME_TRUST_CFI:
@ -80,6 +78,8 @@ struct StackFrame {
return "previous frame's frame pointer"; return "previous frame's frame pointer";
case StackFrame::FRAME_TRUST_SCAN: case StackFrame::FRAME_TRUST_SCAN:
return "stack scanning"; return "stack scanning";
default:
return "unknown";
} }
}; };

View File

@ -108,6 +108,8 @@ u_int32_t DisassemblerX86::NextInstruction() {
} }
} }
break; break;
default:
break;
} }
break; break;
@ -160,6 +162,8 @@ u_int32_t DisassemblerX86::NextInstruction() {
if (dest->data.reg.id == bad_register_.id) if (dest->data.reg.id == bad_register_.id)
pushed_bad_value_ = true; pushed_bad_value_ = true;
break; break;
default:
break;
} }
} }
@ -195,6 +199,8 @@ u_int32_t DisassemblerX86::NextInstruction() {
memcpy(&bad_register_, &dest->data.reg, sizeof(libdis::x86_reg_t)); memcpy(&bad_register_, &dest->data.reg, sizeof(libdis::x86_reg_t));
} }
break; break;
default:
break;
} }
} }

View File

@ -100,7 +100,6 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() {
} }
u_int64_t address = process_state_->crash_address(); u_int64_t address = process_state_->crash_address();
u_int32_t exception_code = raw_exception->exception_record.exception_code; u_int32_t exception_code = raw_exception->exception_record.exception_code;
u_int32_t exception_flags = raw_exception->exception_record.exception_flags;
u_int32_t exploitability_weight = 0; u_int32_t exploitability_weight = 0;
@ -239,6 +238,8 @@ ExploitabilityRating ExploitabilityWin::CheckPlatformExploitability() {
case libdis::insn_string: case libdis::insn_string:
exploitability_weight += kHugeBump; exploitability_weight += kHugeBump;
break; break;
default:
break;
} }
// Loop the disassembler through the code and check if it // Loop the disassembler through the code and check if it
// IDed any interesting conditions in the near future. // IDed any interesting conditions in the near future.

View File

@ -46,7 +46,7 @@
} \ } \
} while( 0 ) } while( 0 )
static char *prefix_strings[] = { static const char *prefix_strings[] = {
"", /* no prefix */ "", /* no prefix */
"repz ", /* the trailing spaces make it easy to prepend to mnemonic */ "repz ", /* the trailing spaces make it easy to prepend to mnemonic */
"repnz ", "repnz ",
@ -115,7 +115,7 @@ static void get_operand_data_str( x86_op_t *op, char *str, int len ){
static void get_operand_regtype_str( int regtype, char *str, int len ) static void get_operand_regtype_str( int regtype, char *str, int len )
{ {
static struct { static struct {
char *name; const char *name;
int value; int value;
} operand_regtypes[] = { } operand_regtypes[] = {
{"reg_gen" , 0x00001}, {"reg_gen" , 0x00001},
@ -285,7 +285,7 @@ static int format_expr( x86_ea_t *ea, char *buf, int len,
static int format_seg( x86_op_t *op, char *buf, int len, static int format_seg( x86_op_t *op, char *buf, int len,
enum x86_asm_format format ) { enum x86_asm_format format ) {
int len_orig = len; int len_orig = len;
char *reg = ""; const char *reg = "";
if (! op || ! buf || ! len || ! op->flags) { if (! op || ! buf || ! len || ! op->flags) {
return(0); return(0);
@ -293,7 +293,7 @@ static int format_seg( x86_op_t *op, char *buf, int len,
if ( op->type != op_offset && op->type != op_expression ){ if ( op->type != op_offset && op->type != op_expression ){
return(0); return(0);
} }
if (! (int) op->flags & 0xF00 ) { if (! ((int) op->flags & 0xF00) ) {
return(0); return(0);
} }
@ -329,9 +329,9 @@ static int format_seg( x86_op_t *op, char *buf, int len,
return( len_orig - len ); /* return length of appended string */ return( len_orig - len ); /* return length of appended string */
} }
static char *get_operand_datatype_str( x86_op_t *op ){ static const char *get_operand_datatype_str( x86_op_t *op ){
static char *types[] = { static const char *types[] = {
"sbyte", /* 0 */ "sbyte", /* 0 */
"sword", "sword",
"sqword", "sqword",
@ -406,7 +406,7 @@ static int format_insn_eflags_str( enum x86_flag_status flags, char *buf,
int len) { int len) {
static struct { static struct {
char *name; const char *name;
int value; int value;
} insn_flags[] = { } insn_flags[] = {
{ "carry_set ", 0x0001 }, { "carry_set ", 0x0001 },
@ -441,9 +441,9 @@ static int format_insn_eflags_str( enum x86_flag_status flags, char *buf,
return( len_orig - len ); return( len_orig - len );
} }
static char *get_insn_group_str( enum x86_insn_group gp ) { static const char *get_insn_group_str( enum x86_insn_group gp ) {
static char *types[] = { static const char *types[] = {
"", // 0 "", // 0
"controlflow",// 1 "controlflow",// 1
"arithmetic", // 2 "arithmetic", // 2
@ -468,10 +468,10 @@ static char *get_insn_group_str( enum x86_insn_group gp ) {
return types[gp]; return types[gp];
} }
static char *get_insn_type_str( enum x86_insn_type type ) { static const char *get_insn_type_str( enum x86_insn_type type ) {
static struct { static struct {
char *name; const char *name;
int value; int value;
} types[] = { } types[] = {
/* insn_controlflow */ /* insn_controlflow */
@ -593,8 +593,8 @@ static char *get_insn_type_str( enum x86_insn_type type ) {
return ""; return "";
} }
static char *get_insn_cpu_str( enum x86_insn_cpu cpu ) { static const char *get_insn_cpu_str( enum x86_insn_cpu cpu ) {
static char *intel[] = { static const char *intel[] = {
"", // 0 "", // 0
"8086", // 1 "8086", // 1
"80286", // 2 "80286", // 2
@ -621,8 +621,8 @@ static char *get_insn_cpu_str( enum x86_insn_cpu cpu ) {
return ""; return "";
} }
static char *get_insn_isa_str( enum x86_insn_isa isa ) { static const char *get_insn_isa_str( enum x86_insn_isa isa ) {
static char *subset[] = { static const char *subset[] = {
NULL, // 0 NULL, // 0
"General Purpose", // 1 "General Purpose", // 1
"Floating Point", // 2 "Floating Point", // 2
@ -885,7 +885,7 @@ static int format_operand_raw( x86_op_t *op, x86_insn_t *insn, char *buf,
int len){ int len){
char str[MAX_OP_RAW_STRING]; char str[MAX_OP_RAW_STRING];
char *datatype = get_operand_datatype_str(op); const char *datatype = get_operand_datatype_str(op);
switch (op->type) { switch (op->type) {
case op_register: case op_register:
@ -1016,7 +1016,7 @@ int x86_format_operand( x86_op_t *op, char *buf, int len,
static int format_att_mnemonic( x86_insn_t *insn, char *buf, int len) { static int format_att_mnemonic( x86_insn_t *insn, char *buf, int len) {
int size = 0; int size = 0;
char *suffix; const char *suffix;
if (! insn || ! buf || ! len ) if (! insn || ! buf || ! len )
return(0); return(0);