diff --git a/include/dos_system.h b/include/dos_system.h index 97933ff7..9269a416 100644 --- a/include/dos_system.h +++ b/include/dos_system.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_system.h,v 1.42 2008-04-16 19:31:05 qbix79 Exp $ */ +/* $Id: dos_system.h,v 1.43 2008-08-06 18:31:10 c2woody Exp $ */ #ifndef DOSBOX_DOS_SYSTEM_H #define DOSBOX_DOS_SYSTEM_H @@ -130,7 +130,7 @@ public: DOS_Drive_Cache (const char* path); ~DOS_Drive_Cache (void); - typedef enum TDirSort { NOSORT, ALPHABETICAL, DIRALPHABETICAL, ALPHABETICALREV, DIRALPHABETICALREV }; + enum TDirSort { NOSORT, ALPHABETICAL, DIRALPHABETICAL, ALPHABETICALREV, DIRALPHABETICALREV }; void SetBaseDir (const char* path); void SetDirSort (TDirSort sort) { sortDirType = sort; }; diff --git a/include/setup.h b/include/setup.h index a8fbffda..8e9d4a8a 100644 --- a/include/setup.h +++ b/include/setup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.h,v 1.37 2008-06-13 08:55:04 qbix79 Exp $ */ +/* $Id: setup.h,v 1.38 2008-08-06 18:31:10 c2woody Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H @@ -79,16 +79,16 @@ public: enum Etype { V_NONE, V_HEX, V_BOOL, V_INT, V_STRING, V_DOUBLE,V_CURRENT} type; /* Constructors */ - Value() :type(V_NONE),_string(0) { }; - Value(Hex in) :type(V_HEX), _hex(in) { }; - Value(int in) :type(V_INT), _int(in) { }; - Value(bool in) :type(V_BOOL), _bool(in) { }; - Value(double in) :type(V_DOUBLE), _double(in) { }; - Value(std::string const& in) :type(V_STRING), _string(new std::string(in)) { }; - Value(char const * const in) :type(V_STRING), _string(new std::string(in)) { }; + Value() :_string(0), type(V_NONE) { }; + Value(Hex in) :_hex(in), type(V_HEX) { }; + Value(int in) :_int(in), type(V_INT) { }; + Value(bool in) :_bool(in), type(V_BOOL) { }; + Value(double in) :_double(in), type(V_DOUBLE) { }; + Value(std::string const& in) :_string(new std::string(in)),type(V_STRING) { }; + Value(char const * const in) :_string(new std::string(in)),type(V_STRING) { }; Value(Value const& in):_string(0) {plaincopy(in);} ~Value() { destroy();}; - Value(std::string const& in,Etype _t) :type(V_NONE),_string(0){SetValue(in,_t);} + Value(std::string const& in,Etype _t) :_string(0),type(V_NONE) {SetValue(in,_t);} /* Assigment operators */ Value& operator= (Hex in) throw(WrongType) { return copy(Value(in));} diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index b091c384..76bf4395 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_x86.h,v 1.30 2008-05-18 13:11:14 c2woody Exp $ */ +/* $Id: risc_x86.h,v 1.31 2008-08-06 18:31:26 c2woody Exp $ */ static void gen_init(void); @@ -752,8 +752,10 @@ static void gen_call_function(void * func,char const* ops,...) { if (ops) { va_list params; va_start(params,ops); +#if defined (MACOSX) Bitu stack_used=0; bool free_flags=false; +#endif Bits pindex=0; while (*ops) { if (*ops=='%') { diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index 0ed6800f..3c45e182 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.cpp,v 1.112 2008-05-21 21:29:32 c2woody Exp $ */ +/* $Id: cpu.cpp,v 1.113 2008-08-06 18:31:26 c2woody Exp $ */ #include #include @@ -379,6 +379,14 @@ bool CPU_SwitchTask(Bitu new_tss_selector,TSwitchType tstype,Bitu old_eip) { new_ldt=mem_readw(new_tss.base+offsetof(TSS_32,ldt)); } else { E_Exit("286 task switch"); + new_cr3=0; + new_eip=0; + new_eflags=0; + new_eax=0; new_ecx=0; new_edx=0; new_ebx=0; + new_esp=0; new_ebp=0; new_edi=0; new_esi=0; + + new_es=0; new_cs=0; new_ss=0; new_ds=0; new_fs=0; new_gs=0; + new_ldt=0; } /* Check if we need to clear busy bit of old TASK */ @@ -498,7 +506,9 @@ doconforming: CPU_SetSegGeneral(ds,new_ds); CPU_SetSegGeneral(fs,new_fs); CPU_SetSegGeneral(gs,new_gs); - if (!cpu_tss.SetSelector(new_tss_selector)) LOG(LOG_CPU,LOG_NORMAL)("TaskSwitch: set tss selector %X failed",new_tss_selector); + if (!cpu_tss.SetSelector(new_tss_selector)) { + LOG(LOG_CPU,LOG_NORMAL)("TaskSwitch: set tss selector %X failed",new_tss_selector); + } // cpu_tss.desc.SetBusy(true); // cpu_tss.SaveSelector(); // LOG_MSG("Task CPL %X CS:%X IP:%X SS:%X SP:%X eflags %x",cpu.cpl,SegValue(cs),reg_eip,SegValue(ss),reg_esp,reg_flags); @@ -717,8 +727,9 @@ do_interrupt: cpu.code.big=cs_desc.Big()>0; reg_eip=gate_off; - if (!(gate.Type()&1)) + if (!(gate.Type()&1)) { SETFLAGBIT(IF,false); + } SETFLAGBIT(TF,false); SETFLAGBIT(NT,false); SETFLAGBIT(VM,false); @@ -799,7 +810,9 @@ void CPU_IRET(bool use32,Bitu oldeip) { CPU_CHECK_COND(!cpu_tss.IsValid(), "TASK Iret without valid TSS", EXCEPTION_TS,cpu_tss.selector & 0xfffc) - if (!cpu_tss.desc.IsBusy()) LOG(LOG_CPU,LOG_ERROR)("TASK Iret:TSS not busy"); + if (!cpu_tss.desc.IsBusy()) { + LOG(LOG_CPU,LOG_ERROR)("TASK Iret:TSS not busy"); + } Bitu back_link=cpu_tss.Get_back(); CPU_SwitchTask(back_link,TSwitch_IRET,oldeip); return; @@ -1129,7 +1142,6 @@ call_code: CPU_CHECK_COND(n_cs_dpl>cpu.cpl, "CALL:Gate:CS DPL>CPL", EXCEPTION_GP,n_cs_sel & 0xfffc) - Bitu n_cs_rpl = n_cs_sel & 3; Bitu n_eip = call.GetOffset(); switch (n_cs_desc.Type()) { case DESC_CODE_N_NC_A:case DESC_CODE_N_NC_NA: @@ -2140,8 +2152,8 @@ public: Change_Config(configuration); return; } +// Section_prop * section=static_cast(configuration); inited=true; - Section_prop * section=static_cast(configuration); reg_eax=0; reg_ebx=0; reg_ecx=0; diff --git a/src/dos/cdrom_aspi_win32.cpp b/src/dos/cdrom_aspi_win32.cpp index 1da3ba23..4f389461 100644 --- a/src/dos/cdrom_aspi_win32.cpp +++ b/src/dos/cdrom_aspi_win32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_aspi_win32.cpp,v 1.18 2007-06-12 20:22:07 c2woody Exp $ */ +/* $Id: cdrom_aspi_win32.cpp,v 1.19 2008-08-06 18:32:34 c2woody Exp $ */ #if defined (WIN32) @@ -158,19 +158,23 @@ bool CDROM_Interface_Aspi::ScanRegistryFindKey(HKEY& hKeyBase) // Open Key... newKeyResult = RegOpenKeyEx (hKeyBase,subKey,0,KEY_READ,&hNewKey); if (newKeyResult==ERROR_SUCCESS) { - if (GetRegistryValue(hNewKey,"CurrentDriveLetterAssignment",buffer,256)) { + static const char drive_letter_assignment[] = "CurrentDriveLetterAssignment"; + if (GetRegistryValue(hNewKey,(char*)&drive_letter_assignment,buffer,256)) { LOG(LOG_MISC,LOG_NORMAL)("SCSI: Drive Letter found: %s",buffer); // aha, something suspicious... if (buffer[0]==letter) { char hardwareID[256]; // found it... lets see if we can get the scsi values - bool v1 = GetRegistryValue(hNewKey,"SCSILUN",buffer,256); + static const char SCSI_LUN[] = "SCSILUN"; + bool v1 = GetRegistryValue(hNewKey,(char*)SCSI_LUN,buffer,256); LOG(LOG_MISC,LOG_NORMAL)("SCSI: SCSILUN found: %s",buffer); lun = buffer[0]-'0'; - bool v2 = GetRegistryValue(hNewKey,"SCSITargetID",buffer,256); + static const char SCSI_TargetID[] = "SCSITargetID"; + bool v2 = GetRegistryValue(hNewKey,(char*)SCSI_TargetID,buffer,256); LOG(LOG_MISC,LOG_NORMAL)("SCSI: SCSITargetID found: %s",buffer); target = buffer[0]-'0'; - bool v3 = GetRegistryValue(hNewKey,"HardwareID",hardwareID,256); + static const char Hardware_ID[] = "HardwareID"; + bool v3 = GetRegistryValue(hNewKey,(char*)Hardware_ID,hardwareID,256); RegCloseKey(hNewKey); if (v1 && v2 && v3) { haId = GetHostAdapter(hardwareID); diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index cba56eb6..f5651495 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.97 2008-05-28 09:53:31 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.98 2008-08-06 18:32:34 c2woody Exp $ */ #include #include @@ -123,7 +123,7 @@ bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive) { continue; } - Bit32s iDown, cDots; + Bit32s iDown; bool dots = true; Bit32s templen=(Bit32s)strlen(tempdir); for(iDown=0;(iDown < templen) && dots;iDown++) @@ -131,13 +131,10 @@ bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive) { dots = false; // only dots? - cDots = templen - 1; - if(dots && (cDots > 0)) - { - for(iDown=(Bit32s)strlen(fullname)-1;iDown>=0;iDown--) - { - if(fullname[iDown]=='\\' || iDown==0) - { + if (dots && (templen > 1)) { + Bit32s cDots = templen - 1; + for(iDown=(Bit32s)strlen(fullname)-1;iDown>=0;iDown--) { + if(fullname[iDown]=='\\' || iDown==0) { lastdir = iDown; cDots--; if(cDots==0) diff --git a/src/dos/dos_keyboard_layout.cpp b/src/dos/dos_keyboard_layout.cpp index e8487b76..8a03862f 100644 --- a/src/dos/dos_keyboard_layout.cpp +++ b/src/dos/dos_keyboard_layout.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_keyboard_layout.cpp,v 1.12 2008-06-30 20:32:37 c2woody Exp $ */ +/* $Id: dos_keyboard_layout.cpp,v 1.13 2008-08-06 18:32:34 c2woody Exp $ */ #include "dosbox.h" #include "bios.h" @@ -249,38 +249,39 @@ Bitu keyboard_layout::read_keyboard_file(const char* keyboard_file_name, Bit32s Bit32u start_pos=5; char nbuf[512]; + read_buf_size = 0; sprintf(nbuf, "%s.kl", keyboard_file_name); FILE* tempfile = OpenDosboxFile(nbuf); if (tempfile==NULL) { // try keyboard layout libraries next - if (start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,true)) { + if ((start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keyboard.sys"); - } else if (start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keybrd2.sys"); - } else if (start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keybrd3.sys"); - } else if (start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keyboard.sys"); - } else if (start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keybrd2.sys"); - } else if (start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keybrd3.sys"); - } else if (start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<33196; ct++) read_buf[read_buf_size++]=layout_keyboardsys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<25431; ct++) read_buf[read_buf_size++]=layout_keybrd2sys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<27122; ct++) read_buf[read_buf_size++]=layout_keybrd3sys[ct]; - } else if (start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<33196; ct++) read_buf[read_buf_size++]=layout_keyboardsys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<25431; ct++) read_buf[read_buf_size++]=layout_keybrd2sys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<27122; ct++) read_buf[read_buf_size++]=layout_keybrd3sys[ct]; } else { @@ -598,34 +599,34 @@ Bit16u keyboard_layout::extract_codepage(const char* keyboard_file_name) { FILE* tempfile = OpenDosboxFile(nbuf); if (tempfile==NULL) { // try keyboard layout libraries next - if (start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,true)) { + if ((start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keyboard.sys"); - } else if (start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keybrd2.sys"); - } else if (start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,true))) { tempfile = OpenDosboxFile("keybrd3.sys"); - } else if (start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keyboard.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keyboard.sys"); - } else if (start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keybrd2.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keybrd2.sys"); - } else if (start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_file("keybrd3.sys",keyboard_file_name,false))) { tempfile = OpenDosboxFile("keybrd3.sys"); - } else if (start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<33196; ct++) read_buf[read_buf_size++]=layout_keyboardsys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<25431; ct++) read_buf[read_buf_size++]=layout_keybrd2sys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,true)) { + } else if ((start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,true))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<27122; ct++) read_buf[read_buf_size++]=layout_keybrd3sys[ct]; - } else if (start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keyboardsys,33196,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<33196; ct++) read_buf[read_buf_size++]=layout_keyboardsys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keybrd2sys,25431,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<25431; ct++) read_buf[read_buf_size++]=layout_keybrd2sys[ct]; - } else if (start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,false)) { + } else if ((start_pos=read_kcl_data(layout_keybrd3sys,27122,keyboard_file_name,false))) { read_buf_size=0; for (Bitu ct=start_pos+2; ct<27122; ct++) read_buf[read_buf_size++]=layout_keybrd3sys[ct]; } else { @@ -992,11 +993,11 @@ void keyboard_layout::switch_foreign_layout() { static keyboard_layout* loaded_layout=NULL; // CTRL-ALT-F2 switches between foreign and US-layout using this function -static void switch_keyboard_layout(bool pressed) { +/* static void switch_keyboard_layout(bool pressed) { if (!pressed) return; if (loaded_layout) loaded_layout->switch_foreign_layout(); -} +} */ // called by int9-handler bool DOS_LayoutKey(Bitu key, Bit8u flags1, Bit8u flags2, Bit8u flags3) { diff --git a/src/dos/dos_misc.cpp b/src/dos/dos_misc.cpp index ddf68a22..e695f7f8 100644 --- a/src/dos/dos_misc.cpp +++ b/src/dos/dos_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_misc.cpp,v 1.18 2007-11-07 22:08:03 c2woody Exp $ */ +/* $Id: dos_misc.cpp,v 1.19 2008-08-06 18:32:34 c2woody Exp $ */ #include "dosbox.h" #include "callback.h" @@ -116,8 +116,7 @@ static bool DOS_MultiplexFunctions(void) { size_t nlen=strlen(filename); size_t extlen=strlen(dotpos); Bits nmelen=(Bits)nlen-(Bits)extlen; - nmelen--; - if (nmelen<0) return true; + if (nmelen<1) return true; nlen-=(extlen+1); if (nlen>8) nlen=8; diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 570ed64a..46e9384e 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_mscdex.cpp,v 1.53 2008-02-19 17:45:33 c2woody Exp $ */ +/* $Id: dos_mscdex.cpp,v 1.54 2008-08-06 18:32:34 c2woody Exp $ */ #include #include @@ -247,7 +247,7 @@ int CMscdex::RemoveDrive(Bit16u _drive) int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit) { subUnit = 0; - if (GetNumDrives()+1>=MSCDEX_MAX_DRIVES) return 4; + if ((Bitu)GetNumDrives()+1>=MSCDEX_MAX_DRIVES) return 4; if (GetNumDrives()) { // Error check, driveletter have to be in a row if (dinfo[0].drive-1!=_drive && dinfo[numDrives-1].drive+1!=_drive) @@ -902,7 +902,7 @@ static Bit16u MSCDEX_IOCTL_Input(PhysPt buffer,Bit8u drive_unit) { break; case 0x0A : /* Get Audio Disk info */ Bit8u tr1,tr2; TMSF leadOut; - mscdex->GetCDInfo(drive_unit,tr1,tr2,leadOut); + if (!mscdex->GetCDInfo(drive_unit,tr1,tr2,leadOut)) return 0x05; mem_writeb(buffer+1,tr1); mem_writeb(buffer+2,tr2); mem_writeb(buffer+3,leadOut.fr); diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index c1097760..5478a55f 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.85 2008-03-11 18:16:34 c2woody Exp $ */ +/* $Id: dos_programs.cpp,v 1.86 2008-08-06 18:32:34 c2woody Exp $ */ #include "dosbox.h" #include @@ -976,8 +976,8 @@ public: WriteOut(MSG_Get("PROGRAM_CONFIG_SECURE_DISALLOW")); return; } - DOS_Drive * newdrive; - imageDisk * newImage; + DOS_Drive * newdrive = NULL; + imageDisk * newImage = NULL; Bit32u imagesize; char drive; std::string label; @@ -1050,27 +1050,27 @@ public: if(fstype=="fat" || fstype=="iso") { // get the drive letter if (!cmd->FindCommand(1,temp_line) || (temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) { - WriteOut(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY_DRIVE")); + WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY_DRIVE")); return; } drive=toupper(temp_line[0]); if (!isalpha(drive)) { - WriteOut(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY_DRIVE")); + WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY_DRIVE")); return; } } else if (fstype=="none") { cmd->FindCommand(1,temp_line); if ((temp_line.size() > 1) || (!isdigit(temp_line[0]))) { - WriteOut(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY2")); + WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY2")); return; } drive=temp_line[0]; - if((drive-'0')>3) { - WriteOut(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY2")); + if ((drive<'0') || (drive>3+'0')) { + WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_SPECIFY2")); return; } } else { - WriteOut(MSG_Get("PROGRAM_IMGMOUNT_FORMAT_UNSUPPORTED")); + WriteOut_NoParsing(MSG_Get("PROGRAM_IMGMOUNT_FORMAT_UNSUPPORTED")); return; } diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index 4cf0a35f..1f852661 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_tables.cpp,v 1.29 2007-07-20 18:53:52 qbix79 Exp $ */ +/* $Id: dos_tables.cpp,v 1.30 2008-08-06 18:32:34 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -43,7 +43,7 @@ static Bitu call_casemap; static Bit16u dos_memseg=DOS_PRIVATE_SEGMENT; Bit16u DOS_GetMemory(Bit16u pages) { - if (pages+dos_memseg>=DOS_PRIVATE_SEGMENT_END) { + if ((Bitu)pages+(Bitu)dos_memseg>=DOS_PRIVATE_SEGMENT_END) { E_Exit("DOS:Not enough memory for internal tables"); } Bit16u page=dos_memseg; diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index d2d6fc5b..3fe88e2e 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -1,6 +1,5 @@ - /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.52 2007-11-02 07:50:27 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.53 2008-08-06 18:32:34 c2woody Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -193,7 +192,7 @@ char* DOS_Drive_Cache::GetExpandName(const char* path) strcat(work,dir); } - if(work && *work) { + if (*work) { size_t len = strlen(work); #if defined (WIN32) if((work[len-1] == CROSS_FILESPLIT ) && (len >= 2) && (work[len-2] != ':')) { diff --git a/src/dos/drive_fat.cpp b/src/dos/drive_fat.cpp index 5eab57af..0b68d083 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.25 2008-02-24 17:38:03 c2woody Exp $ */ +/* $Id: drive_fat.cpp,v 1.26 2008-08-06 18:32:34 c2woody Exp $ */ #include #include @@ -866,25 +866,22 @@ bool fatDrive::FindFirst(char *_dir, DOS_DTA &dta,bool /*fcb_findfirst*/) { return FindNextInternal(cwdDirCluster, dta, &dummyClust); } -char* removeTrailingSpaces(char* str) -{ - char* end = str + strlen(str); - while(*--end == ' ' && end > str); - *++end = '\0'; - return str; +char* removeTrailingSpaces(char* str) { + char* end = str + strlen(str); + while((*--end == ' ') && (end > str)) {}; + *++end = '\0'; + return str; } -char* removeLeadingSpaces(char* str) -{ - size_t len = strlen(str); - size_t pos = strspn(str," "); - memmove(str,str + pos,len - pos + 1); - return str; +char* removeLeadingSpaces(char* str) { + size_t len = strlen(str); + size_t pos = strspn(str," "); + memmove(str,str + pos,len - pos + 1); + return str; } -char* trimString(char* str) -{ - return removeTrailingSpaces(removeLeadingSpaces(str)); +char* trimString(char* str) { + return removeTrailingSpaces(removeLeadingSpaces(str)); } bool fatDrive::FindNextInternal(Bit32u dirClustNumber, DOS_DTA &dta, direntry *foundEntry) { diff --git a/src/gui/midi_win32.h b/src/gui/midi_win32.h index e4042a49..ec788d6d 100644 --- a/src/gui/midi_win32.h +++ b/src/gui/midi_win32.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_win32.h,v 1.14 2007-06-14 08:23:46 qbix79 Exp $ */ +/* $Id: midi_win32.h,v 1.15 2008-08-06 18:32:34 c2woody Exp $ */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -33,12 +33,12 @@ private: HANDLE m_event; bool isOpen; public: - MidiHandler_win32() : isOpen(false),MidiHandler() {}; + MidiHandler_win32() : MidiHandler(),isOpen(false) {}; const char * GetName(void) { return "win32";}; bool Open(const char * conf) { if (isOpen) return false; m_event = CreateEvent (NULL, true, true, NULL); - MMRESULT res; + MMRESULT res = MMSYSERR_NOERROR; if(conf && *conf) { std::string strconf(conf); std::istringstream configmidi(strconf); diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 698a8376..7b0f9cfd 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: render.cpp,v 1.56 2008-02-10 11:14:03 qbix79 Exp $ */ +/* $Id: render.cpp,v 1.57 2008-08-06 18:32:34 c2woody Exp $ */ #include #include @@ -282,7 +282,7 @@ static void RENDER_Reset( void ) { gfx_scalew = 1; gfx_scaleh = 1; } - if (dblh && dblw || (render.scale.forced && !dblh && !dblw)) { + if ((dblh && dblw) || (render.scale.forced && !dblh && !dblw)) { /* Initialize always working defaults */ if (render.scale.size == 2) simpleBlock = &ScaleNormal2x; @@ -343,6 +343,8 @@ static void RENDER_Reset( void ) { else if (render.scale.size == 3) simpleBlock = &ScaleScan3x; break; + default: + break; } #endif } else if (dblw) { diff --git a/src/gui/sdl_gui.cpp b/src/gui/sdl_gui.cpp index b54375e3..938b5a08 100644 --- a/src/gui/sdl_gui.cpp +++ b/src/gui/sdl_gui.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdl_gui.cpp,v 1.6 2008-02-21 19:25:34 c2woody Exp $ */ +/* $Id: sdl_gui.cpp,v 1.7 2008-08-06 18:32:34 c2woody Exp $ */ #include "SDL.h" #include "../libs/gui_tk/gui_tk.h" @@ -52,10 +52,10 @@ void UI_Init(void) { GUI::Font::addFont("default",new GUI::BitmapFont(int10_font_14,14,10)); } -static void getPixel(Bitu x, Bitu y, int &r, int &g, int &b, int shift) +static void getPixel(Bits x, Bits y, int &r, int &g, int &b, int shift) { - if (x >= render.src.width) x = render.src.width-1; - if (y >= render.src.height) x = render.src.height-1; + if (x >= (Bits)render.src.width) x = (Bits)render.src.width-1; + if (y >= (Bits)render.src.height) x = (Bits)render.src.height-1; if (x < 0) x = 0; if (y < 0) y = 0; @@ -159,7 +159,7 @@ static GUI::ScreenSDL *UI_Startup(GUI::ScreenSDL *screen) { SDL_BlitSurface(background, NULL, sdlscreen, NULL); SDL_BlitSurface(screenshot, NULL, sdlscreen, NULL); SDL_UpdateRect(sdlscreen, 0, 0, 0, 0); - while (SDL_PollEvent(&event)); + while (SDL_PollEvent(&event)) {}; SDL_Delay(40); } @@ -187,7 +187,7 @@ static void UI_Shutdown(GUI::ScreenSDL *screen) { SDL_BlitSurface(background, NULL, sdlscreen, NULL); SDL_BlitSurface(screenshot, NULL, sdlscreen, NULL); SDL_UpdateRect(sdlscreen, 0, 0, 0, 0); - while (SDL_PollEvent(&event)); + while (SDL_PollEvent(&event)) {}; SDL_Delay(40); } diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index ab4f18f1..34c28517 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdlmain.cpp,v 1.143 2008-05-28 09:14:06 qbix79 Exp $ */ +/* $Id: sdlmain.cpp,v 1.144 2008-08-06 18:32:34 c2woody Exp $ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -260,7 +260,9 @@ check_surface: else if (flags & GFX_LOVE_16) testbpp=16; else if (flags & GFX_LOVE_32) testbpp=32; else testbpp=0; +#if (HAVE_DDRAW_H) && defined(WIN32) check_gotbpp: +#endif if (sdl.desktop.fullscreen) gotbpp=SDL_VideoModeOK(640,480,testbpp,SDL_FULLSCREEN|SDL_HWSURFACE|SDL_HWPALETTE); else gotbpp=sdl.desktop.bpp; /* If we can't get our favorite mode check for another working one */ @@ -303,6 +305,9 @@ check_gotbpp: flags&=~(GFX_CAN_8|GFX_CAN_15|GFX_CAN_16); break; #endif + default: + goto check_surface; + break; } return flags; } @@ -611,6 +616,9 @@ dosurface: break; }//OPENGL #endif //C_OPENGL + default: + goto dosurface; + break; }//CASE if (retFlags) GFX_Start(); @@ -698,13 +706,17 @@ bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch) { sdl.updating=true; return true; #endif + default: + break; } return false; } void GFX_EndUpdate( const Bit16u *changedLines ) { +#if (HAVE_DDRAW_H) && defined(WIN32) int ret; +#endif if (!sdl.updating) return; sdl.updating=false; @@ -800,7 +812,8 @@ void GFX_EndUpdate( const Bit16u *changedLines ) { } break; #endif - + default: + break; } } diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 0c5db85a..02031a6b 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: adlib.cpp,v 1.31 2008-08-06 18:32:35 c2woody Exp $ */ + #include #include #include @@ -364,6 +366,8 @@ static void OPL_CallBack(Bitu len) { } opl.chan->AddSamples_s16(len,(Bit16s*)MixTemp); break; + default: + break; } if ((PIC_Ticks-opl.last_used)>30000) { opl.chan->Enable(false); @@ -380,6 +384,8 @@ static Bitu OPL_Read(Bitu port,Bitu iolen) { return OPL2::YM3812Read(addr>>1,addr); case OPL_opl3: return THEOPL3::YMF262Read(0,addr); + default: + break; } return 0xff; } @@ -411,6 +417,8 @@ void OPL_Write(Bitu port,Bitu val,Bitu iolen) { case OPL_dualopl2: OPL2::YM3812Write( index,port,val); break; + default: + break; } } diff --git a/src/hardware/hardware.cpp b/src/hardware/hardware.cpp index 01f187de..8e7d7921 100644 --- a/src/hardware/hardware.cpp +++ b/src/hardware/hardware.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: hardware.cpp,v 1.18 2007-01-08 19:45:40 qbix79 Exp $ */ +/* $Id: hardware.cpp,v 1.19 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -147,10 +147,10 @@ static void CAPTURE_AddAviChunk(const char * tag, Bit32u size, void * data, Bit3 } #endif +#if (C_SSHOT) static void CAPTURE_VideoEvent(bool pressed) { if (!pressed) return; -#if (C_SSHOT) if (CaptureState & CAPTURE_VIDEO) { /* Close the video */ CaptureState &= ~CAPTURE_VIDEO; @@ -283,12 +283,12 @@ static void CAPTURE_VideoEvent(bool pressed) { } else { CaptureState |= CAPTURE_VIDEO; } -#endif } +#endif void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal) { - Bitu i; #if (C_SSHOT) + Bitu i; Bit8u doubleRow[SCALER_MAXWIDTH*4]; Bitu countWidth = width; @@ -543,11 +543,13 @@ skip_video: } +#if (C_SSHOT) static void CAPTURE_ScreenShotEvent(bool pressed) { if (!pressed) return; CaptureState |= CAPTURE_IMAGE; } +#endif /* WAV capturing */ diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index 112433ac..077d6e48 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sblaster.cpp,v 1.67 2007-09-20 16:42:43 c2woody Exp $ */ +/* $Id: sblaster.cpp,v 1.68 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -226,6 +226,8 @@ static INLINE void SB_RaiseIRQ(SB_IRQS type) { case SB_IRQ_16: sb.irq.pending_16bit=true; break; + default: + break; } } @@ -470,6 +472,7 @@ static void GenerateDMASound(Bitu size) { } } +/* old version... static void GenerateDACSound(Bitu len) { if (!sb.dac.used) { sb.mode=MODE_NONE; @@ -485,6 +488,7 @@ static void GenerateDACSound(Bitu len) { sb.dac.used=0; sb.chan->AddSamples_m16(len,(Bit16s *)MixTemp); } +*/ static void DMA_Silent_Event(Bitu val) { if (sb.dma.leftGet_int("dma"); sb.hw.dma16=section->Get_int("hdma"); sb.mixer.enabled=section->Get_bool("mixer"); - Bitu oplrate=section->Get_int("oplrate"); sb.mixer.stereo=false; OPL_Mode opl_mode = OPL_none; Find_Type_And_Opl(section,sb.type,opl_mode); diff --git a/src/hardware/serialport/directserial_win32.cpp b/src/hardware/serialport/directserial_win32.cpp index 7b4d9c83..dc9de4b4 100644 --- a/src/hardware/serialport/directserial_win32.cpp +++ b/src/hardware/serialport/directserial_win32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: directserial_win32.cpp,v 1.6 2008-07-14 20:06:19 qbix79 Exp $ */ +/* $Id: directserial_win32.cpp,v 1.7 2008-08-06 18:33:30 c2woody Exp $ */ #include "dosbox.h" @@ -96,7 +96,7 @@ CDirectSerial::CDirectSerial (Bitu id, CommandLine* cmd) if (!fSuccess) { // Handle the error. - LOG_MSG ("GetCommState failed with error %d.\n", GetLastError ()); + LOG_MSG ("GetCommState failed with error %d.\n", (int)GetLastError ()); hCom = INVALID_HANDLE_VALUE; return; } @@ -125,7 +125,7 @@ CDirectSerial::CDirectSerial (Bitu id, CommandLine* cmd) if (!fSuccess) { // Handle the error. - LOG_MSG ("SetCommState failed with error %d.\n", GetLastError ()); + LOG_MSG ("SetCommState failed with error %d.\n", (int)GetLastError ()); hCom = INVALID_HANDLE_VALUE; return; } @@ -157,7 +157,6 @@ void CDirectSerial::handleUpperEvent(Bit16u type) { switch(type) { case SERIAL_POLLING_EVENT: { DWORD dwRead = 0; - DWORD errors = 0; Bit8u chRead = 0; setEvent(SERIAL_POLLING_EVENT, 1); @@ -329,12 +328,12 @@ void CDirectSerial::updatePortConfig (Bit16u divider, Bit8u lcr) { #endif LOG_MSG ("Serial%d: Desired serial mode not supported (%d,%d,%d,%d", - dcb.BaudRate,dcb.ByteSize,dcb.Parity,dcb.StopBits, COMNUMBER); + (Bit32u)dcb.BaudRate,(Bit32u)dcb.ByteSize, + (Bit32u)dcb.Parity,(Bit32u)dcb.StopBits, COMNUMBER); } } void CDirectSerial::updateMSR () { - Bit8u newmsr = 0; DWORD dptr = 0; if (!GetCommModemStatus (hCom, &dptr)) { diff --git a/src/hardware/serialport/serialport.cpp b/src/hardware/serialport/serialport.cpp index a35c4d03..1b1651d7 100644 --- a/src/hardware/serialport/serialport.cpp +++ b/src/hardware/serialport/serialport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.cpp,v 1.9 2008-07-14 20:06:19 qbix79 Exp $ */ +/* $Id: serialport.cpp,v 1.10 2008-08-06 18:33:30 c2woody Exp $ */ + #include #include @@ -939,8 +940,7 @@ void CSerial::Init_Registers () { Bit32u initbps = 9600; Bit8u bytesize = 8; - char parity = 'N'; - Bit8u stopbits = 1; + char parity = 'N'; Bit8u lcrresult = 0; Bit16u baudresult = 0; diff --git a/src/hardware/vga.cpp b/src/hardware/vga.cpp index 2d95fd74..c1fab73c 100644 --- a/src/hardware/vga.cpp +++ b/src/hardware/vga.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga.cpp,v 1.34 2008-02-06 18:23:34 c2woody Exp $ */ +/* $Id: vga.cpp,v 1.35 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" //#include "setup.h" @@ -100,6 +100,8 @@ void VGA_SetClock(Bitu which,Bitu target) { Bits err; } best; best.err=target; + best.m=1; + best.n=1; Bitu n,r; Bits m; diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index 9528ef46..4f91ea17 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_draw.cpp,v 1.102 2008-06-08 18:27:25 c2woody Exp $ */ +/* $Id: vga_draw.cpp,v 1.103 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -204,14 +204,14 @@ static Bit8u * VGA_Draw_Xlat16_Linear_Line(Bitu vidstart, Bitu line) { } //Test version, might as well keep it -static Bit8u * VGA_Draw_Chain_Line(Bitu vidstart, Bitu line) { +/* static Bit8u * VGA_Draw_Chain_Line(Bitu vidstart, Bitu line) { Bitu i = 0; for ( i = 0; i < vga.draw.width;i++ ) { Bitu addr = vidstart + i; TempLine[i] = vga.mem.linear[((addr&~3)<<2)+(addr&3)]; } return TempLine; -} +} */ static Bit8u * VGA_Draw_VGA_Line_HWMouse( Bitu vidstart, Bitu line) { bool hwcursor_active=false; @@ -430,8 +430,8 @@ static Bit8u * VGA_TEXT_Draw_Line(Bitu vidstart, Bitu line) { Bit32u mask2=TXT_Font_Table[font&0xf] & FontMask[col >> 7]; Bit32u fg=TXT_FG_Table[col&0xf]; Bit32u bg=TXT_BG_Table[col>>4]; - *draw++=fg&mask1 | bg&~mask1; - *draw++=fg&mask2 | bg&~mask2; + *draw++=(fg&mask1) | (bg&~mask1); + *draw++=(fg&mask2) | (bg&~mask2); } if (!vga.draw.cursor.enabled || !(vga.draw.cursor.count&0x8)) goto skip_cursor; font_addr = (vga.draw.cursor.address-vidstart) >> 1; @@ -459,8 +459,8 @@ static Bit8u * VGA_TEXT_Xlat16_Draw_Line(Bitu vidstart, Bitu line) { Bit32u fg=TXT_FG_Table[col&0xf]; Bit32u bg=TXT_BG_Table[col>>4]; - mask1=fg&mask1 | bg&~mask1; - mask2=fg&mask2 | bg&~mask2; + mask1=(fg&mask1) | (bg&~mask1); + mask2=(fg&mask2) | (bg&~mask2); for(int i = 0; i < 4; i++) { *draw++ = vga.dac.xlat16[(mask1>>8*i)&0xff]; @@ -484,6 +484,7 @@ skip_cursor: return TempLine; } +/* static Bit8u * VGA_TEXT_Draw_Line_9(Bitu vidstart, Bitu line) { Bits font_addr; Bit8u * draw=(Bit8u *)TempLine; @@ -541,6 +542,7 @@ static Bit8u * VGA_TEXT_Draw_Line_9(Bitu vidstart, Bitu line) { skip_cursor: return TempLine; } +*/ static Bit8u * VGA_TEXT_Xlat16_Draw_Line_9(Bitu vidstart, Bitu line) { Bits font_addr; @@ -852,6 +854,8 @@ static void VGA_VerticalTimer(Bitu val) { case M_TANDY2:case M_TANDY4:case M_TANDY16: vga.draw.address *= 2; break; + default: + break; } if (GCC_UNLIKELY(vga.draw.split_line==0)) VGA_ProcessSplit(); #ifdef VGA_KEEP_CHANGES @@ -904,6 +908,9 @@ void VGA_CheckScanLength(void) { case M_HERC_GFX: vga.draw.address_add=vga.draw.blocks; break; + default: + vga.draw.address_add=vga.draw.blocks*8; + break; } } @@ -1003,6 +1010,7 @@ void VGA_SetupDrawing(Bitu val) { clock = (machine==MCH_EGA) ? 14318180 : 25175000; break; case 1: + default: clock = (machine==MCH_EGA) ? 16257000 : 28322000; break; } @@ -1055,6 +1063,9 @@ void VGA_SetupDrawing(Bitu val) { if (vga.herc.mode_control & 0x2) clock=14318180/16; else clock=14318180/8; break; + default: + clock = 14318180; + break; } } #if C_DEBUG @@ -1130,6 +1141,7 @@ void VGA_SetupDrawing(Bitu val) { pheight = (480.0 / 350.0) * ( target_total / vtotal ); break; case 3: //480 line mode, filled with 525 total + default: pheight = (480.0 / 480.0) * ( 525.0 / vtotal ); break; } diff --git a/src/hardware/vga_memory.cpp b/src/hardware/vga_memory.cpp index c0f7da4c..45f8b0eb 100644 --- a/src/hardware/vga_memory.cpp +++ b/src/hardware/vga_memory.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_memory.cpp,v 1.50 2008-03-16 18:53:33 c2woody Exp $ */ +/* $Id: vga_memory.cpp,v 1.51 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -182,7 +182,7 @@ public: return vga.mem.linear[addr]; } void writeHandler(PhysPt start, Bit8u val) { - Bit32u data=ModeOperation(val); + ModeOperation(val); /* Update video memory and the pixel buffer */ VGA_Latch pixels; vga.mem.linear[start] = val; @@ -802,6 +802,7 @@ void VGA_SetupHandlers(void) { /* This should be vga only */ switch (vga.mode) { case M_ERROR: + default: return; case M_LIN4: newHandler = &vgaph.lin4; diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 73639261..64c1d8ac 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_other.cpp,v 1.22 2008-04-21 19:55:02 c2woody Exp $ */ +/* $Id: vga_other.cpp,v 1.23 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -456,10 +456,10 @@ static void write_hercules(Bitu port,Bitu val,Bitu iolen) { } } -static Bitu read_hercules(Bitu port,Bitu iolen) { +/* static Bitu read_hercules(Bitu port,Bitu iolen) { LOG_MSG("read from Herc port %x",port); return 0; -} +} */ void VGA_SetupOther(void) { diff --git a/src/hardware/vga_paradise.cpp b/src/hardware/vga_paradise.cpp index 6ce124f3..d84ccc36 100644 --- a/src/hardware/vga_paradise.cpp +++ b/src/hardware/vga_paradise.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_paradise.cpp,v 1.2 2008-01-12 17:37:48 c2woody Exp $ */ +/* $Id: vga_paradise.cpp,v 1.3 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "setup.h" @@ -39,7 +39,7 @@ typedef struct { Bitu biosMode; } SVGA_PVGA1A_DATA; -static SVGA_PVGA1A_DATA pvga1a = { 0, 0, 0, 0, 0, 0, 0 }; +static SVGA_PVGA1A_DATA pvga1a = { 0,0, 0,0,0,0,0, {0,0,0,0}, 0 }; static void bank_setup_pvga1a() { diff --git a/src/hardware/vga_tseng.cpp b/src/hardware/vga_tseng.cpp index b328ea92..678b6261 100644 --- a/src/hardware/vga_tseng.cpp +++ b/src/hardware/vga_tseng.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_tseng.cpp,v 1.3 2008-02-26 08:55:29 qbix79 Exp $ */ +/* $Id: vga_tseng.cpp,v 1.4 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" @@ -50,7 +50,8 @@ typedef struct { Bitu biosMode; } SVGA_ET4K_DATA; -static SVGA_ET4K_DATA et4k = { 1, 0, /* the rest are 0s */ }; +static SVGA_ET4K_DATA et4k = { 1,0,0,0,0,0,0,0,0, 0,0, 0,0, + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 0 }; #define STORE_ET4K(port, index) \ case 0x##index: \ @@ -486,7 +487,7 @@ typedef struct { Bitu biosMode; } SVGA_ET3K_DATA; -static SVGA_ET3K_DATA et3k = { 0 /* and the rest are 0s as well */ }; +static SVGA_ET3K_DATA et3k = { 0,0,0,0,0,0,0,0,0,0, 0,0, 0,0, {0,0,0,0,0,0,0,0}, 0 }; #define STORE_ET3K(port, index) \ case 0x##index: \ diff --git a/src/hardware/vga_xga.cpp b/src/hardware/vga_xga.cpp index 1b11b7e0..9c10497e 100644 --- a/src/hardware/vga_xga.cpp +++ b/src/hardware/vga_xga.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_xga.cpp,v 1.12 2008-01-12 17:37:48 c2woody Exp $ */ +/* $Id: vga_xga.cpp,v 1.13 2008-08-06 18:32:35 c2woody Exp $ */ #include #include "dosbox.h" @@ -774,6 +774,7 @@ void XGA_BlitRect(Bitu val) { break; default: LOG_MSG("XGA: DrawPattern: Shouldn't be able to get here!"); + srcval = 0; break; } @@ -859,6 +860,7 @@ void XGA_DrawPattern(Bitu val) { break; default: LOG_MSG("XGA: DrawPattern: Shouldn't be able to get here!"); + srcval = 0; break; } diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index de42895d..00daf8e0 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios.cpp,v 1.71 2008-07-19 13:28:03 qbix79 Exp $ */ +/* $Id: bios.cpp,v 1.72 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -624,8 +624,8 @@ static Bitu INT15_Handler(void) { MEM_A20_Enable(true); Bitu bytes = reg_cx * 2; PhysPt data = SegPhys(es)+reg_si; - PhysPt source = mem_readd(data+0x12) & 0x00FFFFFF + (mem_readb(data+0x16)<<24); - PhysPt dest = mem_readd(data+0x1A) & 0x00FFFFFF + (mem_readb(data+0x1E)<<24); + PhysPt source = (mem_readd(data+0x12) & 0x00FFFFFF) + (mem_readb(data+0x16)<<24); + PhysPt dest = (mem_readd(data+0x1A) & 0x00FFFFFF) + (mem_readb(data+0x1E)<<24); MEM_BlockCopy(dest,source,bytes); reg_ax = 0x00; MEM_A20_Enable(enabled); diff --git a/src/ints/ems.cpp b/src/ints/ems.cpp index 3ea702ce..06e3a2a9 100644 --- a/src/ints/ems.cpp +++ b/src/ints/ems.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ems.cpp,v 1.56 2007-11-01 12:11:40 qbix79 Exp $ */ +/* $Id: ems.cpp,v 1.57 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -1029,7 +1029,7 @@ static Bitu V86_Monitor() { Bitu which=(rm_val >> 3) & 7; if ((rm_val<0xc0) || (rm_val>=0xe8)) E_Exit("Invalid opcode 0x0f 0x22 %x caused a protection fault!",rm_val); - Bit32u crx; + Bit32u crx=0; switch (rm_val&7) { case 0: crx=reg_eax; break; case 1: crx=reg_ecx; break; diff --git a/src/ints/int10_modes.cpp b/src/ints/int10_modes.cpp index 418d344b..db139849 100644 --- a/src/ints/int10_modes.cpp +++ b/src/ints/int10_modes.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_modes.cpp,v 1.78 2008-05-10 17:33:28 c2woody Exp $ */ +/* $Id: int10_modes.cpp,v 1.79 2008-08-06 18:32:35 c2woody Exp $ */ #include @@ -248,14 +248,14 @@ static Bit8u text_palette[64][3]= static Bit8u mtext_palette[64][3]= { - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, - 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, - 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, - 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, - 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f + {0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}, + {0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a}, + {0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a}, + {0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f}, + {0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00},{0x00,0x00,0x00}, + {0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a}, + {0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a},{0x2a,0x2a,0x2a}, + {0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f},{0x3f,0x3f,0x3f} }; static Bit8u ega_palette[64][3]= diff --git a/src/ints/int10_put_pixel.cpp b/src/ints/int10_put_pixel.cpp index 9770c4c7..7d77412d 100644 --- a/src/ints/int10_put_pixel.cpp +++ b/src/ints/int10_put_pixel.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_put_pixel.cpp,v 1.21 2008-06-14 19:31:04 qbix79 Exp $ */ +/* $Id: int10_put_pixel.cpp,v 1.22 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -41,7 +41,7 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { color&=3; old^=color << (2*(3-(x&3))); } else { - old=old&cga_masks[x&3]|((color&3) << (2*(3-(x&3)))); + old=(old&cga_masks[x&3])|((color&3) << (2*(3-(x&3)))); } real_writeb(0xb800,off,old); } else { @@ -53,7 +53,7 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { old^=(color&1) << (7-(x&7)); old^=((color&2)>>1) << ((7-(x&7))+8); } else { - old=old&(~(0x101<<(7-(x&7)))) | ((color&1) << (7-(x&7))) | (((color&2)>>1) << ((7-(x&7))+8)); + old=(old&(~(0x101<<(7-(x&7))))) | ((color&1) << (7-(x&7))) | (((color&2)>>1) << ((7-(x&7))+8)); } real_writew(0xb800,off,old); } @@ -68,7 +68,7 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { color&=1; old^=color << ((7-(x&7))); } else { - old=old&cga_masks2[x&7]|((color&1) << ((7-(x&7)))); + old=(old&cga_masks2[x&7])|((color&1) << ((7-(x&7)))); } real_writeb(0xb800,off,old); } @@ -106,9 +106,9 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { if (color & 0x80) { IO_Write(0x3ce,0x3);IO_Write(0x3cf,0x18); } //Perhaps also set mode 1 /* Calculate where the pixel is in video memory */ - if (CurMode->plength!=real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)) + if (CurMode->plength!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)) LOG(LOG_INT10,LOG_ERROR)("PutPixel_EGA_p: %x!=%x",CurMode->plength,real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)); - if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) + if (CurMode->swidth!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) LOG(LOG_INT10,LOG_ERROR)("PutPixel_EGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); PhysPt off=0xa0000+real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)*page+ ((y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x)>>3); @@ -127,7 +127,7 @@ void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { mem_writeb(PhysMake(0xa000,y*320+x),color); break; case M_LIN8: { - if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) + if (CurMode->swidth!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) LOG(LOG_INT10,LOG_ERROR)("PutPixel_VGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); PhysPt off=S3_LFB_BASE+y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x; mem_writeb(off,color); @@ -149,7 +149,7 @@ void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color) { Bit16u off=(y>>1)*80+(x>>2); if (y&1) off+=8*1024; Bit8u val=real_readb(0xb800,off); - *color=(val>>(((3-x&3))*2)) & 3 ; + *color=(val>>(((3-(x&3)))*2)) & 3 ; } break; case M_CGA2: @@ -157,15 +157,15 @@ void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color) { Bit16u off=(y>>1)*80+(x>>3); if (y&1) off+=8*1024; Bit8u val=real_readb(0xb800,off); - *color=(val>>(((7-x&7)))) & 1 ; + *color=(val>>(((7-(x&7))))) & 1 ; } break; case M_EGA: { /* Calculate where the pixel is in video memory */ - if (CurMode->plength!=real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)) + if (CurMode->plength!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)) LOG(LOG_INT10,LOG_ERROR)("GetPixel_EGA_p: %x!=%x",CurMode->plength,real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)); - if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) + if (CurMode->swidth!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) LOG(LOG_INT10,LOG_ERROR)("GetPixel_EGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); PhysPt off=0xa0000+real_readw(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)*page+ ((y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x)>>3); @@ -186,7 +186,7 @@ void INT10_GetPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u * color) { *color=mem_readb(PhysMake(0xa000,320*y+x)); break; case M_LIN8: { - if (CurMode->swidth!=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) + if (CurMode->swidth!=(Bitu)real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8) LOG(LOG_INT10,LOG_ERROR)("GetPixel_VGA_w: %x!=%x",CurMode->swidth,real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); PhysPt off=S3_LFB_BASE+y*real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8+x; *color = mem_readb(off); diff --git a/src/ints/int10_video_state.cpp b/src/ints/int10_video_state.cpp index 0d83a902..50d55950 100644 --- a/src/ints/int10_video_state.cpp +++ b/src/ints/int10_video_state.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: */ +/* $Id: int10_video_state.cpp,v 1.2 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -178,7 +178,8 @@ bool INT10_VideoState_Save(Bitu state,RealPt buffer) { Bit16u crt_reg=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); IO_WriteB(0x3c4,0x08); - Bitu seq_8=IO_ReadB(0x3c5); +// Bitu seq_8=IO_ReadB(0x3c5); + IO_ReadB(0x3c5); // real_writeb(base_seg,base_dest+0x00,IO_ReadB(0x3c5)); IO_WriteB(0x3c5,0x06); // unlock s3-specific registers @@ -332,7 +333,8 @@ bool INT10_VideoState_Restore(Bitu state,RealPt buffer) { Bitu seq_idx=IO_ReadB(0x3c4); IO_WriteB(0x3c4,0x08); - Bitu seq_8=IO_ReadB(0x3c5); +// Bitu seq_8=IO_ReadB(0x3c5); + IO_ReadB(0x3c5); // real_writeb(base_seg,base_dest+0x00,IO_ReadB(0x3c5)); IO_WriteB(0x3c5,0x06); // unlock s3-specific registers @@ -342,7 +344,7 @@ bool INT10_VideoState_Restore(Bitu state,RealPt buffer) { } IO_WriteB(0x3c4,seq_idx); - Bitu crtc_idx=IO_ReadB(0x3d4); +// Bitu crtc_idx=IO_ReadB(0x3d4); // unlock s3-specific registers IO_WriteW(crt_reg,0x4838); diff --git a/src/ints/int10_vptable.cpp b/src/ints/int10_vptable.cpp index ad6d0692..8b6d9ab0 100644 --- a/src/ints/int10_vptable.cpp +++ b/src/ints/int10_vptable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_vptable.cpp,v 1.1 2007-10-08 20:22:13 c2woody Exp $ */ +/* $Id: int10_vptable.cpp,v 1.2 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -489,7 +489,7 @@ void INT10_GenerateVideoParameterTable(void) { } LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // sequencer registers",seq_regs[0],seq_regs[1],seq_regs[2],seq_regs[3]); LOG_MSG(" 0x%02x, // misc output registers",IO_ReadB(0x3cc)); - Bitu crtc_regs[4]; + Bitu crtc_regs[0x19]; Bit16u crt_addr=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); for (ct=0; ct<0x19; ct++) { IO_WriteB(crt_addr,ct); @@ -504,7 +504,7 @@ void INT10_GenerateVideoParameterTable(void) { LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, // crtc registers 16-24", crtc_regs[0x10],crtc_regs[0x11],crtc_regs[0x12],crtc_regs[0x13], crtc_regs[0x14],crtc_regs[0x15],crtc_regs[0x16],crtc_regs[0x17],crtc_regs[0x18]); - Bitu attr_regs[4]; + Bitu attr_regs[0x14]; for (ct=0; ct<0x14; ct++) { IO_ReadB(crt_addr+6); IO_WriteB(0x3c0,ct); @@ -518,7 +518,7 @@ void INT10_GenerateVideoParameterTable(void) { attr_regs[0x0c],attr_regs[0x0d],attr_regs[0x0e],attr_regs[0x0f]); LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // attr registers 16-19", attr_regs[0x10],attr_regs[0x11],attr_regs[0x12],attr_regs[0x13]); - Bitu gfx_regs[4]; + Bitu gfx_regs[9]; for (ct=0; ct<0x09; ct++) { IO_WriteB(0x3ce,ct); gfx_regs[ct]=IO_ReadB(0x3cf); @@ -547,7 +547,7 @@ void INT10_GenerateVideoParameterTable(void) { } LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // sequencer registers",seq_regs[0],seq_regs[1],seq_regs[2],seq_regs[3]); LOG_MSG(" 0x%02x, // misc output registers",IO_ReadB(0x3cc)); - Bitu crtc_regs[4]; + Bitu crtc_regs[0x19]; Bit16u crt_addr=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); for (ct=0; ct<0x19; ct++) { IO_WriteB(crt_addr,ct); @@ -562,7 +562,7 @@ void INT10_GenerateVideoParameterTable(void) { LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, // crtc registers 16-24", crtc_regs[0x10],crtc_regs[0x11],crtc_regs[0x12],crtc_regs[0x13], crtc_regs[0x14],crtc_regs[0x15],crtc_regs[0x16],crtc_regs[0x17],crtc_regs[0x18]); - Bitu attr_regs[4]; + Bitu attr_regs[0x14]; for (ct=0; ct<0x14; ct++) { IO_ReadB(crt_addr+6); IO_WriteB(0x3c0,ct); @@ -576,7 +576,7 @@ void INT10_GenerateVideoParameterTable(void) { attr_regs[0x0c],attr_regs[0x0d],attr_regs[0x0e],attr_regs[0x0f]); LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // attr registers 16-19", attr_regs[0x10],attr_regs[0x11],attr_regs[0x12],attr_regs[0x13]); - Bitu gfx_regs[4]; + Bitu gfx_regs[9]; for (ct=0; ct<0x09; ct++) { IO_WriteB(0x3ce,ct); gfx_regs[ct]=IO_ReadB(0x3cf); @@ -604,7 +604,7 @@ void INT10_GenerateVideoParameterTable(void) { } LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // sequencer registers",seq_regs[0],seq_regs[1],seq_regs[2],seq_regs[3]); LOG_MSG(" 0x%02x, // misc output registers",IO_ReadB(0x3cc)); - Bitu crtc_regs[4]; + Bitu crtc_regs[0x19]; Bit16u crt_addr=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); for (ct=0; ct<0x19; ct++) { IO_WriteB(crt_addr,ct); @@ -619,7 +619,7 @@ void INT10_GenerateVideoParameterTable(void) { LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, // crtc registers 16-24", crtc_regs[0x10],crtc_regs[0x11],crtc_regs[0x12],crtc_regs[0x13], crtc_regs[0x14],crtc_regs[0x15],crtc_regs[0x16],crtc_regs[0x17],crtc_regs[0x18]); - Bitu attr_regs[4]; + Bitu attr_regs[0x14]; for (ct=0; ct<0x14; ct++) { IO_ReadB(crt_addr+6); IO_WriteB(0x3c0,ct); @@ -633,7 +633,7 @@ void INT10_GenerateVideoParameterTable(void) { attr_regs[0x0c],attr_regs[0x0d],attr_regs[0x0e],attr_regs[0x0f]); LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // attr registers 16-19", attr_regs[0x10],attr_regs[0x11],attr_regs[0x12],attr_regs[0x13]); - Bitu gfx_regs[4]; + Bitu gfx_regs[9]; for (ct=0; ct<0x09; ct++) { IO_WriteB(0x3ce,ct); gfx_regs[ct]=IO_ReadB(0x3cf); @@ -659,7 +659,7 @@ void INT10_GenerateVideoParameterTable(void) { } LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // sequencer registers",seq_regs[0],seq_regs[1],seq_regs[2],seq_regs[3]); LOG_MSG(" 0x%02x, // misc output registers",IO_ReadB(0x3cc)); - Bitu crtc_regs[4]; + Bitu crtc_regs[0x19]; Bit16u crt_addr=real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS); for (ct=0; ct<0x19; ct++) { IO_WriteB(crt_addr,ct); @@ -674,7 +674,7 @@ void INT10_GenerateVideoParameterTable(void) { LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, // crtc registers 16-24", crtc_regs[0x10],crtc_regs[0x11],crtc_regs[0x12],crtc_regs[0x13], crtc_regs[0x14],crtc_regs[0x15],crtc_regs[0x16],crtc_regs[0x17],crtc_regs[0x18]); - Bitu attr_regs[4]; + Bitu attr_regs[0x14]; for (ct=0; ct<0x14; ct++) { IO_ReadB(crt_addr+6); IO_WriteB(0x3c0,ct); @@ -688,7 +688,7 @@ void INT10_GenerateVideoParameterTable(void) { attr_regs[0x0c],attr_regs[0x0d],attr_regs[0x0e],attr_regs[0x0f]); LOG_MSG(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, // attr registers 16-19", attr_regs[0x10],attr_regs[0x11],attr_regs[0x12],attr_regs[0x13]); - Bitu gfx_regs[4]; + Bitu gfx_regs[9]; for (ct=0; ct<0x09; ct++) { IO_WriteB(0x3ce,ct); gfx_regs[ct]=IO_ReadB(0x3cf); diff --git a/src/libs/gui_tk/gui_tk.cpp b/src/libs/gui_tk/gui_tk.cpp index d90524e4..6e97d07a 100644 --- a/src/libs/gui_tk/gui_tk.cpp +++ b/src/libs/gui_tk/gui_tk.cpp @@ -19,7 +19,7 @@ /* TODO: - make menu a bufferedwindow with shadow */ -/* $Id: gui_tk.cpp,v 1.2 2007-10-28 17:05:28 c2woody Exp $ */ +/* $Id: gui_tk.cpp,v 1.3 2008-08-06 18:33:47 c2woody Exp $ */ /** \file * \brief Implementation file for gui_tk. @@ -146,7 +146,7 @@ void Drawable::drawText(const String& text, bool interpret, Size start, Size len switch (param) { case 0: setColor(Color::Black); break; case 1: setColor(color | 0x00808080); break; - case 30: setColor(Color::Black|bright & intensity); break; + case 30: setColor((Color::Black|bright) & intensity); break; case 31: setColor(Color::Red & intensity); break; case 32: setColor(Color::Green & intensity); break; case 33: setColor(Color::Yellow & intensity); break; @@ -426,7 +426,7 @@ void BitmapFont::drawChar(Drawable *d, const Char c) const { ptr = char_position[c]; bit = 0; } else { - move(character_step*c); + move(character_step*((int)c)); } int rs = row_step; @@ -1380,7 +1380,7 @@ void ScreenRGB32le::paint(Drawable &d) const test(d); } -static const MouseButton SDL_to_GUI(const int button) +static MouseButton SDL_to_GUI(const int button) { switch (button) { case SDL_BUTTON_LEFT: return GUI::Left; diff --git a/src/libs/gui_tk/gui_tk.h b/src/libs/gui_tk/gui_tk.h index e852d6e7..06d5aba9 100644 --- a/src/libs/gui_tk/gui_tk.h +++ b/src/libs/gui_tk/gui_tk.h @@ -102,7 +102,7 @@ * along with this program. If not, see */ -/* $Id: gui_tk.h,v 1.2 2007-11-06 20:26:27 qbix79 Exp $ */ +/* $Id: gui_tk.h,v 1.3 2008-08-06 18:33:47 c2woody Exp $ */ #ifndef GUI__TOOLKIT_H #define GUI__TOOLKIT_H @@ -1988,7 +1988,7 @@ public: if (selected >= 0 && !menus[selected]->isVisible()) oldselected = -1; if (selected >= 0) menus[selected]->setVisible(false); if (x < 0 || x >= lastx) return true; - for (selected = menus.size()-1; menus[selected]->getX() > x; selected--); + for (selected = menus.size()-1; menus[selected]->getX() > x; selected--) {}; if (oldselected == selected) selected = -1; else menus[selected]->setVisible(true); return true; diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index 4e34fc52..fc9021dc 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.cpp,v 1.49 2008-05-30 12:42:38 qbix79 Exp $ */ +/* $Id: setup.cpp,v 1.50 2008-08-06 18:32:35 c2woody Exp $ */ #include "dosbox.h" #include "cross.h" @@ -374,7 +374,6 @@ const std::vector& Prop_multival::GetValues() const //No properties in this section. do nothing if(!p) return suggested_values; int i =0; - string::size_type loc = string::npos; while( (p = section->Get_prop(i++)) ) { std::vector v = p->GetValues(); if(!v.empty()) return p->GetValues(); diff --git a/src/misc/support.cpp b/src/misc/support.cpp index 070235e6..7851cbe7 100644 --- a/src/misc/support.cpp +++ b/src/misc/support.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.cpp,v 1.34 2008-01-13 11:28:41 qbix79 Exp $ */ +/* $Id: support.cpp,v 1.35 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -71,7 +71,7 @@ char *ltrim(char *str) { char *rtrim(char *str) { char *p; p = strchr(str, '\0'); - while (--p >= str && isspace(*reinterpret_cast(p))); + while (--p >= str && isspace(*reinterpret_cast(p))) {}; p[1] = '\0'; return str; } diff --git a/src/platform/visualc/dirent.c b/src/platform/visualc/dirent.c index d2e25c2a..1131da7e 100644 --- a/src/platform/visualc/dirent.c +++ b/src/platform/visualc/dirent.c @@ -9,6 +9,8 @@ #include "dirent.h" #include "io.h" +#define safe_strncpy_dirent(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0) + #ifdef WIN32 /** open the current directory and return a structure @@ -23,7 +25,7 @@ DIR * opendir(const char *dirname) { size_t len; /* Stash the directory name */ - strcpy(dir.pathName,dirname); + safe_strncpy_dirent(dir.pathName,dirname,260); len = strlen(dirname); if ((len>0) && (dirname[len-1]=='\\')) strcat(dir.pathName,"*.*"); @@ -80,7 +82,7 @@ struct dirent * readdir(DIR *dirp) { /* we have a valid FIND_FILE_DATA, copy the filename */ memset(&d,'\0', sizeof(struct dirent)); - strcpy(d.d_name,dirp->findFileData.cFileName); + safe_strncpy_dirent(d.d_name,dirp->findFileData.cFileName,260); d.d_namlen = (char)strlen(d.d_name); return &d; diff --git a/src/shell/shell_batch.cpp b/src/shell/shell_batch.cpp index a8b9ce4c..3f908b01 100644 --- a/src/shell/shell_batch.cpp +++ b/src/shell/shell_batch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_batch.cpp,v 1.28 2008-07-27 20:12:28 qbix79 Exp $ */ +/* $Id: shell_batch.cpp,v 1.29 2008-08-06 18:32:35 c2woody Exp $ */ #include #include @@ -91,7 +91,7 @@ emptyline: /* Handle %1 %2 .. %9 */ cmd_read++; //Progress reader next -= '0'; - if (cmd->GetCount()GetCount()<(unsigned int)next) continue; std::string word; if (!cmd->FindCommand(next,word)) continue; strcpy(cmd_write,word.c_str());