diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 8f644736bc..800a4c75d6 100755 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -1127,8 +1127,8 @@ void CGUI::Xerces_ReadObject(DOMElement *pElement, IGUIObject *pParent) // There is no harm if the object didn't have a "caption" } } - // else - // TODO Gee: give warning + else + debug_warn("Text is only okay if it's the first element i.e. caption ... "); } } diff --git a/source/lib/adts.h b/source/lib/adts.h index f4495b3587..ecc1c22633 100755 --- a/source/lib/adts.h +++ b/source/lib/adts.h @@ -119,7 +119,7 @@ public: { // add to front of LRU list, but not index // (since we don't have an id yet) - lru_list.push_front(Line(0, e)); + lru_list.push_front(Line(e)); return 0; } @@ -204,9 +204,9 @@ private: Entry ent; int refs; // protect from displacement if > 0 - Line(u64 _tag, Entry& _ent) + Line(Entry& _ent) { - id = 0; + id = 0; ent = _ent; refs = 0; } diff --git a/source/lib/cpu.h b/source/lib/cpu.h index 542e2a92f1..55ce516154 100755 --- a/source/lib/cpu.h +++ b/source/lib/cpu.h @@ -10,8 +10,8 @@ extern double cpu_freq; extern int cpus; extern int cpu_speedstep; extern int cpu_smp; -// are there actually multiple physical processors, -// not only logical hyperthreaded CPUs? relevant for wtime. + // are there actually multiple physical processors, + // not only logical hyperthreaded CPUs? relevant for wtime. #ifdef __cplusplus } diff --git a/source/lib/res/file.cpp b/source/lib/res/file.cpp index df23d04368..e4b41e2e5d 100755 --- a/source/lib/res/file.cpp +++ b/source/lib/res/file.cpp @@ -222,6 +222,9 @@ struct DirEnt DirEnt(const char* const _name, const uint _flags, const off_t _size) : name(_name), flags(_flags), size(_size) {} + +private: + DirEnt& operator=(const DirEnt&); }; // pointer to DirEnt: faster sorting, but more allocs. @@ -1031,7 +1034,7 @@ debug_out("file_wait_io: hio=%I64x\n", hio); size = io->user_size; - void* transfer_buf; + void* transfer_buf = 0; ssize_t bytes_transferred; // block's tag is in cache. need to check if its read is still pending. diff --git a/source/lib/res/vfs.cpp b/source/lib/res/vfs.cpp index 0661c3cd1e..ca6a7756ff 100755 --- a/source/lib/res/vfs.cpp +++ b/source/lib/res/vfs.cpp @@ -468,6 +468,9 @@ struct FileCBParams const FileLoc* const loc; FileCBParams(Dir* _dir, const FileLoc* _loc) : dir(_dir), loc(_loc) {} + +private: + FileCBParams& operator=(const FileCBParams&); }; // called for each OS dir ent. diff --git a/source/lib/sysdep/ia32.cpp b/source/lib/sysdep/ia32.cpp index c1640ac9b6..d14f4c5690 100755 --- a/source/lib/sysdep/ia32.cpp +++ b/source/lib/sysdep/ia32.cpp @@ -423,21 +423,17 @@ static void check_hyperthread() mov log_cpus_per_package, ebx ; ebx[23:16] } - // early out, don't have to go through on_each_cpu - if(log_cpus_per_package >= cpus) - return; - cpu_smp = 1; } static void check_speedstep() { - if(vendor == INTEL) - { - } + if(vendor == INTEL && ia32_cap(EST)) + cpu_speedstep = true; } + void ia32_get_cpu_info() { cpuid(); @@ -453,6 +449,7 @@ void ia32_get_cpu_info() get_cpu_type(); measure_cpu_freq(); check_hyperthread(); + check_speedstep(); } #endif // #ifndef _M_IX86 diff --git a/source/lib/sysdep/ia32.h b/source/lib/sysdep/ia32.h index 62b987b61a..86bd1cdc7f 100755 --- a/source/lib/sysdep/ia32.h +++ b/source/lib/sysdep/ia32.h @@ -65,7 +65,7 @@ enum CpuCap _3DNOW = 96+31 }; -extern bool ia32_cpu_cap(CpuCap cap); +extern bool ia32_cap(CpuCap cap); extern void ia32_get_cpu_info(); diff --git a/source/lib/sysdep/win/wsdl.cpp b/source/lib/sysdep/win/wsdl.cpp index 483ee3b3a8..4b9c877062 100755 --- a/source/lib/sysdep/win/wsdl.cpp +++ b/source/lib/sysdep/win/wsdl.cpp @@ -727,6 +727,7 @@ __asm jmp dword ptr [GetTickCount] __declspec(naked) void __stdcall SDL_Delay(Uint32 ms) { + UNUSED(ms); __asm jmp dword ptr [Sleep] } diff --git a/source/lib/sysdep/win/wtime.cpp b/source/lib/sysdep/win/wtime.cpp index 6f924bc199..0f963fb13a 100755 --- a/source/lib/sysdep/win/wtime.cpp +++ b/source/lib/sysdep/win/wtime.cpp @@ -29,8 +29,6 @@ #include #include -#include "wdbg.h" - // define to disable time sources (useful for simulating other systems) //#define NO_QPC @@ -510,6 +508,7 @@ static inline int shutdown_calibration_thread() if(WaitForSingleObject(hThread, 250) != WAIT_OBJECT_0) TerminateThread(hThread, 0); CloseHandle(hThread); + CloseHandle(hExitEvent); return 0; } diff --git a/source/main.cpp b/source/main.cpp index b50828f192..1f2a91e58d 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -545,7 +545,7 @@ static void psInit() // GUI uses VFS, so this must come after VFS init. g_GUI.Initialize(); g_GUI.LoadXMLFile("gui/styles.xml"); - g_GUI.LoadXMLFile("gui/hello.xml"); + g_GUI.LoadXMLFile("gui/hello2.xml"); g_GUI.LoadXMLFile("gui/sprite1.xml"); #endif } diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 55c4d8b9d0..cab855365e 100755 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -245,7 +245,7 @@ void CConsole::DrawCursor(void) //Inserts a character into the buffer. -void CConsole::InsertChar(const int szChar, const int cooked ) +void CConsole::InsertChar(const int szChar, const wchar_t cooked ) { static int iHistoryPos = -1; @@ -296,7 +296,7 @@ void CConsole::InsertChar(const int szChar, const int cooked ) /* BEGIN: Buffer History Lookup */ case SDLK_UP: - if (m_deqBufHistory.size() && iHistoryPos != m_deqBufHistory.size() - 1) + if (m_deqBufHistory.size() && iHistoryPos != (int)m_deqBufHistory.size() - 1) { iHistoryPos++; SetBuffer(m_deqBufHistory.at(iHistoryPos).data()); @@ -314,7 +314,7 @@ void CConsole::InsertChar(const int szChar, const int cooked ) /* BEGIN: Message History Lookup */ case SDLK_PAGEUP: - if (m_iMsgHistPos != m_deqMsgHistory.size()) m_iMsgHistPos++; + if (m_iMsgHistPos != (int)m_deqMsgHistory.size()) m_iMsgHistPos++; return; case SDLK_PAGEDOWN: @@ -490,6 +490,6 @@ bool conInputHandler(const SDL_Event& ev) if(ev.type != SDL_KEYDOWN) return false; - g_Console->InsertChar(ev.key.keysym.sym, ev.key.keysym.unicode ); + g_Console->InsertChar(ev.key.keysym.sym, (wchar_t)ev.key.keysym.unicode ); return g_Console->IsActive(); } diff --git a/source/ps/CConsole.h b/source/ps/CConsole.h index bd1cb99086..68a0c36344 100755 --- a/source/ps/CConsole.h +++ b/source/ps/CConsole.h @@ -70,7 +70,7 @@ public: void Render(); void InsertMessage(const wchar_t* szMessage, ...); - void InsertChar(const int szChar, const int cooked); + void InsertChar(const int szChar, const wchar_t cooked); void SetBuffer(const wchar_t* szMessage, ...); void FlushBuffer(); diff --git a/source/ps/CLogger.h b/source/ps/CLogger.h index 5cc67e678d..80ca03c9fa 100755 --- a/source/ps/CLogger.h +++ b/source/ps/CLogger.h @@ -39,6 +39,8 @@ public: private: CLogger(); + CLogger(const CLogger& init); + CLogger& operator=(const CLogger& rhs); //the two filestreams std::ofstream m_MainLog; diff --git a/source/ps/CStr.cpp b/source/ps/CStr.cpp index fb3c8605d2..31588a58b0 100755 --- a/source/ps/CStr.cpp +++ b/source/ps/CStr.cpp @@ -136,10 +136,10 @@ CStr CStr::GetSubstring(size_t start, size_t len) const //Search the string for another string long CStr::Find(const CStr& Str) const { - long Pos = (long)m_String.find(Str.m_String, 0); + size_t Pos = m_String.find(Str.m_String, 0); if (Pos != tstring::npos) - return Pos; + return (long)Pos; return -1; } @@ -147,10 +147,10 @@ long CStr::Find(const CStr& Str) const //Search the string for another string long CStr::Find(const TCHAR &tchar) const { - long Pos = (long)m_String.find(tchar, 0); + size_t Pos = m_String.find(tchar, 0); if (Pos != tstring::npos) - return Pos; + return (long)Pos; return -1; } @@ -158,20 +158,20 @@ long CStr::Find(const TCHAR &tchar) const //Search the string for another string long CStr::Find(const int &start, const TCHAR &tchar) const { - long Pos = (long)m_String.find(tchar, start); + size_t Pos = m_String.find(tchar, start); if (Pos != tstring::npos) - return Pos; + return (long)Pos; return -1; } long CStr::ReverseFind(const CStr& Str) const { - long Pos = (long)m_String.rfind(Str.m_String, m_String.length() ); + size_t Pos = m_String.rfind(Str.m_String, m_String.length() ); if (Pos != tstring::npos) - return Pos; + return (long)Pos; return -1; @@ -182,7 +182,7 @@ CStr CStr::LowerCase() const { tstring NewTString = m_String; for (size_t i = 0; i < m_String.length(); i++) - NewTString[i] = _totlower(m_String[i]); + NewTString[i] = (TCHAR)_totlower(m_String[i]); return CStr(NewTString); } @@ -191,7 +191,7 @@ CStr CStr::UpperCase() const { tstring NewTString = m_String; for (size_t i = 0; i < m_String.length(); i++) - NewTString[i] = _totlower(m_String[i]); + NewTString[i] = (TCHAR)_totlower(m_String[i]); return CStr(NewTString); } @@ -202,7 +202,7 @@ CStr CStr::LCase() const { tstring NewTString = m_String; for (size_t i = 0; i < m_String.length(); i++) - NewTString[i] = _totlower(m_String[i]); + NewTString[i] = (TCHAR)_totlower(m_String[i]); return CStr(NewTString); } @@ -211,7 +211,7 @@ CStr CStr::UCase() const { tstring NewTString = m_String; for (size_t i = 0; i < m_String.length(); i++) - NewTString[i] = _totlower(m_String[i]); + NewTString[i] = (TCHAR)_totlower(m_String[i]); return CStr(NewTString); } @@ -261,7 +261,7 @@ void CStr::Replace(const CStr& ToReplace, const CStr& ReplaceWith) // returns a trimed string, removes whitespace from the left/right/both CStr CStr::Trim(PS_TRIM_MODE Mode) { - size_t Left, Right; + size_t Left = 0, Right = 0; switch (Mode) @@ -292,6 +292,9 @@ CStr CStr::Trim(PS_TRIM_MODE Mode) if (_istspace(m_String[Right]) == false) break; // end found, trim len-1 to Right+1 inclusive } break; + + default: + debug_warn("CStr::Trim: invalid Mode"); } diff --git a/source/ps/LogFile.h b/source/ps/LogFile.h index 3636e4a428..0af6db32eb 100755 --- a/source/ps/LogFile.h +++ b/source/ps/LogFile.h @@ -133,6 +133,9 @@ public: PS_RESULT AddLink(string LinkText, string Link, string Colour); private: + CLogFile(const CLogFile& init); + CLogFile& operator=(const CLogFile& rhs); + bool m_IsFileOpen; //Is the file open. bool m_HasFrame; //Have frames been enabled. ofstream m_TheFile; //The main file. diff --git a/source/ps/Parser.cpp b/source/ps/Parser.cpp index 51f10eecdc..0f56cdc1b6 100755 --- a/source/ps/Parser.cpp +++ b/source/ps/Parser.cpp @@ -3,6 +3,7 @@ #include "precompiled.h" #include "Parser.h" +#include "lib.h" #pragma warning(disable:4786) using namespace std; @@ -117,11 +118,11 @@ bool CParserValue::GetDouble(double &ret) { // locals double TempRet = 0.0; - int Size = (int)m_String.size(); - int i; + size_t Size = m_String.size(); + size_t i; bool AtLeastOne = false; // Checked if at least one of the loops - // run, otherwise "." would parse OK - int DecimalPos; + // run, otherwise "." would parse OK + size_t DecimalPos; bool Negative = false; // "-" is found // Check if '-' is found @@ -131,7 +132,7 @@ bool CParserValue::GetDouble(double &ret) } // find decimal position - DecimalPos = (int)m_String.find("."); + DecimalPos = m_String.find("."); if (DecimalPos == string::npos) DecimalPos = Size; @@ -145,7 +146,8 @@ bool CParserValue::GetDouble(double &ret) // Check if a digit is found if (m_String[i] >= '0' && m_String[i] <= '9') { - TempRet += (m_String[i]-'0')*pow(double(10),(DecimalPos-i-1)); + double exp = (DecimalPos-i-1); // disambiguate pow() argument type + TempRet += (m_String[i]-'0')*pow(10.0, exp); } else { @@ -164,7 +166,8 @@ bool CParserValue::GetDouble(double &ret) // Check if a digit is found if (m_String[i] >= '0' && m_String[i] <= '9') { - TempRet += (m_String[i]-'0')*pow(double(10),DecimalPos-i); + double exp = DecimalPos-i; // disambiguate pow() argument type + TempRet += (m_String[i]-'0')*pow(10.0,exp); } // It will accept and ending f, like 1.0f else if (!(i==Size-1 && m_String[i] == 'f')) @@ -308,12 +311,12 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) // Locals bool Extract=false; - int ExtractPos=0; + size_t ExtractPos=0; char Buffer[256]; char Letter[] = {'\0','\0'}; // Letter as string vector Segments; string strSub; - int i; + size_t i; // Set result to false, then if a match is found, turn it true m_ParseOK = false; @@ -330,7 +333,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) // Divide string into smaller vectors, seperators are unusual signs // * * * * - for (i=0; i<(int)strLine.size(); ++i) + for (i=0; i LastValidProgress; // When diving into a dynamic argument store store + vector LastValidProgress; // When diving into a dynamic argument store store // the last valid so you can go back to it - vector LastValidArgCount; // If an alternative route turns out to fail, we + vector LastValidArgCount; // If an alternative route turns out to fail, we // need to know the amount of arguments on the last // valid position, so we can remove them. vector LastValidMatch; // Match at that point @@ -443,6 +446,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) // found and no further looking is required CParserTaskTypeNode *CurNode=NULL; // Current node on task type CParserTaskTypeNode *PrevNode=NULL; // Last node + UNUSED(PrevNode); // Iterate all different TaskType, and all TaskTypeElements... // start from left and go to the right (prog), comparing @@ -490,7 +494,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) CParserTaskTypeNode *OldNode = NULL; // Go back to regular route! - while (1) + for(;;) { OldNode = CurNode; CurNode = CurNode->m_ParentNode; @@ -566,7 +570,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) { // Find blank space if any! // and jump to the next non-blankspace - if (Progress < (int)Segments.size()) + if (Progress < Segments.size()) { // Skip blankspaces AND tabs! while (Segments[Progress].size()==1 && @@ -586,7 +590,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) else // CHECK LETTER IF IT'S CORRECT { - if (Progress < (int)Segments.size()) + if (Progress < Segments.size()) { // This should be 1-Letter long if (Segments[Progress].size() != 1) @@ -630,7 +634,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) { // Store argument in CParserValue! CParserValue value; - int i; + size_t i; switch(CurNode->m_Type) { @@ -683,7 +687,7 @@ bool CParserLine::ParseString(const CParser& Parser, string strLine) // Reset, probably is but still value.m_String = string(); - for (i=Progress; i<(int)Segments.size(); ++i) + for (i=Progress; im_ParentNode; @@ -805,7 +809,7 @@ bool CParser::InputTaskType(const string& strName, const string& strSyntax) size_t ExtractPos = 0; bool Extract = false; bool Error = false; - int i; + size_t i; bool ConstructNew = false; // If it's the first input, then don't // construct a new node, because we // we already have m_BaseNode @@ -857,7 +861,7 @@ bool CParser::InputTaskType(const string& strName, const string& strSyntax) CParserTaskTypeNode *OldNode = NULL; // Jump out of this alternative route - while (1) + for(;;) { OldNode = CurNode; CurNode = CurNode->m_ParentNode;