From a5ac3216bac8b21f2823fd3ede6e7b44429a64f4 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 14 Jun 2007 08:23:46 +0000 Subject: [PATCH] Some more const stuff. Silences a few warnings and removes a few casts. Update description of dss. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2886 --- include/dos_inc.h | 38 ++-- include/mem.h | 2 +- include/setup.h | 6 +- include/shell.h | 4 +- src/cpu/core_dyn_x86/decoder.h | 2 +- src/cpu/core_dyn_x86/risc_x86.h | 10 +- src/dos/cdrom.h | 12 +- src/dos/dos_devices.cpp | 4 +- src/dos/dos_files.cpp | 65 ++++--- src/dos/dos_keyboard_layout.cpp | 2 +- src/dos/dos_memory.cpp | 2 +- src/dos/drive_fat.cpp | 8 +- src/dos/drives.h | 4 +- src/dosbox.cpp | 4 +- src/gui/midi.cpp | 11 +- src/gui/midi_alsa.h | 6 +- src/gui/midi_coreaudio.h | 2 +- src/gui/midi_oss.h | 2 +- src/gui/midi_win32.h | 4 +- src/gui/render_scalers.cpp | 321 +++++++++++++++++--------------- src/gui/render_scalers.h | 4 +- src/hardware/memory.cpp | 8 +- src/hardware/sblaster.cpp | 8 +- src/misc/setup.cpp | 10 +- src/shell/shell.cpp | 10 +- src/shell/shell_cmds.cpp | 51 ++--- 26 files changed, 312 insertions(+), 288 deletions(-) diff --git a/include/dos_inc.h b/include/dos_inc.h index 5155acdd..d748a016 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.68 2007-06-13 07:25:14 qbix79 Exp $ */ +/* $Id: dos_inc.h,v 1.69 2007-06-14 08:23:46 qbix79 Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -115,35 +115,35 @@ bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry); bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate); /* Routines for Drive Class */ -bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry); -bool DOS_OpenFileExtended(char *name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status); -bool DOS_CreateFile(char * name,Bit16u attribute,Bit16u * entry); -bool DOS_UnlinkFile(char * name); +bool DOS_OpenFile(char const * name,Bit8u flags,Bit16u * entry); +bool DOS_OpenFileExtended(char const * name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status); +bool DOS_CreateFile(char const * name,Bit16u attribute,Bit16u * entry); +bool DOS_UnlinkFile(char const * const name); bool DOS_FindFirst(char *search,Bit16u attr,bool fcb_findfirst=false); bool DOS_FindNext(void); -bool DOS_Canonicalize(char * name,char * big); -bool DOS_CreateTempFile(char * name,Bit16u * entry); -bool DOS_FileExists(char * name); +bool DOS_Canonicalize(char const * const name,char * const big); +bool DOS_CreateTempFile(char * const name,Bit16u * entry); +bool DOS_FileExists(char const * const name); /* Helper Functions */ -bool DOS_MakeName(char * name,char * fullname,Bit8u * drive); +bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive); /* Drive Handing Routines */ Bit8u DOS_GetDefaultDrive(void); void DOS_SetDefaultDrive(Bit8u drive); bool DOS_SetDrive(Bit8u drive); -bool DOS_GetCurrentDir(Bit8u drive,char * bugger); -bool DOS_ChangeDir(char * dir); -bool DOS_MakeDir(char * dir); -bool DOS_RemoveDir(char * dir); -bool DOS_Rename(char * oldname,char * newname); +bool DOS_GetCurrentDir(Bit8u drive,char * const buffer); +bool DOS_ChangeDir(char const * const dir); +bool DOS_MakeDir(char const * const dir); +bool DOS_RemoveDir(char const * const dir); +bool DOS_Rename(char const * const oldname,char const * const newname); bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * clusters,Bit16u * free); -bool DOS_GetFileAttr(char * name,Bit16u * attr); -bool DOS_SetFileAttr(char * name,Bit16u attr); +bool DOS_GetFileAttr(char const * const name,Bit16u * attr); +bool DOS_SetFileAttr(char const * const name,Bit16u attr); /* IOCTL Stuff */ bool DOS_IOCTL(void); bool DOS_GetSTDINStatus(); -Bit8u DOS_FindDevice(char * name); +Bit8u DOS_FindDevice(char const * name); void DOS_SetupDevices(void); /* Execute and new process creation */ @@ -535,8 +535,8 @@ private: class DOS_MCB : public MemStruct{ public: DOS_MCB(Bit16u seg) { SetPt(seg); } - void SetFileName(char * _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); } - void GetFileName(char * _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;} + void SetFileName(char const * const _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); } + void GetFileName(char * const _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;} void SetType(Bit8u _type) { sSave(sMCB,type,_type);} void SetSize(Bit16u _size) { sSave(sMCB,size,_size);} void SetPSPSeg(Bit16u _pspseg) { sSave(sMCB,psp_segment,_pspseg);} diff --git a/include/mem.h b/include/mem.h index 9c3a5dfa..436dc384 100644 --- a/include/mem.h +++ b/include/mem.h @@ -150,7 +150,7 @@ INLINE Bit32u phys_readd(PhysPt addr){ /* These don't check for alignment, better be sure it's correct */ -void MEM_BlockWrite(PhysPt pt,void * data,Bitu size); +void MEM_BlockWrite(PhysPt pt,void const * const data,Bitu size); void MEM_BlockRead(PhysPt pt,void * data,Bitu size); void MEM_BlockCopy(PhysPt dest,PhysPt src,Bitu size); void MEM_StrCopy(PhysPt pt,char * data,Bitu size); diff --git a/include/setup.h b/include/setup.h index 53517198..39f57604 100644 --- a/include/setup.h +++ b/include/setup.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.h,v 1.26 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: setup.h,v 1.27 2007-06-14 08:23:46 qbix79 Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H @@ -142,8 +142,8 @@ private: public: Section(char const * const _sectionname):sectionname(_sectionname) { } - void AddInitFunction(SectionFunction func,bool canchange=false) {initfunctions.push_back(Function_wrapper(func,canchange));} - void AddDestroyFunction(SectionFunction func,bool canchange=false) {destroyfunctions.push_front(Function_wrapper(func,canchange));} + void AddInitFunction(SectionFunction func,bool canchange=false); + void AddDestroyFunction(SectionFunction func,bool canchange=false); void ExecuteInit(bool initall=true); void ExecuteDestroy(bool destroyall=true); const char* GetName() const {return sectionname.c_str();} diff --git a/include/shell.h b/include/shell.h index e264cb00..a238e3e1 100644 --- a/include/shell.h +++ b/include/shell.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.h,v 1.20 2007-01-08 19:59:06 qbix79 Exp $ */ +/* $Id: shell.h,v 1.21 2007-06-14 08:23:46 qbix79 Exp $ */ #ifndef DOSBOX_SHELL_H #define DOSBOX_SHELL_H @@ -77,7 +77,7 @@ public: void DoCommand(char * cmd); bool Execute(char * name,char * args); /* Checks if it matches a hardware-property */ - bool CheckConfig(char* cmd,char*line); + bool CheckConfig(char* cmd_in,char*line); /* Some internal used functions */ char * Which(char * name); /* Some supported commands */ diff --git a/src/cpu/core_dyn_x86/decoder.h b/src/cpu/core_dyn_x86/decoder.h index c7418d32..d9456f4f 100644 --- a/src/cpu/core_dyn_x86/decoder.h +++ b/src/cpu/core_dyn_x86/decoder.h @@ -2561,7 +2561,7 @@ restart_prefix: dyn_save_critical_regs(); gen_call_function( decode.modrm.reg == 3 ? (void*)&CPU_CALL : (void*)&CPU_JMP, - decode.big_op ? (char *)"%Id%Drw%Drd%Drd" : (char *)"%Id%Drw%Drw%Drd", + decode.big_op ? "%Id%Drw%Drd%Drd" : "%Id%Drw%Drw%Drd", decode.big_op,DREG(EA),DREG(TMPW),DREG(TMPB)); dyn_flags_host_to_gen(); goto core_close_block; diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index 94b79c70..08ea139e 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -721,11 +721,11 @@ static void gen_dshift_cl(bool dword,bool left,DynReg * dr1,DynReg * dr2,DynReg dr1->flags|=DYNFLG_CHANGED; } -static void gen_call_function(void * func,char * ops,...) { +static void gen_call_function(void * func,char const* ops,...) { Bits paramcount=0; bool release_flags=false; struct ParamInfo { - char * line; + const char * line; Bitu value; } pinfo[32]; ParamInfo * retparam=0; @@ -743,10 +743,10 @@ static void gen_call_function(void * func,char * ops,...) { Bits pindex=0; while (*ops) { if (*ops=='%') { - pinfo[pindex].line=ops+1; + pinfo[pindex].line=ops+1; pinfo[pindex].value=va_arg(params,Bitu); #if defined (MACOSX) - char * scan=pinfo[pindex].line; + const char * scan=pinfo[pindex].line; if ((*scan=='I') || (*scan=='D')) stack_used+=4; else if (*scan=='F') free_flags=true; #endif @@ -777,7 +777,7 @@ static void gen_call_function(void * func,char * ops,...) { paramcount=0; while (pindex) { pindex--; - char * scan=pinfo[pindex].line; + const char * scan=pinfo[pindex].line; switch (*scan++) { case 'I': /* immediate value */ paramcount++; diff --git a/src/dos/cdrom.h b/src/dos/cdrom.h index 08008336..bad8406b 100644 --- a/src/dos/cdrom.h +++ b/src/dos/cdrom.h @@ -76,7 +76,7 @@ public: virtual bool PlayAudioSector (unsigned long start,unsigned long len); virtual bool PauseAudio (bool resume); virtual bool StopAudio (void); - virtual bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { return false; }; + virtual bool ReadSectors (PhysPt /*buffer*/, bool /*raw*/, unsigned long /*sector*/, unsigned long /*num*/) { return false; }; virtual bool LoadUnloadMedia (bool unload); private: @@ -91,18 +91,18 @@ private: class CDROM_Interface_Fake : public CDROM_Interface { public: - bool SetDevice (char* path, int forceCD) { return true; }; + bool SetDevice (char* /*path*/, int /*forceCD*/) { return true; }; bool GetUPC (unsigned char& attr, char* upc) { attr = 0; strcpy(upc,"UPC"); return true; }; bool GetAudioTracks (int& stTrack, int& end, TMSF& leadOut); bool GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr); bool GetAudioSub (unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos); bool GetAudioStatus (bool& playing, bool& pause); bool GetMediaTrayStatus (bool& mediaPresent, bool& mediaChanged, bool& trayOpen); - bool PlayAudioSector (unsigned long start,unsigned long len) { return true; }; - bool PauseAudio (bool resume) { return true; }; + bool PlayAudioSector (unsigned long /*start*/,unsigned long /*len*/) { return true; }; + bool PauseAudio (bool /*resume*/) { return true; }; bool StopAudio (void) { return true; }; - bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { return true; }; - bool LoadUnloadMedia (bool unload) { return true; }; + bool ReadSectors (PhysPt /*buffer*/, bool /*raw*/, unsigned long /*sector*/, unsigned long /*num*/) { return true; }; + bool LoadUnloadMedia (bool /*unload*/) { return true; }; }; class CDROM_Interface_Image : public CDROM_Interface diff --git a/src/dos/dos_devices.cpp b/src/dos/dos_devices.cpp index a3efa85a..48396751 100644 --- a/src/dos/dos_devices.cpp +++ b/src/dos/dos_devices.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_devices.cpp,v 1.17 2007-06-13 07:25:14 qbix79 Exp $ */ +/* $Id: dos_devices.cpp,v 1.18 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include "dosbox.h" @@ -120,7 +120,7 @@ DOS_File & DOS_File::operator= (const DOS_File & orig) { return *this; } -Bit8u DOS_FindDevice(char * name) { +Bit8u DOS_FindDevice(char const * name) { /* should only check for the names before the dot and spacepadded */ // STDAUX is alias for COM1 // A bit of a hack, but no application will probably use stdaux to determine wether a directory exists diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 3abf5004..3fc64416 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.86 2007-06-13 07:25:14 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.87 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -52,7 +52,7 @@ void DOS_SetDefaultDrive(Bit8u drive) { if (drive<=DOS_DRIVES && ((drive<2) || Drives[drive])) dos.current_drive = drive; } -bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { +bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive) { if(!name || *name == 0 || *name == ' ') { /* Both \0 and space are seperators and @@ -60,23 +60,23 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { DOS_SetError(DOSERR_FILE_NOT_FOUND); return false; } - + const char * name_int = name; char tempdir[DOS_PATHLENGTH]; char upname[DOS_PATHLENGTH]; Bitu r,w; *drive=dos.current_drive; /* First get the drive */ - if (name[1]==':') { - *drive=(name[0] | 0x20)-'a'; - name+=2; + if (name_int[1]==':') { + *drive=(name_int[0] | 0x20)-'a'; + name_int+=2; } if (*drive>=DOS_DRIVES || !Drives[*drive]) { DOS_SetError(DOSERR_PATH_NOT_FOUND); return false; } r=0;w=0; - while (name[r]!=0 && (r='a') && (c<='z')) {upname[w++]=c-32;continue;} if ((c>='A') && (c<='Z')) {upname[w++]=c;continue;} if ((c>='0') && (c<='9')) {upname[w++]=c;continue;} @@ -105,7 +105,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { else fullname[0]=0; Bit32u lastdir=0;Bit32u t=0; while (fullname[t]!=0) { - if ((fullname[t]=='\\') && (fullname[t+1]!=0))lastdir=t; + if ((fullname[t]=='\\') && (fullname[t+1]!=0))lastdir=t; t++; }; r=0;w=0; @@ -144,7 +144,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { } } fullname[lastdir]=0; - Bit32u t=0;lastdir=0; + t=0;lastdir=0; while (fullname[t]!=0) { if ((fullname[t]=='\\') && (fullname[t+1]!=0))lastdir=t; t++; @@ -173,7 +173,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { return true; } -bool DOS_GetCurrentDir(Bit8u drive,char * buffer) { +bool DOS_GetCurrentDir(Bit8u drive,char * const buffer) { if (drive==0) drive=DOS_GetDefaultDrive(); else drive--; if ((drive>DOS_DRIVES) || (!Drives[drive])) { @@ -184,7 +184,7 @@ bool DOS_GetCurrentDir(Bit8u drive,char * buffer) { return true; } -bool DOS_ChangeDir(char * dir) { +bool DOS_ChangeDir(char const * const dir) { Bit8u drive;char fulldir[DOS_PATHLENGTH]; if (!DOS_MakeName(dir,fulldir,&drive)) return false; @@ -197,7 +197,7 @@ bool DOS_ChangeDir(char * dir) { return false; } -bool DOS_MakeDir(char * dir) { +bool DOS_MakeDir(char const * const dir) { Bit8u drive;char fulldir[DOS_PATHLENGTH]; size_t len = strlen(dir); if(!len || dir[len-1] == '\\') { @@ -215,7 +215,7 @@ bool DOS_MakeDir(char * dir) { return false; } -bool DOS_RemoveDir(char * dir) { +bool DOS_RemoveDir(char const * const dir) { /* We need to do the test before the removal as can not rely on * the host to forbid removal of the current directory. * We never change directory. Everything happens in the drives. @@ -243,7 +243,7 @@ bool DOS_RemoveDir(char * dir) { return false; } -bool DOS_Rename(char * oldname,char * newname) { +bool DOS_Rename(char const * const oldname,char const * const newname) { Bit8u driveold;char fullold[DOS_PATHLENGTH]; Bit8u drivenew;char fullnew[DOS_PATHLENGTH]; if (!DOS_MakeName(oldname,fullold,&driveold)) return false; @@ -382,14 +382,14 @@ bool DOS_CloseFile(Bit16u entry) { return true; } -static bool PathExists(char* name) { - char* leading = strrchr(name,'\\'); +static bool PathExists(char const * const name) { + const char* leading = strrchr(name,'\\'); if(!leading) return true; char temp[CROSS_LEN]; strcpy(temp,name); - leading = strrchr(temp,'\\'); - if (leading == temp) return true; - *leading = 0; + char * lead = strrchr(temp,'\\'); + if (lead == temp) return true; + *lead = 0; Bit8u drive;char fulldir[DOS_PATHLENGTH]; if (!DOS_MakeName(temp,fulldir,&drive)) return false; if(!Drives[drive]->TestDir(fulldir)) return false; @@ -397,7 +397,7 @@ static bool PathExists(char* name) { } -bool DOS_CreateFile(char * name,Bit16u attributes,Bit16u * entry) { +bool DOS_CreateFile(char const * name,Bit16u attributes,Bit16u * entry) { // Creation of a device is the same as opening it // Tc201 installer if (DOS_FindDevice(name) != DOS_DEVICES) @@ -438,14 +438,14 @@ bool DOS_CreateFile(char * name,Bit16u attributes,Bit16u * entry) { } } -bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry) { +bool DOS_OpenFile(char const * name,Bit8u flags,Bit16u * entry) { /* First check for devices */ if (flags>2) LOG(LOG_FILES,LOG_ERROR)("Special file open command %X file %s",flags,name); else LOG(LOG_FILES,LOG_NORMAL)("file open command %X file %s",flags,name); DOS_PSP psp(dos.psp()); Bit16u attr = 0; - Bit8u devnum = DOS_FindDevice((char *)name); + Bit8u devnum = DOS_FindDevice(name); bool device = (devnum != DOS_DEVICES); if(!device && DOS_GetFileAttr(name,&attr)) { //DON'T ALLOW directories to be openened.(skip test if file is device). @@ -500,7 +500,7 @@ bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry) { } } -bool DOS_OpenFileExtended(char *name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status) +bool DOS_OpenFileExtended(char const * name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status) // FIXME: Not yet supported : Bit 13 of flags (int 0x24 on critical error { Bit16u result = 0; @@ -526,7 +526,7 @@ bool DOS_OpenFileExtended(char *name, Bit16u flags, Bit16u createAttr, Bit16u ac return true; }; -bool DOS_UnlinkFile(char * name) { +bool DOS_UnlinkFile(char const * const name) { char fullname[DOS_PATHLENGTH];Bit8u drive; if (!DOS_MakeName(name,fullname,&drive)) return false; if(Drives[drive]->FileUnlink(fullname)){ @@ -537,7 +537,7 @@ bool DOS_UnlinkFile(char * name) { } } -bool DOS_GetFileAttr(char * name,Bit16u * attr) { +bool DOS_GetFileAttr(char const * const name,Bit16u * attr) { char fullname[DOS_PATHLENGTH];Bit8u drive; if (!DOS_MakeName(name,fullname,&drive)) return false; if (Drives[drive]->GetFileAttr(fullname,attr)) { @@ -548,7 +548,7 @@ bool DOS_GetFileAttr(char * name,Bit16u * attr) { } } -bool DOS_SetFileAttr(char * name,Bit16u attr) +bool DOS_SetFileAttr(char const * const name,Bit16u attr) // this function does not change the file attributs // it just does some tests if file is available // returns false when using on cdrom (stonekeep) @@ -563,7 +563,7 @@ bool DOS_SetFileAttr(char * name,Bit16u attr) return Drives[drive]->GetFileAttr(fullname,&attrTemp); } -bool DOS_Canonicalize(char * name,char * big) { +bool DOS_Canonicalize(char const * const name,char * const big) { //TODO Add Better support for devices and shit but will it be needed i doubt it :) Bit8u drive; char fullname[DOS_PATHLENGTH]; @@ -638,7 +638,7 @@ bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry) { -bool DOS_CreateTempFile(char * name,Bit16u * entry) { +bool DOS_CreateTempFile(char * const name,Bit16u * entry) { /* First add random crap to the end of the name and try to open */ char * tempname; tempname=name+strlen(name); @@ -775,7 +775,7 @@ savefcb: return ret; } -static void DTAExtendName(char * name,char * filename,char * ext) { +static void DTAExtendName(char * const name,char * const filename,char * const ext) { char * find=strchr(name,'.'); if (find) { strcpy(ext,find+1); @@ -1032,7 +1032,7 @@ void DOS_FCBSetRandomRecord(Bit16u seg, Bit16u offset) { } -bool DOS_FileExists(char * name) { +bool DOS_FileExists(char const * const name) { char fullname[DOS_PATHLENGTH];Bit8u drive; if (!DOS_MakeName(name,fullname,&drive)) return false; return Drives[drive]->FileExists(fullname); @@ -1058,8 +1058,7 @@ bool DOS_SetDrive(Bit8u drive) { } }; -bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate) -{ +bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate) { Bit32u handle=RealHandle(entry); if (handle>=DOS_FILES) { DOS_SetError(DOSERR_INVALID_HANDLE); diff --git a/src/dos/dos_keyboard_layout.cpp b/src/dos/dos_keyboard_layout.cpp index 79e8af3c..f19b49dc 100644 --- a/src/dos/dos_keyboard_layout.cpp +++ b/src/dos/dos_keyboard_layout.cpp @@ -37,7 +37,7 @@ static FILE* OpenDosboxFile(const char* name) { localDrive* ldp=0; // try to build dos name - if (DOS_MakeName((char*)name,fullname,&drive)) { + if (DOS_MakeName(name,fullname,&drive)) { try { // try to open file on mounted drive first ldp=dynamic_cast(Drives[drive]); diff --git a/src/dos/dos_memory.cpp b/src/dos/dos_memory.cpp index 0fa042f7..9785e879 100644 --- a/src/dos/dos_memory.cpp +++ b/src/dos/dos_memory.cpp @@ -352,7 +352,7 @@ bool DOS_LinkUMBsToMemChain(Bit16u linkstate) { /* Scan MCB-chain for last block before UMB-chain */ Bit16u mcb_segment=dos.firstMCB; - Bit16u prev_mcb_segment; + Bit16u prev_mcb_segment=dos.firstMCB; DOS_MCB mcb(mcb_segment); while ((mcb_segment!=umb_start) && (mcb.GetType()!=0x5a)) { prev_mcb_segment=mcb_segment; diff --git a/src/dos/drive_fat.cpp b/src/dos/drive_fat.cpp index e21e7847..5ecf09c2 100644 --- a/src/dos/drive_fat.cpp +++ b/src/dos/drive_fat.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_fat.cpp,v 1.21 2007-06-12 20:22:08 c2woody Exp $ */ +/* $Id: drive_fat.cpp,v 1.22 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -399,8 +399,8 @@ bool fatDrive::getEntryName(char *fullname, char *entname) { return true; } -bool fatDrive::getFileDirEntry(char * filename, direntry * useEntry, Bit32u * dirClust, Bit32u * subEntry) { - Bit32u len = (Bit32u)strlen(filename); +bool fatDrive::getFileDirEntry(char const * const filename, direntry * useEntry, Bit32u * dirClust, Bit32u * subEntry) { + size_t len = strlen(filename); char dirtoken[DOS_PATHLENGTH]; Bit32u currentClust = 0; @@ -795,7 +795,7 @@ bool fatDrive::FileCreate(DOS_File **file, char *name, Bit16u attributes) { bool fatDrive::FileExists(const char *name) { direntry fileEntry; Bit32u dummy1, dummy2; - if(!getFileDirEntry((char *)name, &fileEntry, &dummy1, &dummy2)) return false; + if(!getFileDirEntry(name, &fileEntry, &dummy1, &dummy2)) return false; return true; } diff --git a/src/dos/drives.h b/src/dos/drives.h index 51d618fd..371cb01b 100644 --- a/src/dos/drives.h +++ b/src/dos/drives.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drives.h,v 1.36 2007-01-21 16:21:22 c2woody Exp $ */ +/* $Id: drives.h,v 1.37 2007-06-14 08:23:46 qbix79 Exp $ */ #ifndef _DRIVES_H__ #define _DRIVES_H__ @@ -181,7 +181,7 @@ private: Bit32u getClustFirstSect(Bit32u clustNum); bool FindNextInternal(Bit32u dirClustNumber, DOS_DTA & dta, direntry *foundEntry); bool getDirClustNum(char * dir, Bit32u * clustNum, bool parDir); - bool getFileDirEntry(char * filename, direntry * useEntry, Bit32u * dirClust, Bit32u * subEntry); + bool getFileDirEntry(char const * const filename, direntry * useEntry, Bit32u * dirClust, Bit32u * subEntry); bool addDirectoryEntry(Bit32u dirClustNumber, direntry useEntry); void zeroOutCluster(Bit32u clustNumber); bool getEntryName(char *fullname, char *entname); diff --git a/src/dosbox.cpp b/src/dosbox.cpp index ced21783..ec935eb4 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.cpp,v 1.115 2007-02-22 08:44:06 qbix79 Exp $ */ +/* $Id: dosbox.cpp,v 1.116 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -420,7 +420,7 @@ void DOSBOX_Init(void) { "tandy -- Enable Tandy Sound System emulation (off,on,auto).\n" " For auto Tandysound emulation is present only if machine is set to tandy.\n" "tandyrate -- Sample rate of the Tandy 3-Voice generation.\n" - "disney -- Enable Disney Sound Source emulation.\n" + "disney -- Enable Disney Sound Source emulation. Covox Voice Master and Speech Thing compatible.\n" ); secprop=control->AddSection_prop("joystick",&BIOS_Init,false);//done diff --git a/src/gui/midi.cpp b/src/gui/midi.cpp index 08613663..22407130 100644 --- a/src/gui/midi.cpp +++ b/src/gui/midi.cpp @@ -64,11 +64,12 @@ public: next=handler_list; handler_list=this; }; - virtual bool Open(const char * conf) { return true; }; + virtual bool Open(const char * /*conf*/) { return true; }; virtual void Close(void) {}; - virtual void PlayMsg(Bit8u * msg) {}; - virtual void PlaySysex(Bit8u * sysex,Bitu len) {}; - virtual char * GetName(void) { return "none"; }; + virtual void PlayMsg(Bit8u * /*msg*/) {}; + virtual void PlaySysex(Bit8u * /*sysex*/,Bitu /*len*/) {}; + virtual const char * GetName(void) { return "none"; }; + virtual ~MidiHandler() { }; MidiHandler * next; }; @@ -199,7 +200,7 @@ getdefault: static MIDI* test; -void MIDI_Destroy(Section* sec){ +void MIDI_Destroy(Section* /*sec*/){ delete test; } void MIDI_Init(Section * sec) { diff --git a/src/gui/midi_alsa.h b/src/gui/midi_alsa.h index 0219ad87..475a2082 100644 --- a/src/gui/midi_alsa.h +++ b/src/gui/midi_alsa.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_alsa.h,v 1.15 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: midi_alsa.h,v 1.16 2007-06-14 08:23:46 qbix79 Exp $ */ #define ALSA_PCM_OLD_HW_PARAMS_API #define ALSA_PCM_OLD_SW_PARAMS_API @@ -50,7 +50,7 @@ private: snd_seq_flush_output(seq_handle); } - int parse_addr(char *arg, int *client, int *port) { + int parse_addr(const char *arg, int *client, int *port) { char *p; if (isdigit(*arg)) { @@ -69,7 +69,7 @@ private: } public: MidiHandler_alsa() : MidiHandler() {}; - char* GetName(void) { return "alsa"; } + const char* GetName(void) { return "alsa"; } void PlaySysex(Bit8u * sysex,Bitu len) { snd_seq_ev_set_sysex(&ev, len, sysex); send_event(1); diff --git a/src/gui/midi_coreaudio.h b/src/gui/midi_coreaudio.h index 8fc00575..923f1615 100644 --- a/src/gui/midi_coreaudio.h +++ b/src/gui/midi_coreaudio.h @@ -24,7 +24,7 @@ private: AudioUnit m_outputUnit; public: MidiHandler_coreaudio() : m_musicDevice(0), m_outputUnit(0) {} - char * GetName(void) { return "coreaudio"; } + const char * GetName(void) { return "coreaudio"; } bool Open(const char * conf) { int err; AudioUnitConnection auconnect; diff --git a/src/gui/midi_oss.h b/src/gui/midi_oss.h index c4a945ae..b4ae3069 100644 --- a/src/gui/midi_oss.h +++ b/src/gui/midi_oss.h @@ -26,7 +26,7 @@ private: bool isOpen; public: MidiHandler_oss() : MidiHandler(),isOpen(false) {}; - char * GetName(void) { return "oss";}; + const char * GetName(void) { return "oss";}; bool Open(const char * conf) { char devname[512]; if (conf && conf[0]) safe_strncpy(devname,conf,512); diff --git a/src/gui/midi_win32.h b/src/gui/midi_win32.h index 707d4b6b..e4042a49 100644 --- a/src/gui/midi_win32.h +++ b/src/gui/midi_win32.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_win32.h,v 1.13 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: midi_win32.h,v 1.14 2007-06-14 08:23:46 qbix79 Exp $ */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -34,7 +34,7 @@ private: bool isOpen; public: MidiHandler_win32() : isOpen(false),MidiHandler() {}; - char * GetName(void) { return "win32";}; + const char * GetName(void) { return "win32";}; bool Open(const char * conf) { if (isOpen) return false; m_event = CreateEvent (NULL, true, true, NULL); diff --git a/src/gui/render_scalers.cpp b/src/gui/render_scalers.cpp index ad6ae67d..9c45a78d 100644 --- a/src/gui/render_scalers.cpp +++ b/src/gui/render_scalers.cpp @@ -160,188 +160,199 @@ static INLINE void ScalerAddLines( Bitu changed, Bitu count ) { ScalerLineBlock_t ScalerCache = { - Cache_8_8, Cache_8_15, Cache_8_16, Cache_8_32, - 0, Cache_15_15, Cache_15_16, Cache_15_32, - 0, Cache_16_15, Cache_16_16, Cache_16_32, - 0, Cache_32_15, Cache_32_16, Cache_32_32, - Cache_8_8, Cache_9_15, Cache_9_16, Cache_9_32, +{ Cache_8_8, Cache_8_15 , Cache_8_16 , Cache_8_32 }, +{ 0, Cache_15_15, Cache_15_16, Cache_15_32}, +{ 0, Cache_16_15, Cache_16_16, Cache_16_32}, +{ 0, Cache_32_15, Cache_32_16, Cache_32_32}, +{ Cache_8_8, Cache_9_15 , Cache_9_16 , Cache_9_32 } }; ScalerSimpleBlock_t ScaleNormal1x = { "Normal", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, - 1,1, - Normal1x_8_8_L, Normal1x_8_15_L, Normal1x_8_16_L, Normal1x_8_32_L, - 0, Normal1x_15_15_L, Normal1x_15_16_L, Normal1x_15_32_L, - 0, Normal1x_16_15_L, Normal1x_16_16_L, Normal1x_16_32_L, - 0, Normal1x_32_15_L, Normal1x_32_16_L, Normal1x_32_32_L, - Normal1x_8_8_L, Normal1x_9_15_L, Normal1x_9_16_L, Normal1x_9_32_L, - Normal1x_8_8_R, Normal1x_8_15_R, Normal1x_8_16_R, Normal1x_8_32_R, - 0, Normal1x_15_15_R, Normal1x_15_16_R, Normal1x_15_32_R, - 0, Normal1x_16_15_R, Normal1x_16_16_R, Normal1x_16_32_R, - 0, Normal1x_32_15_R, Normal1x_32_16_R, Normal1x_32_32_R, - Normal1x_8_8_R, Normal1x_9_15_R, Normal1x_9_16_R, Normal1x_9_32_R, -}; + 1,1,{ +{ Normal1x_8_8_L, Normal1x_8_15_L , Normal1x_8_16_L , Normal1x_8_32_L }, +{ 0, Normal1x_15_15_L, Normal1x_15_16_L, Normal1x_15_32_L}, +{ 0, Normal1x_16_15_L, Normal1x_16_16_L, Normal1x_16_32_L}, +{ 0, Normal1x_32_15_L, Normal1x_32_16_L, Normal1x_32_32_L}, +{ Normal1x_8_8_L, Normal1x_9_15_L , Normal1x_9_16_L , Normal1x_9_32_L } +},{ +{ Normal1x_8_8_R, Normal1x_8_15_R , Normal1x_8_16_R , Normal1x_8_32_R }, +{ 0, Normal1x_15_15_R, Normal1x_15_16_R, Normal1x_15_32_R}, +{ 0, Normal1x_16_15_R, Normal1x_16_16_R, Normal1x_16_32_R}, +{ 0, Normal1x_32_15_R, Normal1x_32_16_R, Normal1x_32_32_R}, +{ Normal1x_8_8_R, Normal1x_9_15_R , Normal1x_9_16_R , Normal1x_9_32_R } +}}; ScalerSimpleBlock_t ScaleNormalDw = { "Normal", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, - 2,1, - NormalDw_8_8_L, NormalDw_8_15_L, NormalDw_8_16_L, NormalDw_8_32_L, - 0, NormalDw_15_15_L, NormalDw_15_16_L, NormalDw_15_32_L, - 0, NormalDw_16_15_L, NormalDw_16_16_L, NormalDw_16_32_L, - 0, NormalDw_32_15_L, NormalDw_32_16_L, NormalDw_32_32_L, - NormalDw_8_8_L, NormalDw_9_15_L, NormalDw_9_16_L, NormalDw_9_32_L, - NormalDw_8_8_R, NormalDw_8_15_R, NormalDw_8_16_R, NormalDw_8_32_R, - 0, NormalDw_15_15_R, NormalDw_15_16_R, NormalDw_15_32_R, - 0, NormalDw_16_15_R, NormalDw_16_16_R, NormalDw_16_32_R, - 0, NormalDw_32_15_R, NormalDw_32_16_R, NormalDw_32_32_R, - NormalDw_8_8_R, NormalDw_9_15_R, NormalDw_9_16_R, NormalDw_9_32_R, -}; + 2,1,{ +{ NormalDw_8_8_L, NormalDw_8_15_L , NormalDw_8_16_L , NormalDw_8_32_L }, +{ 0, NormalDw_15_15_L, NormalDw_15_16_L, NormalDw_15_32_L}, +{ 0, NormalDw_16_15_L, NormalDw_16_16_L, NormalDw_16_32_L}, +{ 0, NormalDw_32_15_L, NormalDw_32_16_L, NormalDw_32_32_L}, +{ NormalDw_8_8_L, NormalDw_9_15_L , NormalDw_9_16_L , NormalDw_9_32_L } +},{ +{ NormalDw_8_8_R, NormalDw_8_15_R , NormalDw_8_16_R , NormalDw_8_32_R }, +{ 0, NormalDw_15_15_R, NormalDw_15_16_R, NormalDw_15_32_R}, +{ 0, NormalDw_16_15_R, NormalDw_16_16_R, NormalDw_16_32_R}, +{ 0, NormalDw_32_15_R, NormalDw_32_16_R, NormalDw_32_32_R}, +{ NormalDw_8_8_R, NormalDw_9_15_R , NormalDw_9_16_R , NormalDw_9_32_R } +}}; ScalerSimpleBlock_t ScaleNormalDh = { "Normal", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, - 1,2, - NormalDh_8_8_L, NormalDh_8_15_L, NormalDh_8_16_L, NormalDh_8_32_L, - 0, NormalDh_15_15_L, NormalDh_15_16_L, NormalDh_15_32_L, - 0, NormalDh_16_15_L, NormalDh_16_16_L, NormalDh_16_32_L, - 0, NormalDh_32_15_L, NormalDh_32_16_L, NormalDh_32_32_L, - NormalDh_8_8_L, NormalDh_9_15_L, NormalDh_9_16_L, NormalDh_9_32_L, - NormalDh_8_8_R, NormalDh_8_15_R, NormalDh_8_16_R, NormalDh_8_32_R, - 0, NormalDh_15_15_R, NormalDh_15_16_R, NormalDh_15_32_R, - 0, NormalDh_16_15_R, NormalDh_16_16_R, NormalDh_16_32_R, - 0, NormalDh_32_15_R, NormalDh_32_16_R, NormalDh_32_32_R, - NormalDh_8_8_R, NormalDh_9_15_R, NormalDh_9_16_R, NormalDh_9_32_R, -}; + 1,2,{ +{ NormalDh_8_8_L, NormalDh_8_15_L , NormalDh_8_16_L , NormalDh_8_32_L }, +{ 0, NormalDh_15_15_L, NormalDh_15_16_L, NormalDh_15_32_L}, +{ 0, NormalDh_16_15_L, NormalDh_16_16_L, NormalDh_16_32_L}, +{ 0, NormalDh_32_15_L, NormalDh_32_16_L, NormalDh_32_32_L}, +{ NormalDh_8_8_L, NormalDh_9_15_L , NormalDh_9_16_L , NormalDh_9_32_L } +},{ +{ NormalDh_8_8_R, NormalDh_8_15_R , NormalDh_8_16_R , NormalDh_8_32_R }, +{ 0, NormalDh_15_15_R, NormalDh_15_16_R, NormalDh_15_32_R}, +{ 0, NormalDh_16_15_R, NormalDh_16_16_R, NormalDh_16_32_R}, +{ 0, NormalDh_32_15_R, NormalDh_32_16_R, NormalDh_32_32_R}, +{ NormalDh_8_8_R, NormalDh_9_15_R , NormalDh_9_16_R , NormalDh_9_32_R } +}}; ScalerSimpleBlock_t ScaleNormal2x = { "Normal2x", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, - 2,2, - Normal2x_8_8_L, Normal2x_8_15_L, Normal2x_8_16_L, Normal2x_8_32_L, - 0, Normal2x_15_15_L, Normal2x_15_16_L, Normal2x_15_32_L, - 0, Normal2x_16_15_L, Normal2x_16_16_L, Normal2x_16_32_L, - 0, Normal2x_32_15_L, Normal2x_32_16_L, Normal2x_32_32_L, - Normal2x_8_8_L, Normal2x_9_15_L, Normal2x_9_16_L, Normal2x_9_32_L, - Normal2x_8_8_R, Normal2x_8_15_R, Normal2x_8_16_R, Normal2x_8_32_R, - 0, Normal2x_15_15_R, Normal2x_15_16_R, Normal2x_15_32_R, - 0, Normal2x_16_15_R, Normal2x_16_16_R, Normal2x_16_32_R, - 0, Normal2x_32_15_R, Normal2x_32_16_R, Normal2x_32_32_R, - Normal2x_8_8_R, Normal2x_9_15_R, Normal2x_9_16_R, Normal2x_9_32_R, -}; + 2,2,{ +{ Normal2x_8_8_L, Normal2x_8_15_L, Normal2x_8_16_L, Normal2x_8_32_L }, +{ 0, Normal2x_15_15_L, Normal2x_15_16_L, Normal2x_15_32_L}, +{ 0, Normal2x_16_15_L, Normal2x_16_16_L, Normal2x_16_32_L}, +{ 0, Normal2x_32_15_L, Normal2x_32_16_L, Normal2x_32_32_L}, +{ Normal2x_8_8_L, Normal2x_9_15_L , Normal2x_9_16_L, Normal2x_9_32_L } +},{ +{ Normal2x_8_8_R, Normal2x_8_15_R , Normal2x_8_16_R, Normal2x_8_32_R }, +{ 0, Normal2x_15_15_R, Normal2x_15_16_R, Normal2x_15_32_R}, +{ 0, Normal2x_16_15_R, Normal2x_16_16_R, Normal2x_16_32_R}, +{ 0, Normal2x_32_15_R, Normal2x_32_16_R, Normal2x_32_32_R}, +{ Normal2x_8_8_R, Normal2x_9_15_R , Normal2x_9_16_R, Normal2x_9_32_R }, +}}; ScalerSimpleBlock_t ScaleNormal3x = { "Normal3x", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, - 3,3, - Normal3x_8_8_L, Normal3x_8_15_L, Normal3x_8_16_L, Normal3x_8_32_L, - 0, Normal3x_15_15_L, Normal3x_15_16_L, Normal3x_15_32_L, - 0, Normal3x_16_15_L, Normal3x_16_16_L, Normal3x_16_32_L, - 0, Normal3x_32_15_L, Normal3x_32_16_L, Normal3x_32_32_L, - Normal3x_8_8_L, Normal3x_9_15_L, Normal3x_9_16_L, Normal3x_9_32_L, - Normal3x_8_8_R, Normal3x_8_15_R, Normal3x_8_16_R, Normal3x_8_32_R, - 0, Normal3x_15_15_R, Normal3x_15_16_R, Normal3x_15_32_R, - 0, Normal3x_16_15_R, Normal3x_16_16_R, Normal3x_16_32_R, - 0, Normal3x_32_15_R, Normal3x_32_16_R, Normal3x_32_32_R, - Normal3x_8_8_R, Normal3x_9_15_R, Normal3x_9_16_R, Normal3x_9_32_R, -}; + 3,3,{ +{ Normal3x_8_8_L, Normal3x_8_15_L , Normal3x_8_16_L , Normal3x_8_32_L }, +{ 0, Normal3x_15_15_L, Normal3x_15_16_L, Normal3x_15_32_L}, +{ 0, Normal3x_16_15_L, Normal3x_16_16_L, Normal3x_16_32_L}, +{ 0, Normal3x_32_15_L, Normal3x_32_16_L, Normal3x_32_32_L}, +{ Normal3x_8_8_L, Normal3x_9_15_L , Normal3x_9_16_L , Normal3x_9_32_L } +},{ +{ Normal3x_8_8_R, Normal3x_8_15_R , Normal3x_8_16_R , Normal3x_8_32_R }, +{ 0, Normal3x_15_15_R, Normal3x_15_16_R, Normal3x_15_32_R}, +{ 0, Normal3x_16_15_R, Normal3x_16_16_R, Normal3x_16_32_R}, +{ 0, Normal3x_32_15_R, Normal3x_32_16_R, Normal3x_32_32_R}, +{ Normal3x_8_8_R, Normal3x_9_15_R , Normal3x_9_16_R , Normal3x_9_32_R } +}}; ScalerSimpleBlock_t ScaleTV2x = { "TV2x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 2,2, - 0, TV2x_8_15_L, TV2x_8_16_L, TV2x_8_32_L, - 0, TV2x_15_15_L, TV2x_15_16_L, TV2x_15_32_L, - 0, TV2x_16_15_L, TV2x_16_16_L, TV2x_16_32_L, - 0, TV2x_32_15_L, TV2x_32_16_L, TV2x_32_32_L, - 0, TV2x_9_15_L, TV2x_9_16_L, TV2x_9_32_L, - 0, TV2x_8_15_R, TV2x_8_16_R, TV2x_8_32_R, - 0, TV2x_15_15_R, TV2x_15_16_R, TV2x_15_32_R, - 0, TV2x_16_15_R, TV2x_16_16_R, TV2x_16_32_R, - 0, TV2x_32_15_R, TV2x_32_16_R, TV2x_32_32_R, - 0, TV2x_9_15_R, TV2x_9_16_R, TV2x_9_32_R, -}; + 2,2,{ +{ 0, TV2x_8_15_L , TV2x_8_16_L , TV2x_8_32_L }, +{ 0, TV2x_15_15_L, TV2x_15_16_L, TV2x_15_32_L}, +{ 0, TV2x_16_15_L, TV2x_16_16_L, TV2x_16_32_L}, +{ 0, TV2x_32_15_L, TV2x_32_16_L, TV2x_32_32_L}, +{ 0, TV2x_9_15_L , TV2x_9_16_L , TV2x_9_32_L } +},{ +{ 0, TV2x_8_15_R , TV2x_8_16_R , TV2x_8_32_R }, +{ 0, TV2x_15_15_R, TV2x_15_16_R, TV2x_15_32_R}, +{ 0, TV2x_16_15_R, TV2x_16_16_R, TV2x_16_32_R}, +{ 0, TV2x_32_15_R, TV2x_32_16_R, TV2x_32_32_R}, +{ 0, TV2x_9_15_R , TV2x_9_16_R , TV2x_9_32_R } +}}; ScalerSimpleBlock_t ScaleTV3x = { "TV3x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 3,3, - 0, TV3x_8_15_L, TV3x_8_16_L, TV3x_8_32_L, - 0, TV3x_15_15_L, TV3x_15_16_L, TV3x_15_32_L, - 0, TV3x_16_15_L, TV3x_16_16_L, TV3x_16_32_L, - 0, TV3x_32_15_L, TV3x_32_16_L, TV3x_32_32_L, - 0, TV3x_9_15_L, TV3x_9_16_L, TV3x_9_32_L, - 0, TV3x_8_15_R, TV3x_8_16_R, TV3x_8_32_R, - 0, TV3x_15_15_R, TV3x_15_16_R, TV3x_15_32_R, - 0, TV3x_16_15_R, TV3x_16_16_R, TV3x_16_32_R, - 0, TV3x_32_15_R, TV3x_32_16_R, TV3x_32_32_R, - 0, TV3x_9_15_R, TV3x_9_16_R, TV3x_9_32_R, -}; + 3,3,{ +{ 0, TV3x_8_15_L , TV3x_8_16_L , TV3x_8_32_L }, +{ 0, TV3x_15_15_L, TV3x_15_16_L, TV3x_15_32_L}, +{ 0, TV3x_16_15_L, TV3x_16_16_L, TV3x_16_32_L}, +{ 0, TV3x_32_15_L, TV3x_32_16_L, TV3x_32_32_L}, +{ 0, TV3x_9_15_L , TV3x_9_16_L , TV3x_9_32_L } +},{ +{ 0, TV3x_8_15_R , TV3x_8_16_R , TV3x_8_32_R }, +{ 0, TV3x_15_15_R, TV3x_15_16_R, TV3x_15_32_R}, +{ 0, TV3x_16_15_R, TV3x_16_16_R, TV3x_16_32_R}, +{ 0, TV3x_32_15_R, TV3x_32_16_R, TV3x_32_32_R}, +{ 0, TV3x_9_15_R , TV3x_9_16_R , TV3x_9_32_R } +}}; ScalerSimpleBlock_t ScaleScan2x = { "Scan2x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 2,2, - 0, Scan2x_8_15_L, Scan2x_8_16_L, Scan2x_8_32_L, - 0, Scan2x_15_15_L, Scan2x_15_16_L, Scan2x_15_32_L, - 0, Scan2x_16_15_L, Scan2x_16_16_L, Scan2x_16_32_L, - 0, Scan2x_32_15_L, Scan2x_32_16_L, Scan2x_32_32_L, - 0, Scan2x_9_15_L, Scan2x_9_16_L, Scan2x_9_32_L, - 0, Scan2x_8_15_R, Scan2x_8_16_R, Scan2x_8_32_R, - 0, Scan2x_15_15_R, Scan2x_15_16_R, Scan2x_15_32_R, - 0, Scan2x_16_15_R, Scan2x_16_16_R, Scan2x_16_32_R, - 0, Scan2x_32_15_R, Scan2x_32_16_R, Scan2x_32_32_R, - 0, Scan2x_9_15_R, Scan2x_9_16_R, Scan2x_9_32_R, -}; + 2,2,{ +{ 0, Scan2x_8_15_L , Scan2x_8_16_L , Scan2x_8_32_L }, +{ 0, Scan2x_15_15_L, Scan2x_15_16_L, Scan2x_15_32_L}, +{ 0, Scan2x_16_15_L, Scan2x_16_16_L, Scan2x_16_32_L}, +{ 0, Scan2x_32_15_L, Scan2x_32_16_L, Scan2x_32_32_L}, +{ 0, Scan2x_9_15_L , Scan2x_9_16_L , Scan2x_9_32_L } +},{ +{ 0, Scan2x_8_15_R , Scan2x_8_16_R , Scan2x_8_32_R }, +{ 0, Scan2x_15_15_R, Scan2x_15_16_R, Scan2x_15_32_R}, +{ 0, Scan2x_16_15_R, Scan2x_16_16_R, Scan2x_16_32_R}, +{ 0, Scan2x_32_15_R, Scan2x_32_16_R, Scan2x_32_32_R}, +{ 0, Scan2x_9_15_R , Scan2x_9_16_R , Scan2x_9_32_R } +}}; ScalerSimpleBlock_t ScaleScan3x = { "Scan3x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 3,3, - 0, Scan3x_8_15_L, Scan3x_8_16_L, Scan3x_8_32_L, - 0, Scan3x_15_15_L, Scan3x_15_16_L, Scan3x_15_32_L, - 0, Scan3x_16_15_L, Scan3x_16_16_L, Scan3x_16_32_L, - 0, Scan3x_32_15_L, Scan3x_32_16_L, Scan3x_32_32_L, - 0, Scan3x_9_15_L, Scan3x_9_16_L, Scan3x_9_32_L, - 0, Scan3x_8_15_R, Scan3x_8_16_R, Scan3x_8_32_R, - 0, Scan3x_15_15_R, Scan3x_15_16_R, Scan3x_15_32_R, - 0, Scan3x_16_15_R, Scan3x_16_16_R, Scan3x_16_32_R, - 0, Scan3x_32_15_R, Scan3x_32_16_R, Scan3x_32_32_R, - 0, Scan3x_9_15_R, Scan3x_9_16_R, Scan3x_9_32_R, -}; + 3,3,{ +{ 0, Scan3x_8_15_L , Scan3x_8_16_L , Scan3x_8_32_L }, +{ 0, Scan3x_15_15_L, Scan3x_15_16_L, Scan3x_15_32_L}, +{ 0, Scan3x_16_15_L, Scan3x_16_16_L, Scan3x_16_32_L}, +{ 0, Scan3x_32_15_L, Scan3x_32_16_L, Scan3x_32_32_L}, +{ 0, Scan3x_9_15_L , Scan3x_9_16_L , Scan3x_9_32_L }, +},{ +{ 0, Scan3x_8_15_R , Scan3x_8_16_R , Scan3x_8_32_R }, +{ 0, Scan3x_15_15_R, Scan3x_15_16_R, Scan3x_15_32_R}, +{ 0, Scan3x_16_15_R, Scan3x_16_16_R, Scan3x_16_32_R}, +{ 0, Scan3x_32_15_R, Scan3x_32_16_R, Scan3x_32_32_R}, +{ 0, Scan3x_9_15_R , Scan3x_9_16_R , Scan3x_9_32_R } +}}; ScalerSimpleBlock_t ScaleRGB2x = { "RGB2x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 2,2, - 0, RGB2x_8_15_L, RGB2x_8_16_L, RGB2x_8_32_L, - 0, RGB2x_15_15_L, RGB2x_15_16_L, RGB2x_15_32_L, - 0, RGB2x_16_15_L, RGB2x_16_16_L, RGB2x_16_32_L, - 0, RGB2x_32_15_L, RGB2x_32_16_L, RGB2x_32_32_L, - 0, RGB2x_9_15_L, RGB2x_9_16_L, RGB2x_9_32_L, - 0, RGB2x_8_15_R, RGB2x_8_16_R, RGB2x_8_32_R, - 0, RGB2x_15_15_R, RGB2x_15_16_R, RGB2x_15_32_R, - 0, RGB2x_16_15_R, RGB2x_16_16_R, RGB2x_16_32_R, - 0, RGB2x_32_15_R, RGB2x_32_16_R, RGB2x_32_32_R, - 0, RGB2x_9_15_R, RGB2x_9_16_R, RGB2x_9_32_R, -}; + 2,2,{ +{ 0, RGB2x_8_15_L , RGB2x_8_16_L , RGB2x_8_32_L }, +{ 0, RGB2x_15_15_L, RGB2x_15_16_L, RGB2x_15_32_L}, +{ 0, RGB2x_16_15_L, RGB2x_16_16_L, RGB2x_16_32_L}, +{ 0, RGB2x_32_15_L, RGB2x_32_16_L, RGB2x_32_32_L}, +{ 0, RGB2x_9_15_L , RGB2x_9_16_L , RGB2x_9_32_L } +},{ +{ 0, RGB2x_8_15_R , RGB2x_8_16_R , RGB2x_8_32_R }, +{ 0, RGB2x_15_15_R, RGB2x_15_16_R, RGB2x_15_32_R}, +{ 0, RGB2x_16_15_R, RGB2x_16_16_R, RGB2x_16_32_R}, +{ 0, RGB2x_32_15_R, RGB2x_32_16_R, RGB2x_32_32_R}, +{ 0, RGB2x_9_15_R , RGB2x_9_16_R , RGB2x_9_32_R } +}}; ScalerSimpleBlock_t ScaleRGB3x = { "RGB3x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, - 3,3, - 0, RGB3x_8_15_L, RGB3x_8_16_L, RGB3x_8_32_L, - 0, RGB3x_15_15_L, RGB3x_15_16_L, RGB3x_15_32_L, - 0, RGB3x_16_15_L, RGB3x_16_16_L, RGB3x_16_32_L, - 0, RGB3x_32_15_L, RGB3x_32_16_L, RGB3x_32_32_L, - 0, RGB3x_9_15_L, RGB3x_9_16_L, RGB3x_9_32_L, - 0, RGB3x_8_15_R, RGB3x_8_16_R, RGB3x_8_32_R, - 0, RGB3x_15_15_R, RGB3x_15_16_R, RGB3x_15_32_R, - 0, RGB3x_16_15_R, RGB3x_16_16_R, RGB3x_16_32_R, - 0, RGB3x_32_15_R, RGB3x_32_16_R, RGB3x_32_32_R, - 0, RGB3x_9_15_R, RGB3x_9_16_R, RGB3x_9_32_R, -}; + 3,3,{ +{ 0, RGB3x_8_15_L , RGB3x_8_16_L , RGB3x_8_32_L }, +{ 0, RGB3x_15_15_L, RGB3x_15_16_L, RGB3x_15_32_L}, +{ 0, RGB3x_16_15_L, RGB3x_16_16_L, RGB3x_16_32_L}, +{ 0, RGB3x_32_15_L, RGB3x_32_16_L, RGB3x_32_32_L}, +{ 0, RGB3x_9_15_L , RGB3x_9_16_L , RGB3x_9_32_L } +},{ +{ 0, RGB3x_8_15_R , RGB3x_8_16_R , RGB3x_8_32_R }, +{ 0, RGB3x_15_15_R, RGB3x_15_16_R, RGB3x_15_32_R}, +{ 0, RGB3x_16_15_R, RGB3x_16_16_R, RGB3x_16_32_R}, +{ 0, RGB3x_32_15_R, RGB3x_32_16_R, RGB3x_32_32_R}, +{ 0, RGB3x_9_15_R , RGB3x_9_16_R , RGB3x_9_32_R } +}}; /* Complex scalers */ @@ -350,16 +361,16 @@ ScalerComplexBlock_t ScaleAdvMame2x ={ "AdvMame2x", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, 2,2, - AdvMame2x_8_L,AdvMame2x_16_L,AdvMame2x_16_L,AdvMame2x_32_L, - AdvMame2x_8_R,AdvMame2x_16_R,AdvMame2x_16_R,AdvMame2x_32_R +{ AdvMame2x_8_L,AdvMame2x_16_L,AdvMame2x_16_L,AdvMame2x_32_L}, +{ AdvMame2x_8_R,AdvMame2x_16_R,AdvMame2x_16_R,AdvMame2x_32_R} }; ScalerComplexBlock_t ScaleAdvMame3x = { "AdvMame3x", GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, 3,3, - AdvMame3x_8_L,AdvMame3x_16_L,AdvMame3x_16_L,AdvMame3x_32_L, - AdvMame3x_8_R,AdvMame3x_16_R,AdvMame3x_16_R,AdvMame3x_32_R +{ AdvMame3x_8_L,AdvMame3x_16_L,AdvMame3x_16_L,AdvMame3x_32_L}, +{ AdvMame3x_8_R,AdvMame3x_16_R,AdvMame3x_16_R,AdvMame3x_32_R} }; /* These need specific 15bpp versions */ @@ -367,56 +378,56 @@ ScalerComplexBlock_t ScaleHQ2x ={ "HQ2x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 2,2, - 0,HQ2x_16_L,HQ2x_16_L,HQ2x_32_L, - 0,HQ2x_16_R,HQ2x_16_R,HQ2x_32_R +{ 0,HQ2x_16_L,HQ2x_16_L,HQ2x_32_L}, +{ 0,HQ2x_16_R,HQ2x_16_R,HQ2x_32_R} }; ScalerComplexBlock_t ScaleHQ3x ={ "HQ3x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 3,3, - 0,HQ3x_16_L,HQ3x_16_L,HQ3x_32_L, - 0,HQ3x_16_R,HQ3x_16_R,HQ3x_32_R +{ 0,HQ3x_16_L,HQ3x_16_L,HQ3x_32_L}, +{ 0,HQ3x_16_R,HQ3x_16_R,HQ3x_32_R} }; ScalerComplexBlock_t ScaleSuper2xSaI ={ "Super2xSaI", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 2,2, - 0,Super2xSaI_16_L,Super2xSaI_16_L,Super2xSaI_32_L, - 0,Super2xSaI_16_R,Super2xSaI_16_R,Super2xSaI_32_R +{ 0,Super2xSaI_16_L,Super2xSaI_16_L,Super2xSaI_32_L}, +{ 0,Super2xSaI_16_R,Super2xSaI_16_R,Super2xSaI_32_R} }; ScalerComplexBlock_t Scale2xSaI ={ "2xSaI", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 2,2, - 0,_2xSaI_16_L,_2xSaI_16_L,_2xSaI_32_L, - 0,_2xSaI_16_R,_2xSaI_16_R,_2xSaI_32_R +{ 0,_2xSaI_16_L,_2xSaI_16_L,_2xSaI_32_L}, +{ 0,_2xSaI_16_R,_2xSaI_16_R,_2xSaI_32_R} }; ScalerComplexBlock_t ScaleSuperEagle ={ "SuperEagle", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 2,2, - 0,SuperEagle_16_L,SuperEagle_16_L,SuperEagle_32_L, - 0,SuperEagle_16_R,SuperEagle_16_R,SuperEagle_32_R +{ 0,SuperEagle_16_L,SuperEagle_16_L,SuperEagle_32_L}, +{ 0,SuperEagle_16_R,SuperEagle_16_R,SuperEagle_32_R} }; ScalerComplexBlock_t ScaleAdvInterp2x = { "AdvInterp2x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 2,2, - 0,AdvInterp2x_15_L,AdvInterp2x_16_L,AdvInterp2x_32_L, - 0,AdvInterp2x_15_R,AdvInterp2x_16_R,AdvInterp2x_32_R +{ 0,AdvInterp2x_15_L,AdvInterp2x_16_L,AdvInterp2x_32_L}, +{ 0,AdvInterp2x_15_R,AdvInterp2x_16_R,AdvInterp2x_32_R} }; ScalerComplexBlock_t ScaleAdvInterp3x = { "AdvInterp3x", GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, 3,3, - 0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L, - 0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R +{ 0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L}, +{ 0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R} }; diff --git a/src/gui/render_scalers.h b/src/gui/render_scalers.h index 9fe6691d..3f2b34db 100644 --- a/src/gui/render_scalers.h +++ b/src/gui/render_scalers.h @@ -71,7 +71,7 @@ extern scalerChangeCache_t scalerChangeCache; typedef ScalerLineHandler_t ScalerLineBlock_t[5][4]; typedef struct { - char *name; + const char *name; Bitu gfxFlags; Bitu xscale,yscale; ScalerComplexHandler_t Linear[4]; @@ -79,7 +79,7 @@ typedef struct { } ScalerComplexBlock_t; typedef struct { - char *name; + const char *name; Bitu gfxFlags; Bitu xscale,yscale; ScalerLineBlock_t Linear; diff --git a/src/hardware/memory.cpp b/src/hardware/memory.cpp index fd93ff00..64c0743c 100644 --- a/src/hardware/memory.cpp +++ b/src/hardware/memory.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: memory.cpp,v 1.49 2007-06-12 19:17:43 qbix79 Exp $ */ +/* $Id: memory.cpp,v 1.50 2007-06-14 08:23:46 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -157,14 +157,14 @@ void mem_memcpy(PhysPt dest,PhysPt src,Bitu size) { } void MEM_BlockRead(PhysPt pt,void * data,Bitu size) { - Bit8u * write=(Bit8u *) data; + Bit8u * write=reinterpret_cast(data); while (size--) { *write++=mem_readb_inline(pt++); } } -void MEM_BlockWrite(PhysPt pt,void * data,Bitu size) { - Bit8u * read=(Bit8u *) data; +void MEM_BlockWrite(PhysPt pt,void const * const data,Bitu size) { + Bit8u const * read = reinterpret_cast(data); while (size--) { mem_writeb_inline(pt++,*read++); } diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index e1a2fb47..ff705b00 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sblaster.cpp,v 1.63 2007-02-24 21:07:22 c2woody Exp $ */ +/* $Id: sblaster.cpp,v 1.64 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -158,7 +158,7 @@ struct SB_INFO { static SB_INFO sb; -static char * copyright_string="COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; +static char const * const copyright_string="COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; static Bit8u DSP_cmd_len[256] = { // 0,0,0,0, 1,2,0,0, 0,0,0,0, 0,0,2,1, // 0x00 for SB16. but breaks sbpro @@ -534,7 +534,7 @@ static void DSP_RaiseIRQEvent(Bitu val) { } static void DSP_DoDMATransfer(DMA_MODES mode,Bitu freq,bool stereo) { - char * type; + char const * type; sb.mode=MODE_DMA_MASKED; sb.chan->FillUp(); sb.dma.left=sb.dma.total; @@ -847,7 +847,7 @@ static void DSP_DoCommand(void) { case 0xe3: /* DSP Copyright */ { DSP_FlushData(); - for (Bit32u i=0;i<=strlen(copyright_string);i++) { + for (size_t i=0;i<=strlen(copyright_string);i++) { DSP_AddData(copyright_string[i]); } } diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index 9dbc928c..139f44e9 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.cpp,v 1.38 2007-01-08 19:45:41 qbix79 Exp $ */ +/* $Id: setup.cpp,v 1.39 2007-06-14 08:23:46 qbix79 Exp $ */ #include "dosbox.h" #include "cross.h" @@ -252,6 +252,14 @@ void Config::Init() { (*tel)->ExecuteInit(); } } +void Section::AddInitFunction(SectionFunction func,bool canchange) { + initfunctions.push_back(Function_wrapper(func,canchange)); +} + +void Section::AddDestroyFunction(SectionFunction func,bool canchange) { + destroyfunctions.push_front(Function_wrapper(func,canchange)); +} + void Section::ExecuteInit(bool initall) { typedef std::list::iterator func_it; diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 417d1d32..2eccad01 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.cpp,v 1.84 2007-02-22 08:34:10 qbix79 Exp $ */ +/* $Id: shell.cpp,v 1.85 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -420,10 +420,10 @@ void AUTOEXEC_Init(Section * sec) { test = new AUTOEXEC(sec); } -static char * path_string="PATH=Z:\\"; -static char * comspec_string="COMSPEC=Z:\\COMMAND.COM"; -static char * full_name="Z:\\COMMAND.COM"; -static char * init_line="/INIT AUTOEXEC.BAT"; +static char const * const path_string="PATH=Z:\\"; +static char const * const comspec_string="COMSPEC=Z:\\COMMAND.COM"; +static char const * const full_name="Z:\\COMMAND.COM"; +static char const * const init_line="/INIT AUTOEXEC.BAT"; void SHELL_Init() { /* Add messages */ diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index afd882ea..14fd0ad8 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_cmds.cpp,v 1.75 2007-06-12 20:22:09 c2woody Exp $ */ +/* $Id: shell_cmds.cpp,v 1.76 2007-06-14 08:23:46 qbix79 Exp $ */ #include #include @@ -62,18 +62,22 @@ static SHELL_Cmd cmd_list[]={ { "PATH", 1, &DOS_Shell::CMD_PATH, "SHELL_CMD_PATH_HELP"}, { "VER", 0, &DOS_Shell::CMD_VER, "SHELL_CMD_VER_HELP"}, {0,0,0,0} -}; -bool DOS_Shell::CheckConfig(char* cmd,char*line) { - Section* test = control->GetSectionFromProperty(cmd); +}; + +static char empty_char = 0; +static char* empty_string = &empty_char; + +bool DOS_Shell::CheckConfig(char* cmd_in,char*line) { + Section* test = control->GetSectionFromProperty(cmd_in); if(!test) return false; if(line && !line[0]) { - char const* val = test->GetPropValue(cmd); + char const* val = test->GetPropValue(cmd_in); if(val) WriteOut("%s\n",val); return true; } char newcom[1024]; newcom[0] = 0; strcpy(newcom,"z:\\config "); strcat(newcom,test->GetName()); strcat(newcom," "); - strcat(newcom,cmd);strcat(newcom,line); + strcat(newcom,cmd_in);strcat(newcom,line); DoCommand(newcom); return true; } @@ -81,8 +85,8 @@ bool DOS_Shell::CheckConfig(char* cmd,char*line) { void DOS_Shell::DoCommand(char * line) { /* First split the line into command and arguments */ line=trim(line); - char cmd[CMD_MAXLINE]; - char * cmd_write=cmd; + char cmd_buffer[CMD_MAXLINE]; + char * cmd_write=cmd_buffer; while (*line) { if (*line==32) break; if (*line=='/') break; @@ -92,7 +96,7 @@ void DOS_Shell::DoCommand(char * line) { *cmd_write=0; Bit32u cmd_index=0; while (cmd_list[cmd_index].name) { - if (strcasecmp(cmd_list[cmd_index].name,cmd)==0) { + if (strcasecmp(cmd_list[cmd_index].name,cmd_buffer)==0) { (this->*(cmd_list[cmd_index].handler))(line); return; } @@ -102,20 +106,20 @@ void DOS_Shell::DoCommand(char * line) { *cmd_write++=*line++; } *cmd_write=0; - if (strlen(cmd)==0) return; + if (strlen(cmd_buffer)==0) return; /* Check the internal list */ Bit32u cmd_index=0; while (cmd_list[cmd_index].name) { - if (strcasecmp(cmd_list[cmd_index].name,cmd)==0) { + if (strcasecmp(cmd_list[cmd_index].name,cmd_buffer)==0) { (this->*(cmd_list[cmd_index].handler))(line); return; } cmd_index++; } /* This isn't an internal command execute it */ - if(Execute(cmd,line)) return; - if(CheckConfig(cmd,line)) return; - WriteOut(MSG_Get("SHELL_EXECUTE_ILLEGAL_COMMAND"),cmd); + if(Execute(cmd_buffer,line)) return; + if(CheckConfig(cmd_buffer,line)) return; + WriteOut(MSG_Get("SHELL_EXECUTE_ILLEGAL_COMMAND"),cmd_buffer); } #define HELP(command) \ @@ -183,7 +187,7 @@ void DOS_Shell::CMD_HELP(char * args){ while (cmd_list[cmd_index].name) { if (optall || !cmd_list[cmd_index].flags) { WriteOut("<\033[34;1m%-8s\033[0m> %s",cmd_list[cmd_index].name,MSG_Get(cmd_list[cmd_index].help)); - if(!(++write_count%22)) CMD_PAUSE(""); + if(!(++write_count%22)) CMD_PAUSE(empty_string); } cmd_index++; } @@ -198,8 +202,9 @@ void DOS_Shell::CMD_RENAME(char * args){ char* slash = strrchr(arg1,'\\'); if(slash) { slash++; - //If directory specified (crystal caves installer) - // rename from c:\X : rename c:\abc.exe abc.shr. File must appear in C:\ + /* If directory specified (crystal caves installer) + * rename from c:\X : rename c:\abc.exe abc.shr. + * File must appear in C:\ */ char dir_source[DOS_PATHLENGTH]={0}; //Copy first and then modify, makes GCC happy @@ -331,7 +336,7 @@ void DOS_Shell::CMD_DIR(char * args) { } bool optW=ScanCMDBool(args,"W"); - bool optS=ScanCMDBool(args,"S"); + ScanCMDBool(args,"S"); bool optP=ScanCMDBool(args,"P"); bool optAD=ScanCMDBool(args,"AD"); char * rem=ScanCMDRemain(args); @@ -398,12 +403,12 @@ void DOS_Shell::CMD_DIR(char * args) { /* Skip non-directories if option AD is present */ if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue; - - char * ext=""; + + char * ext = empty_string; if (!optW && (name[0] != '.')) { ext = strrchr(name, '.'); - if (!ext) ext = ""; - else *ext++ = '\0'; + if (!ext) ext = empty_string; + else *ext++ = 0; } Bit8u day = (Bit8u)(date & 0x001f); Bit8u month = (Bit8u)((date >> 5) & 0x000f); @@ -435,7 +440,7 @@ void DOS_Shell::CMD_DIR(char * args) { } if(optP) { if(!(++p_count%(22*w_size))) { - CMD_PAUSE(""); + CMD_PAUSE(empty_string); } } } while ( (ret=DOS_FindNext()) );