added const to strings

This commit is contained in:
Stanislav Shwartsman 2009-05-03 19:21:38 +00:00
parent 7c0e038cbc
commit d2cdcfacaf
5 changed files with 85 additions and 91 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.192 2009-04-30 18:58:44 sshwarts Exp $
// $Id: dbg_main.cc,v 1.193 2009-05-03 19:21:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2671,7 +2671,7 @@ void bx_dbg_disassemble_command(const char *format, Bit64u from, Bit64u to)
unsigned ilen = bx_disassemble.disasm(dis_size==32, dis_size==64,
(bx_address)(-1), (bx_address)(-1), bx_disasm_ibuf, bx_disasm_tbuf);
char *Sym=bx_dbg_disasm_symbolic_address((Bit32u)from, 0);
const char *Sym=bx_dbg_disasm_symbolic_address((Bit32u)from, 0);
dbg_printf("%08x: ", (unsigned) from);
dbg_printf("(%20s): ", Sym?Sym:"");

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.52 2009-04-07 16:12:19 sshwarts Exp $
// $Id: debug.h,v 1.53 2009-05-03 19:21:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -313,13 +313,13 @@ void bx_dbg_show_param_command(char *param);
int bx_dbg_show_symbolic(void);
void bx_dbg_set_symbol_command(char *symbol, Bit32u val);
char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base);
char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs);
int bx_dbg_symbol_command(char* filename, bx_bool global, Bit32u offset);
void bx_dbg_info_symbols_command(char *Symbol);
int bx_dbg_lbreakpoint_symbol_command(char *Symbol);
Bit32u bx_dbg_get_symbol_value(char *Symbol);
char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base);
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base);
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs);
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset);
void bx_dbg_info_symbols_command(const char *Symbol);
int bx_dbg_lbreakpoint_symbol_command(const char *Symbol);
Bit32u bx_dbg_get_symbol_value(const char *Symbol);
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base);
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: symbols.cc,v 1.16 2009-05-03 18:31:23 sshwarts Exp $
// $Id: symbols.cc,v 1.17 2009-05-03 19:21:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -33,7 +33,7 @@
static const char BX_HAVE_MAP_ERR[] = "context not implemented because BX_HAVE_MAP=0\n";
char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
{
static bx_bool first = true;
if (first) {
@ -43,35 +43,35 @@ char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
return "unk. ctxt";
}
char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
{
// just prints an error anyway
return bx_dbg_symbolic_address (0,0,0);
}
int bx_dbg_symbol_command(char* filename, bx_bool global, Bit32u offset)
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset)
{
dbg_printf(BX_HAVE_MAP_ERR);
return -1;
}
void bx_dbg_info_symbols_command(char *Symbol)
void bx_dbg_info_symbols_command(const char *Symbol)
{
dbg_printf(BX_HAVE_MAP_ERR);
}
int bx_dbg_lbreakpoint_symbol_command(char *Symbol)
int bx_dbg_lbreakpoint_symbol_command(const char *Symbol)
{
dbg_printf(BX_HAVE_MAP_ERR);
return -1;
}
Bit32u bx_dbg_get_symbol_value(char *Symbol)
Bit32u bx_dbg_get_symbol_value(const char *Symbol)
{
return 0;
}
char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
{
return 0;
}
@ -226,7 +226,7 @@ void symbol_entry_t::trim_quotes(void)
}
}
Bit32u bx_dbg_get_symbol_value(char *Symbol)
Bit32u bx_dbg_get_symbol_value(const char *Symbol)
{
context_t* cntx = context_t::get_context(0);
if(!cntx) // Context not found
@ -242,7 +242,7 @@ Bit32u bx_dbg_get_symbol_value(char *Symbol)
return sym->start;
}
char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
const char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
{
static char buf[80];
#if 0
@ -274,7 +274,7 @@ char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base)
return buf;
}
char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
const char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
{
static char buf[80];
@ -293,7 +293,7 @@ char* bx_dbg_disasm_symbolic_address(Bit32u eip, Bit32u base)
return buf;
}
char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
const char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
{
// in 16-bit code, the segment selector and offset are combined into a
// 20-bit linear address = (segment selector<<4) + offset.
@ -302,7 +302,7 @@ char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs)
return bx_dbg_symbolic_address (0, eip+(cs<<4), 0);
}
int bx_dbg_symbol_command(char* filename, bx_bool global, Bit32u offset)
int bx_dbg_symbol_command(const char* filename, bx_bool global, Bit32u offset)
{
symbol_entry_t file(0, filename);
file.trim_quotes();
@ -378,7 +378,7 @@ static bool bx_dbg_strprefix(const char *s1, const char *s2)
return strncmp(s1, s2, len)==0;
}
void bx_dbg_info_symbols_command(char *Symbol)
void bx_dbg_info_symbols_command(const char *Symbol)
{
context_t* cntx = context_t::get_context(0);
@ -426,7 +426,7 @@ void bx_dbg_info_symbols_command(char *Symbol)
}
}
int bx_dbg_lbreakpoint_symbol_command(char *symbol)
int bx_dbg_lbreakpoint_symbol_command(const char *symbol)
{
context_t* cntx = context_t::get_context(0);
if(!cntx) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.176 2009-04-26 06:56:27 vruppert Exp $
// $Id: config.cc,v 1.177 2009-05-03 19:21:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -2077,11 +2077,11 @@ static Bit32s parse_log_options(const char *context, char *loglev, char *param1)
return 0;
}
static int parse_debug_symbols(const char *context, char **params, int num_params)
static int parse_debug_symbols(const char *context, const char **params, int num_params)
{
#if BX_DEBUGGER
Bit32u offset = 0;
char* filename = 0;
const char *filename = 0;
while (num_params > 0)
{
@ -2953,7 +2953,7 @@ static int parse_line_formatted(const char *context, int num_params, char *param
#endif
}
else if (!strcmp(params[0], "debug_symbols")) {
if (parse_debug_symbols(context, params + 1, num_params - 1) < 0) {
if (parse_debug_symbols(context, (const char **)(params + 1), num_params - 1) < 0) {
return -1;
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: osdep.cc,v 1.19 2009-01-16 18:18:57 sshwarts Exp $
// $Id: osdep.cc,v 1.20 2009-05-03 19:21:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -75,8 +75,7 @@ int bx_vsnprintf (char *s, size_t maxlen, const char *format, va_list arg)
do { if (endptr != NULL) *endptr = (char *) (end); \
return val; } while (0)
Bit64u
bx_strtoull (const char *nptr, char **endptr, int baseignore)
Bit64u bx_strtoull (const char *nptr, char **endptr, int baseignore)
{
int negative; /* The sign of the number. */
int exponent; /* Exponent of the number. */
@ -215,9 +214,7 @@ int main (int argc, char **argv)
/* XXX use real strdup */
char *bx_strdup(const char *str)
{
char *temp;
temp = (char*)malloc(strlen(str)+1);
char *temp = (char*)malloc(strlen(str)+1);
sprintf(temp, "%s", str);
return temp;
@ -303,9 +300,8 @@ int fd_stat(struct stat *buf)
{
OSErr err;
DrvSts status;
int result;
int result = 0;
result = 0;
err = DriveStatus(1, &status);
if (status.diskInPlace <1 || status.diskInPlace > 2)
result = -1;
@ -314,8 +310,6 @@ int fd_stat(struct stat *buf)
}
#endif /* BX_WITH_MACOS */
//////////////////////////////////////////////////////////////////////
// New functions to replace library functions
// with OS-independent versions