From 132bbffb68de36b27cd4ab8e3f971fef8b74da2e Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 11 Apr 2006 19:02:33 +0000 Subject: [PATCH] Add part of patch 1235377 of msharov and fix a few small bugs in the return values of the cpu cores Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2593 --- include/dosbox.h | 2 +- include/logging.h | 34 +++++++++++++++++----------------- include/paging.h | 3 ++- include/programs.h | 2 +- include/support.h | 2 +- src/cpu/paging.cpp | 8 ++++---- src/debug/debug_gui.cpp | 11 +++++------ src/gui/render_simple.h | 4 ++-- src/gui/render_templates.h | 2 +- src/gui/sdlmain.cpp | 4 ++-- src/hardware/iohandler.cpp | 10 +++++----- src/misc/programs.cpp | 4 ++-- src/misc/support.cpp | 6 +++--- 13 files changed, 46 insertions(+), 46 deletions(-) diff --git a/include/dosbox.h b/include/dosbox.h index cb843854..47c6953d 100644 --- a/include/dosbox.h +++ b/include/dosbox.h @@ -21,7 +21,7 @@ #include "config.h" -void E_Exit(char * message,...); +void E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2)); void MSG_Add(const char*,const char*); //add messages to the internal langaugefile const char* MSG_Get(char const *); //get messages from the internal langaugafile diff --git a/include/logging.h b/include/logging.h index 81ee2531..bf161734 100644 --- a/include/logging.h +++ b/include/logging.h @@ -14,50 +14,50 @@ enum LOG_TYPES { enum LOG_SEVERITIES { LOG_NORMAL, - LOG_WARN, + LOG_WARN, LOG_ERROR, }; #if C_DEBUG class LOG { - LOG_TYPES d_type; - LOG_SEVERITIES d_severity; + LOG_TYPES d_type; + LOG_SEVERITIES d_severity; public: LOG (LOG_TYPES type , LOG_SEVERITIES severity): d_type(type), d_severity(severity) {} - void operator() (char* buf, ...); //../src/debug/debug_gui.cpp + void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3)); //../src/debug/debug_gui.cpp }; -void DEBUG_ShowMsg(char * format,...); +void DEBUG_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2)); #define LOG_MSG DEBUG_ShowMsg #else //C_DEBUG struct LOG { - LOG(LOG_TYPES type, LOG_SEVERITIES severity) { return;} - void operator()(char const* buf) { return;} - void operator()(char const* buf, double f1) { return;} - void operator()(char const* buf, double f1, double f2) { return;} - void operator()(char const* buf, double f1, double f2, double f3) { return;} - void operator()(char const* buf, double f1, double f2, double f3, double f4) { return;} - void operator()(char const* buf, double f1, double f2, double f3, double f4, double f5) { return;} + LOG(LOG_TYPES , LOG_SEVERITIES ) { } + void operator()(char const* ) { } + void operator()(char const* , double ) { } + void operator()(char const* , double , double ) { } + void operator()(char const* , double , double , double ) { } + void operator()(char const* , double , double , double , double ) { } + void operator()(char const* , double , double , double , double , double ) { } - void operator()(char const* buf, char const* s1) { return;} - void operator()(char const* buf, char const* s1, double f1) { return;} - void operator()(char const* buf, char const* s1, double f1,double f2) { return;} - void operator()(char const* buf, double f1, char const* s1) { return;} + void operator()(char const* , char const* ) { } + void operator()(char const* , char const* , double ) { } + void operator()(char const* , char const* , double ,double ) { } + void operator()(char const* , double , char const* ) { } }; //add missing operators to here //try to avoid anything smaller than bit32... -void GFX_ShowMsg(char * format,...); +void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2)); #define LOG_MSG GFX_ShowMsg #endif //C_DEBUG diff --git a/include/paging.h b/include/paging.h index e7a18422..64751c96 100644 --- a/include/paging.h +++ b/include/paging.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.h,v 1.22 2006-02-09 11:47:48 qbix79 Exp $ */ +/* $Id: paging.h,v 1.23 2006-04-11 19:02:33 qbix79 Exp $ */ #ifndef DOSBOX_PAGING_H #define DOSBOX_PAGING_H @@ -48,6 +48,7 @@ class PageDirectory; class PageHandler { public: + virtual ~PageHandler(void) { } virtual Bitu readb(PhysPt addr); virtual Bitu readw(PhysPt addr); virtual Bitu readd(PhysPt addr); diff --git a/include/programs.h b/include/programs.h index 7d6be6a4..17c7a5c5 100644 --- a/include/programs.h +++ b/include/programs.h @@ -50,6 +50,6 @@ public: }; typedef void (PROGRAMS_Main)(Program * * make); -void PROGRAMS_MakeFile(char * name,PROGRAMS_Main * main); +void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main); #endif diff --git a/include/support.h b/include/support.h index 83ee6ff7..73d20813 100644 --- a/include/support.h +++ b/include/support.h @@ -45,7 +45,7 @@ char *ltrim(char *str); char *rtrim(char *str); char *trim(char * str); -bool ScanCMDBool(char * cmd,char * check); +bool ScanCMDBool(char * cmd,char const * const check); char * ScanCMDRemain(char * cmd); char * StripWord(char *&cmd); bool IsDecWord(char * word); diff --git a/src/cpu/paging.cpp b/src/cpu/paging.cpp index 7c804cf7..0fdb6dca 100644 --- a/src/cpu/paging.cpp +++ b/src/cpu/paging.cpp @@ -52,7 +52,7 @@ Bitu PageHandler::readd(PhysPt addr) { (readb(addr+3) << 24); } -void PageHandler::writeb(PhysPt addr,Bitu val) { +void PageHandler::writeb(PhysPt addr,Bitu /*val*/) { E_Exit("No byte handler for write to %d",addr); }; @@ -67,11 +67,11 @@ void PageHandler::writed(PhysPt addr,Bitu val) { writeb(addr+3,(Bit8u) (val >> 24)); }; -HostPt PageHandler::GetHostReadPt(Bitu phys_page) { +HostPt PageHandler::GetHostReadPt(Bitu /*phys_page*/) { return 0; } -HostPt PageHandler::GetHostWritePt(Bitu phys_page) { +HostPt PageHandler::GetHostWritePt(Bitu /*phys_page*/) { return 0; } @@ -111,7 +111,7 @@ static struct { static Bits PageFaultCore(void) { CPU_CycleLeft+=CPU_Cycles; CPU_Cycles=1; - Bitu ret=CPU_Core_Full_Run(); + Bits ret=CPU_Core_Full_Run(); CPU_CycleLeft+=CPU_Cycles; if (ret<0) E_Exit("Got a dosbox close machine in pagefault core?"); if (ret) diff --git a/src/debug/debug_gui.cpp b/src/debug/debug_gui.cpp index 41b5d46a..0b6e8f11 100644 --- a/src/debug/debug_gui.cpp +++ b/src/debug/debug_gui.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug_gui.cpp,v 1.28 2006-02-09 11:47:48 qbix79 Exp $ */ +/* $Id: debug_gui.cpp,v 1.29 2006-04-11 19:02:33 qbix79 Exp $ */ #include "dosbox.h" @@ -34,7 +34,7 @@ #include "debug_inc.h" struct _LogGroup { - char * front; + char const* front; bool enabled; }; #include @@ -52,7 +52,7 @@ extern int old_cursor_state; -void DEBUG_ShowMsg(char * format,...) { +void DEBUG_ShowMsg(char const* format,...) { char buf[512]; va_list msg; @@ -97,7 +97,7 @@ void DEBUG_RefreshPage(char scroll) { wrefresh(dbg.win_out); } -void LOG::operator() (char* format, ...){ +void LOG::operator() (char const* format, ...){ char buf[512]; va_list msg; va_start(msg,format); @@ -188,8 +188,7 @@ static void MakePairs(void) { init_pair(PAIR_BLACK_GREY, COLOR_BLACK /*| FOREGROUND_INTENSITY */, COLOR_WHITE); init_pair(PAIR_GREY_RED, COLOR_WHITE/*| FOREGROUND_INTENSITY */, COLOR_RED); } -static void LOG_Destroy(Section* sec) { - +static void LOG_Destroy(Section*) { if(debuglog) fclose(debuglog); } diff --git a/src/gui/render_simple.h b/src/gui/render_simple.h index 35e337cb..bbdce56b 100644 --- a/src/gui/render_simple.h +++ b/src/gui/render_simple.h @@ -29,7 +29,7 @@ static void conc4d(SCALERNAME,SBPP,DBPP,R)(const void *s) { Bitu hadChange = 0; #if (SBPP == 9) for (Bits x=render.src.width;x>0;) { - if (*(Bit32u*)src == *(Bit32u*)cache && !( + if (*(Bit32u const*)src == *(Bit32u*)cache && !( render.pal.modified[src[0]] | render.pal.modified[src[1]] | render.pal.modified[src[2]] | @@ -40,7 +40,7 @@ static void conc4d(SCALERNAME,SBPP,DBPP,R)(const void *s) { line0+=4*SCALERWIDTH; #else for (Bits x=render.src.width;x>0;) { - if (*(Bitu*)src == *(Bitu*)cache) { + if (*(Bitu const*)src == *(Bitu*)cache) { x-=(sizeof(Bitu)/sizeof(SRCTYPE)); src+=(sizeof(Bitu)/sizeof(SRCTYPE)); cache+=(sizeof(Bitu)/sizeof(SRCTYPE)); diff --git a/src/gui/render_templates.h b/src/gui/render_templates.h index 21631bc2..ea234529 100644 --- a/src/gui/render_templates.h +++ b/src/gui/render_templates.h @@ -129,7 +129,7 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) { if (pixel != fc[x]) { #else for (Bitu x=0;x #include "dosbox.h" @@ -29,10 +29,10 @@ IO_WriteHandler * io_writehandlers[3][IO_MAX]; IO_ReadHandler * io_readhandlers[3][IO_MAX]; -static Bitu IO_ReadBlocked(Bitu port,Bitu iolen) { +static Bitu IO_ReadBlocked(Bitu /*port*/,Bitu /*iolen*/) { return ~0; } -static void IO_WriteBlocked(Bitu port,Bitu val,Bitu iolen) { +static void IO_WriteBlocked(Bitu /*port*/,Bitu /*val*/,Bitu /*iolen*/) { } static Bitu IO_ReadDefault(Bitu port,Bitu iolen) { @@ -150,7 +150,7 @@ static struct { static Bits IOFaultCore(void) { CPU_CycleLeft+=CPU_Cycles; CPU_Cycles=1; - Bitu ret=CPU_Core_Full_Run(); + Bits ret=CPU_Core_Full_Run(); CPU_CycleLeft+=CPU_Cycles; if (ret<0) E_Exit("Got a dosbox close machine in IO-fault core?"); if (ret) @@ -377,7 +377,7 @@ public: static IO* test; -void IO_Destroy(Section* sec) { +void IO_Destroy(Section*) { delete test; } diff --git a/src/misc/programs.cpp b/src/misc/programs.cpp index c9b6dd12..76f05c96 100644 --- a/src/misc/programs.cpp +++ b/src/misc/programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: programs.cpp,v 1.25 2006-04-10 12:06:07 qbix79 Exp $ */ +/* $Id: programs.cpp,v 1.26 2006-04-11 19:02:33 qbix79 Exp $ */ #include #include @@ -51,7 +51,7 @@ static Bit8u exe_block[]={ static std::vector internal_progs; -void PROGRAMS_MakeFile(char * name,PROGRAMS_Main * main) { +void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main) { Bit8u * comdata=(Bit8u *)malloc(32); //MEM LEAK memcpy(comdata,&exe_block,sizeof(exe_block)); comdata[CB_POS]=call_program&0xff; diff --git a/src/misc/support.cpp b/src/misc/support.cpp index 6fac9042..0b8bd8dc 100644 --- a/src/misc/support.cpp +++ b/src/misc/support.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.cpp,v 1.29 2006-02-09 11:47:57 qbix79 Exp $ */ +/* $Id: support.cpp,v 1.30 2006-04-11 19:02:33 qbix79 Exp $ */ #include #include @@ -65,7 +65,7 @@ char *trim(char *str) { } -bool ScanCMDBool(char * cmd,char * check) { +bool ScanCMDBool(char * cmd,char const * const check) { char * scan=cmd;size_t c_len=strlen(check); while ((scan=strchr(scan,'/'))) { /* found a / now see behind it */ @@ -145,7 +145,7 @@ double ConvDblWord(char * word) { static char buf[1024]; //greater scope as else it doesn't always gets thrown right (linux/gcc2.95) -void E_Exit(char * format,...) { +void E_Exit(const char * format,...) { #if C_DEBUG && C_HEAVY_DEBUG DEBUG_HeavyWriteLogInstruction(); #endif