From a62848fdba49396eba4f52c037d2dc82130274b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 14 Sep 2004 12:08:28 +0000 Subject: [PATCH] Source cleaning: whitespaces, tabs, -1/wxID_ANY/wxDefaultCoord, TRUE/true, FALSE/false, !!/!IsEmpty(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/fdrepdlg.h | 10 ++-- include/wx/fileconf.h | 14 ++--- include/wx/filedlg.h | 4 +- include/wx/filefn.h | 20 +++---- include/wx/filename.h | 2 +- include/wx/filesys.h | 6 +- include/wx/flags.h | 80 +++++++++++++-------------- include/wx/font.h | 6 +- include/wx/fontdlg.h | 2 +- include/wx/fontenc.h | 80 +++++++++++++-------------- include/wx/fontutil.h | 6 +- include/wx/frame.h | 14 ++--- include/wx/fs_mem.h | 2 +- src/common/fddlgcmn.cpp | 4 +- src/common/ffile.cpp | 26 ++++----- src/common/file.cpp | 42 +++++++------- src/common/fileconf.cpp | 120 ++++++++++++++++++++-------------------- src/common/filefn.cpp | 54 +++++++++--------- src/common/filename.cpp | 104 +++++++++++++++++----------------- src/common/filesys.cpp | 68 +++++++++++------------ src/common/fldlgcmn.cpp | 8 +-- src/common/fmapbase.cpp | 30 +++++----- src/common/fontcmn.cpp | 26 ++++----- src/common/fontmap.cpp | 6 +- src/common/framecmn.cpp | 4 +- src/common/fs_inet.cpp | 10 ++-- src/common/fs_mem.cpp | 10 ++-- src/common/fs_zip.cpp | 14 ++--- src/common/ftp.cpp | 86 ++++++++++++++-------------- 29 files changed, 428 insertions(+), 430 deletions(-) diff --git a/include/wx/fdrepdlg.h b/include/wx/fdrepdlg.h index 9f047c2672..f8d30441f0 100644 --- a/include/wx/fdrepdlg.h +++ b/include/wx/fdrepdlg.h @@ -177,7 +177,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define EVT_FIND(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_COMMAND_FIND, id, -1, \ + wxEVT_COMMAND_FIND, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \ & fn, \ (wxObject *) NULL \ @@ -185,7 +185,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define EVT_FIND_NEXT(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_COMMAND_FIND_NEXT, id, -1, \ + wxEVT_COMMAND_FIND_NEXT, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \ & fn, \ (wxObject *) NULL \ @@ -193,7 +193,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define EVT_FIND_REPLACE(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_COMMAND_FIND_REPLACE, id, -1, \ + wxEVT_COMMAND_FIND_REPLACE, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \ & fn, \ (wxObject *) NULL \ @@ -201,7 +201,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define EVT_FIND_REPLACE_ALL(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_COMMAND_FIND_REPLACE_ALL, id, -1, \ + wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \ & fn, \ (wxObject *) NULL \ @@ -209,7 +209,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&); #define EVT_FIND_CLOSE(id, fn) \ DECLARE_EVENT_TABLE_ENTRY( \ - wxEVT_COMMAND_FIND_CLOSE, id, -1, \ + wxEVT_COMMAND_FIND_CLOSE, id, wxID_ANY, \ (wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \ & fn, \ (wxObject *) NULL \ diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index ea5eab4493..d6eb9223ba 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -89,7 +89,7 @@ in the entries it reads: for example, if you have an entry score_file = $HOME/.score a call to Read(&str, "score_file") will return a complete path to .score file - unless the expansion was previousle disabled with SetExpandEnvVars(FALSE) call + unless the expansion was previousle disabled with SetExpandEnvVars(false) call (it's on by default, the current status can be retrieved with IsExpandingEnvVars function). */ @@ -150,18 +150,18 @@ public: virtual bool GetFirstEntry(wxString& str, long& lIndex) const; virtual bool GetNextEntry (wxString& str, long& lIndex) const; - virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const; - virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const; + virtual size_t GetNumberOfEntries(bool bRecursive = false) const; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const; virtual bool HasGroup(const wxString& strName) const; virtual bool HasEntry(const wxString& strName) const; - virtual bool Flush(bool bCurrentOnly = FALSE); + virtual bool Flush(bool bCurrentOnly = false); virtual bool RenameEntry(const wxString& oldName, const wxString& newName); virtual bool RenameGroup(const wxString& oldName, const wxString& newName); - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = TRUE); + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); virtual bool DeleteGroup(const wxString& szKey); virtual bool DeleteAll(); @@ -211,7 +211,7 @@ private: *m_pCurrentGroup; // the current group wxMBConv &m_conv; - + #ifdef __UNIX__ int m_umask; // the umask to use for file creation #endif // __UNIX__ @@ -222,6 +222,6 @@ private: #endif // wxUSE_CONFIG -#endif +#endif //_FILECONF_H diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index 581aea398b..9d7cb7d30a 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -124,7 +124,7 @@ wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, wxWindow *parent = NULL, - int x = -1, int y = -1); + int x = wxDefaultCoord, int y = wxDefaultCoord); // An extended version of wxFileSelector WXDLLEXPORT wxString @@ -135,7 +135,7 @@ wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, wxWindow *parent = NULL, - int x = -1, int y = -1); + int x = wxDefaultCoord, int y = wxDefaultCoord); // Ask for filename to load WXDLLEXPORT wxString diff --git a/include/wx/filefn.h b/include/wx/filefn.h index e939d20ea0..928f608573 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -92,7 +92,7 @@ enum wxSeekMode #if wxUSE_UNICODE #if wxUSE_UNICODE_MSLU #define wxOpen wxMSLU__wopen - + #define wxAccess wxMSLU__waccess #define wxMkDir wxMSLU__wmkdir #define wxRmDir wxMSLU__wrmdir @@ -157,11 +157,11 @@ enum wxSeekMode #define wxTell(fd) lseek(fd, 0, SEEK_CUR) #define wxStructStat struct stat - + #if wxUSE_UNICODE # define wxNEED_WX_UNISTD_H #if defined(__MWERKS__) && defined(macintosh) - #include + #include #endif #if defined(__DMC__) typedef unsigned long mode_t; @@ -237,16 +237,16 @@ WXDLLIMPEXP_BASE wxString wxFindNextFile(); WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); // Does the pattern match the text (usually a filename)? -// If dot_special is TRUE, doesn't match * against . (eliminating +// If dot_special is true, doesn't match * against . (eliminating // `hidden' dot files) -WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = TRUE); +WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); // Concatenate two files to form third WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); // Copy file1 to file2 WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, - bool overwrite = TRUE); + bool overwrite = true); // Remove file WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); @@ -316,16 +316,16 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); // this is useful for wxString::IsSameAs(): to compare two file names use // filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) #if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) - #define wxARE_FILENAMES_CASE_SENSITIVE TRUE + #define wxARE_FILENAMES_CASE_SENSITIVE true #else // Windows, Mac OS and OS/2 - #define wxARE_FILENAMES_CASE_SENSITIVE FALSE + #define wxARE_FILENAMES_CASE_SENSITIVE false #endif // Unix/Windows // is the char a path separator? inline bool wxIsPathSeparator(wxChar c) { // under DOS/Windows we should understand both Unix and DOS file separators -#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) +#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) return c == wxFILE_SEP_PATH; #else return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; @@ -381,7 +381,7 @@ public: wxString FindAbsoluteValidPath(const wxString& filename); // Given full path and filename, add path to list void EnsureFileAccessible(const wxString& path); - // Returns TRUE if the path is in the list + // Returns true if the path is in the list bool Member(const wxString& path); private: diff --git a/include/wx/filename.h b/include/wx/filename.h index ef9a23dd97..e43d0b3acb 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -178,7 +178,7 @@ public: // is the filename valid at all? bool IsOk() const - { + { // we're fine if we have the path or the name or if we're a root dir return m_dirs.size() != 0 || !m_name.IsEmpty() || !m_relative; } diff --git a/include/wx/filesys.h b/include/wx/filesys.h index 6625b40bb8..46f267cf47 100644 --- a/include/wx/filesys.h +++ b/include/wx/filesys.h @@ -107,7 +107,7 @@ class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject public: wxFileSystemHandler() : wxObject() {} - // returns TRUE if this handler is able to open given location + // returns true if this handler is able to open given location virtual bool CanOpen(const wxString& location) = 0; // opens given file and returns pointer to input stream. @@ -165,10 +165,10 @@ public: // sets the current location. Every call to OpenFile is // relative to this location. // NOTE !! - // unless is_dir = TRUE 'location' is *not* the directory but + // unless is_dir = true 'location' is *not* the directory but // file contained in this directory // (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/") - void ChangePathTo(const wxString& location, bool is_dir = FALSE); + void ChangePathTo(const wxString& location, bool is_dir = false); wxString GetPath() const {return m_Path;} diff --git a/include/wx/flags.h b/include/wx/flags.h index d0b7c82c8b..cd5b2e3dba 100644 --- a/include/wx/flags.h +++ b/include/wx/flags.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/flags.h -// Purpose: a bitset suited for replacing the current style flags +// Purpose: a bitset suited for replacing the current style flags // Author: Stefan Csomor -// Modified by: +// Modified by: // Created: 27/07/03 // RCS-ID: $Id$ // Copyright: (c) 2003 Stefan Csomor @@ -20,16 +20,16 @@ // bitwise operators but keeps the type safety and information, the // enums must be in a sequence , their value determines the bit position // that they represent -// The api is made as close as possible to +// The api is made as close as possible to template class wxBitset { - friend class wxEnumData ; + friend class wxEnumData ; public: // creates a wxBitset<> object with all flags initialized to 0 wxBitset() { m_data = 0; } - // created a wxBitset<> object initialized according to the bits of the + // created a wxBitset<> object initialized according to the bits of the // integral value val wxBitset(unsigned long val) { m_data = val ; } @@ -45,116 +45,116 @@ public: // assignment wxBitset &operator =(const wxBitset &rhs) { - m_data = rhs.m_data; - return *this; + m_data = rhs.m_data; + return *this; } // bitwise or operator, sets all bits that are in rhs and leaves // the rest unchanged - wxBitset &operator |=(const wxBitset &rhs) + wxBitset &operator |=(const wxBitset &rhs) { - m_data |= rhs.m_data; - return *this; + m_data |= rhs.m_data; + return *this; } // bitwsie exclusive-or operator, toggles the value of all bits // that are set in bits and leaves all others unchanged wxBitset &operator ^=(const wxBitset &rhs) // difference { - m_data ^= rhs.m_data; - return *this; + m_data ^= rhs.m_data; + return *this; } // bitwise and operator, resets all bits that are not in rhs and leaves // all others unchanged wxBitset &operator &=(const wxBitset &rhs) // intersection { - m_data &= rhs.m_data; - return *this; + m_data &= rhs.m_data; + return *this; } - // bitwise or operator, returns a new bitset that has all bits set that set are in + // bitwise or operator, returns a new bitset that has all bits set that set are in // bitset2 or in this bitset - wxBitset operator |(const wxBitset &bitset2) const // union + wxBitset operator |(const wxBitset &bitset2) const // union { - wxBitset s; - s.m_data = m_data | bitset2.m_data; - return s; + wxBitset s; + s.m_data = m_data | bitset2.m_data; + return s; } - // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in + // bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in // bitset2 or in this bitset but not in both wxBitset operator ^(const wxBitset &bitset2) const // difference { - wxBitset s; - s.m_data = m_data ^ bitset2.m_data; - return s; + wxBitset s; + s.m_data = m_data ^ bitset2.m_data; + return s; } - // bitwise and operator, returns a new bitset that has all bits set that are set both in + // bitwise and operator, returns a new bitset that has all bits set that are set both in // bitset2 and in this bitset wxBitset operator &(const wxBitset &bitset2) const // intersection { - wxBitset s; - s.m_data = m_data & bitset2.m_data; - return s; + wxBitset s; + s.m_data = m_data & bitset2.m_data; + return s; } // sets appropriate the bit to true wxBitset& set(const T el) //Add element { - m_data |= 1 << el; - return *this; + m_data |= 1 << el; + return *this; } - + // clears the appropriate flag to false wxBitset& reset(const T el) //remove element { - m_data &= ~(1 << el); - return *this; + m_data &= ~(1 << el); + return *this; } // clear all flags wxBitset& reset() { - m_data = 0; - return *this; + m_data = 0; + return *this; } // true if this flag is set bool test(const T el) const { - return (m_data & (1 << el)) ? true : false; + return (m_data & (1 << el)) ? true : false; } // true if no flag is set bool none() const { - return m_data == 0; + return m_data == 0; } // true if any flag is set bool any() const { - return m_data != 0; + return m_data != 0; } // true if both have the same flags bool operator ==(const wxBitset &rhs) const { - return m_data == rhs.m_data; + return m_data == rhs.m_data; } // true if both differ in their flags set bool operator !=(const wxBitset &rhs) const { - return !operator==(rhs); + return !operator==(rhs); } bool operator[] (const T el) const { return test(el) ; } private : - unsigned long m_data; + unsigned long m_data; }; #define WX_DEFINE_FLAGS( flags ) \ diff --git a/include/wx/font.h b/include/wx/font.h index 14935c6833..7bbda314ab 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -123,7 +123,7 @@ public: int family, // see wxFontFamily enum int style, // see wxFontStyle enum int weight, // see wxFontWeight enum - bool underlined = FALSE, // not underlined by default + bool underlined = false, // not underlined by default const wxString& face = wxEmptyString, // facename wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... @@ -184,8 +184,8 @@ public: wxString GetWeightString() const; // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool WXUNUSED(no) = TRUE ) { } - virtual bool GetNoAntiAliasing() const { return FALSE; } + virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } + virtual bool GetNoAntiAliasing() const { return false; } // the default encoding is used for creating all fonts with default // encoding parameter diff --git a/include/wx/fontdlg.h b/include/wx/fontdlg.h index 43bc4e5ca3..e0eeec467c 100644 --- a/include/wx/fontdlg.h +++ b/include/wx/fontdlg.h @@ -51,7 +51,7 @@ public: { InitFontData(data); return Create(parent); } protected: - virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return TRUE; } + virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } void InitFontData(const wxFontData *data = NULL) { if ( data ) m_fontData = *data; } diff --git a/include/wx/fontenc.h b/include/wx/fontenc.h index 0f4b1ca9bc..69a7857179 100644 --- a/include/wx/fontenc.h +++ b/include/wx/fontenc.h @@ -76,51 +76,51 @@ enum wxFontEncoding wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding wxFONTENCODING_MACROMAN, // the standard mac encodings - wxFONTENCODING_MACJAPANESE, - wxFONTENCODING_MACCHINESETRAD, - wxFONTENCODING_MACKOREAN, - wxFONTENCODING_MACARABIC, - wxFONTENCODING_MACHEBREW, - wxFONTENCODING_MACGREEK, - wxFONTENCODING_MACCYRILLIC, - wxFONTENCODING_MACDEVANAGARI, - wxFONTENCODING_MACGURMUKHI, - wxFONTENCODING_MACGUJARATI, - wxFONTENCODING_MACORIYA, - wxFONTENCODING_MACBENGALI, - wxFONTENCODING_MACTAMIL, - wxFONTENCODING_MACTELUGU, - wxFONTENCODING_MACKANNADA, - wxFONTENCODING_MACMALAJALAM, - wxFONTENCODING_MACSINHALESE, - wxFONTENCODING_MACBURMESE, - wxFONTENCODING_MACKHMER, - wxFONTENCODING_MACTHAI, - wxFONTENCODING_MACLAOTIAN, - wxFONTENCODING_MACGEORGIAN, - wxFONTENCODING_MACARMENIAN, - wxFONTENCODING_MACCHINESESIMP, - wxFONTENCODING_MACTIBETAN, - wxFONTENCODING_MACMONGOLIAN, - wxFONTENCODING_MACETHIOPIC, - wxFONTENCODING_MACCENTRALEUR, - wxFONTENCODING_MACVIATNAMESE, - wxFONTENCODING_MACARABICEXT, - wxFONTENCODING_MACSYMBOL, - wxFONTENCODING_MACDINGBATS, - wxFONTENCODING_MACTURKISH, - wxFONTENCODING_MACCROATIAN, - wxFONTENCODING_MACICELANDIC, - wxFONTENCODING_MACROMANIAN, - wxFONTENCODING_MACCELTIC, - wxFONTENCODING_MACGAELIC, - wxFONTENCODING_MACKEYBOARD, + wxFONTENCODING_MACJAPANESE, + wxFONTENCODING_MACCHINESETRAD, + wxFONTENCODING_MACKOREAN, + wxFONTENCODING_MACARABIC, + wxFONTENCODING_MACHEBREW, + wxFONTENCODING_MACGREEK, + wxFONTENCODING_MACCYRILLIC, + wxFONTENCODING_MACDEVANAGARI, + wxFONTENCODING_MACGURMUKHI, + wxFONTENCODING_MACGUJARATI, + wxFONTENCODING_MACORIYA, + wxFONTENCODING_MACBENGALI, + wxFONTENCODING_MACTAMIL, + wxFONTENCODING_MACTELUGU, + wxFONTENCODING_MACKANNADA, + wxFONTENCODING_MACMALAJALAM, + wxFONTENCODING_MACSINHALESE, + wxFONTENCODING_MACBURMESE, + wxFONTENCODING_MACKHMER, + wxFONTENCODING_MACTHAI, + wxFONTENCODING_MACLAOTIAN, + wxFONTENCODING_MACGEORGIAN, + wxFONTENCODING_MACARMENIAN, + wxFONTENCODING_MACCHINESESIMP, + wxFONTENCODING_MACTIBETAN, + wxFONTENCODING_MACMONGOLIAN, + wxFONTENCODING_MACETHIOPIC, + wxFONTENCODING_MACCENTRALEUR, + wxFONTENCODING_MACVIATNAMESE, + wxFONTENCODING_MACARABICEXT, + wxFONTENCODING_MACSYMBOL, + wxFONTENCODING_MACDINGBATS, + wxFONTENCODING_MACTURKISH, + wxFONTENCODING_MACCROATIAN, + wxFONTENCODING_MACICELANDIC, + wxFONTENCODING_MACROMANIAN, + wxFONTENCODING_MACCELTIC, + wxFONTENCODING_MACGAELIC, + wxFONTENCODING_MACKEYBOARD, wxFONTENCODING_MAX, // highest enumerated encoding value wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , - + // aliases for endian-dependent UTF encodings #ifdef WORDS_BIGENDIAN wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16 diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h index 56099b4758..882333fa95 100644 --- a/include/wx/fontutil.h +++ b/include/wx/fontutil.h @@ -92,7 +92,7 @@ private: inline bool HasElements() const; public: - // init the elements from an XLFD, return TRUE if ok + // init the elements from an XLFD, return true if ok bool FromXFontName(const wxString& xFontName); // return false if we were never initialized with a valid XLFD @@ -211,13 +211,13 @@ public: // ---------------------------------------------------------------------------- // translate a wxFontEncoding into native encoding parameter (defined above), -// returning TRUE if an (exact) macth could be found, FALSE otherwise (without +// returning true if an (exact) macth could be found, false otherwise (without // attempting any substitutions) extern bool wxGetNativeFontEncoding(wxFontEncoding encoding, wxNativeEncodingInfo *info); // test for the existence of the font described by this facename/encoding, -// return TRUE if such font(s) exist, FALSE otherwise +// return true if such font(s) exist, false otherwise extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info); // ---------------------------------------------------------------------------- diff --git a/include/wx/frame.h b/include/wx/frame.h index adb10c54a0..053f50f07d 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -91,7 +91,7 @@ public: virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; } #endif // wxUSE_MENUS - // process menu command: returns TRUE if processed + // process menu command: returns true if processed bool ProcessCommand(int winid); // status bar functions @@ -132,7 +132,7 @@ public: #if wxUSE_TOOLBAR // create main toolbar bycalling OnCreateToolBar() virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = -1, + wxWindowID winid = wxID_ANY, const wxString& name = wxToolBarNameStr); // return a new toolbar virtual wxToolBar *OnCreateToolBar(long style, @@ -172,13 +172,13 @@ public: #ifndef wxTopLevelWindowNative virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL) - { return FALSE; } + { return false; } virtual bool IsFullScreen() const - { return FALSE; } + { return false; } #endif // no wxTopLevelWindowNative - // show help text (typically in the statusbar); show is FALSE - // if you are hiding the help, TRUE otherwise + // show help text (typically in the statusbar); show is false + // if you are hiding the help, true otherwise virtual void DoGiveHelp(const wxString& text, bool show); #if WXWIN_COMPATIBILITY_2_2 @@ -223,7 +223,7 @@ protected: virtual void PositionStatusBar() { } // show the help string for this menu item in the given status bar: the - // status bar pointer can be NULL; return TRUE if help was shown + // status bar pointer can be NULL; return true if help was shown bool ShowMenuHelp(wxStatusBar *statbar, int helpid); wxStatusBar *m_frameStatusBar; diff --git a/include/wx/fs_mem.h b/include/wx/fs_mem.h index 5b5766f106..f7224b7ec7 100644 --- a/include/wx/fs_mem.h +++ b/include/wx/fs_mem.h @@ -11,7 +11,7 @@ #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__) // Some older compilers (such as EMX) cannot handle -// #pragma interface/implementation correctly, iff +// #pragma interface/implementation correctly, iff // #pragma implementation is used in _two_ translation // units (as created by e.g. event.cpp compiled for // libwx_base and event.cpp compiled for libwx_gui_core). diff --git a/src/common/fddlgcmn.cpp b/src/common/fddlgcmn.cpp index 0a6438576e..20e18060a6 100644 --- a/src/common/fddlgcmn.cpp +++ b/src/common/fddlgcmn.cpp @@ -74,8 +74,8 @@ void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event) m_FindReplaceData->m_Flags = event.GetFlags(); m_FindReplaceData->m_FindWhat = event.GetFindString(); - if ( HasFlag(wxFR_REPLACEDIALOG) && - (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE || + if ( HasFlag(wxFR_REPLACEDIALOG) && + (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE || event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) ) { m_FindReplaceData->m_ReplaceWith = event.GetReplaceString(); diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index 503e5bfa0d..866dc2ef6a 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -62,12 +62,12 @@ bool wxFFile::Open(const wxChar *filename, const wxChar *mode) { wxLogSysError(_("can't open file '%s'"), filename); - return FALSE; + return false; } m_name = filename; - return TRUE; + return true; } bool wxFFile::Close() @@ -78,13 +78,13 @@ bool wxFFile::Close() { wxLogSysError(_("can't close file '%s'"), m_name.c_str()); - return FALSE; + return false; } Detach(); } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -93,8 +93,8 @@ bool wxFFile::Close() bool wxFFile::ReadAll(wxString *str) { - wxCHECK_MSG( str, FALSE, wxT("invalid parameter") ); - wxCHECK_MSG( IsOpened(), FALSE, wxT("can't read from closed file") ); + wxCHECK_MSG( str, false, wxT("invalid parameter") ); + wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") ); clearerr(m_fp); @@ -110,7 +110,7 @@ bool wxFFile::ReadAll(wxString *str) { wxLogSysError(_("Read error on file '%s'"), m_name.c_str()); - return FALSE; + return false; } //else: just EOF @@ -118,7 +118,7 @@ bool wxFFile::ReadAll(wxString *str) *str += buf; } - return TRUE; + return true; } size_t wxFFile::Read(void *pBuf, size_t nCount) @@ -159,11 +159,11 @@ bool wxFFile::Flush() { wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str()); - return FALSE; + return false; } } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -172,7 +172,7 @@ bool wxFFile::Flush() bool wxFFile::Seek(long ofs, wxSeekMode mode) { - wxCHECK_MSG( IsOpened(), FALSE, wxT("can't seek on closed file") ); + wxCHECK_MSG( IsOpened(), false, wxT("can't seek on closed file") ); int origin; switch ( mode ) @@ -198,10 +198,10 @@ bool wxFFile::Seek(long ofs, wxSeekMode mode) { wxLogSysError(_("Seek error on file '%s'"), m_name.c_str()); - return FALSE; + return false; } - return TRUE; + return true; } size_t wxFFile::Tell() const diff --git a/src/common/file.cpp b/src/common/file.cpp index 48608225d4..d6926e9cc6 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -202,7 +202,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode) #ifdef __WXWINCE__ // FIXME: use CreateFile with 0 access to query the file - return TRUE; + return true; #else return wxAccess(name, how) == 0; #endif @@ -216,7 +216,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode) wxFile::wxFile(const wxChar *szFileName, OpenMode mode) { m_fd = fd_invalid; - m_error = FALSE; + m_error = false; Open(szFileName, mode); } @@ -250,12 +250,12 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) if ( fd == -1 ) { wxLogSysError(_("can't create file '%s'"), szFileName); - return FALSE; + return false; } else { Attach(fd); - return TRUE; + return true; } } @@ -357,11 +357,11 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) if ( fd == -1 ) { wxLogSysError(_("can't open file '%s'"), szFileName); - return FALSE; + return false; } else { Attach(fd); - return TRUE; + return true; } } @@ -377,13 +377,13 @@ bool wxFile::Close() { wxLogSysError(_("can't close file descriptor %d"), m_fd); m_fd = fd_invalid; - return FALSE; + return false; } else m_fd = fd_invalid; } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -438,7 +438,7 @@ size_t wxFile::Write(const void *pBuf, size_t nCount) #endif if ( iRc == -1 ) { wxLogSysError(_("can't write to file descriptor %d"), m_fd); - m_error = TRUE; + m_error = true; return 0; } else @@ -455,14 +455,14 @@ bool wxFile::Flush() if ( wxFsync(m_fd) == -1 ) { wxLogSysError(_("can't flush file descriptor %d"), m_fd); - return FALSE; + return false; } #else // no fsync // just do nothing #endif // fsync } - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -606,11 +606,11 @@ bool wxFile::Eof() const DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT); DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END); if (off0 == off1) - return TRUE; + return true; else { SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN); - return FALSE; + return false; } #else int iRc; @@ -632,7 +632,7 @@ bool wxFile::Eof() const break; case 0: - return FALSE; + return false; case -1: wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd); @@ -642,7 +642,7 @@ bool wxFile::Eof() const wxFAIL_MSG(_("invalid eof() return value.")); } - return TRUE; + return true; #endif } @@ -681,13 +681,13 @@ bool wxTempFile::Open(const wxString& strName) if ( m_strTemp.empty() ) { // CreateTempFileName() failed - return FALSE; + return false; } #ifdef __UNIX__ // the temp file should have the same permissions as the original one mode_t mode; - + wxStructStat st; if ( stat( (const char*) m_strName.fn_str(), &st) == 0 ) { @@ -710,7 +710,7 @@ bool wxTempFile::Open(const wxString& strName) } #endif // Unix - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -729,15 +729,15 @@ bool wxTempFile::Commit() if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) { wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); - return FALSE; + return false; } if ( !wxRenameFile(m_strTemp, m_strName) ) { wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); - return FALSE; + return false; } - return TRUE; + return true; } void wxTempFile::Discard() diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index ef5c6c6d13..6215e1fe37 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -185,7 +185,7 @@ public: GetLine() const { return m_pLine; } // modify entry attributes - void SetValue(const wxString& strValue, bool bUser = TRUE); + void SetValue(const wxString& strValue, bool bUser = true); void SetDirty(); void SetLine(wxFileConfigLineList *pLine); @@ -204,7 +204,7 @@ private: ArrayEntries m_aEntries; // entries in this group ArrayGroups m_aSubgroups; // subgroups wxString m_strName; // group's name - bool m_bDirty; // if FALSE => all subgroups are not dirty + bool m_bDirty; // if false => all subgroups are not dirty wxFileConfigLineList *m_pLine; // pointer to our line in the linked list wxFileConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the wxFileConfigGroup *m_pLastGroup; // local file (we insert new ones after it) @@ -233,7 +233,7 @@ public: wxFileConfigGroup *FindSubgroup(const wxChar *szName) const; wxFileConfigEntry *FindEntry (const wxChar *szName) const; - // delete entry/subgroup, return FALSE if doesn't exist + // delete entry/subgroup, return false if doesn't exist bool DeleteSubgroupByName(const wxChar *szName); bool DeleteEntry(const wxChar *szName); @@ -293,7 +293,7 @@ wxString wxFileConfig::GetGlobalDir() strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1); } #elif defined(__WXSTUBS__) - wxASSERT_MSG( FALSE, wxT("TODO") ) ; + wxASSERT_MSG( false, wxT("TODO") ) ; #elif defined(__DOS__) // There's no such thing as global cfg dir in MS-DOS, let's return // current directory (FIXME_MGL?) @@ -399,7 +399,7 @@ void wxFileConfig::Init() if ( fileGlobal.Open(m_conv/*ignored in ANSI build*/) ) { - Parse(fileGlobal, FALSE /* global */); + Parse(fileGlobal, false /* global */); SetRootPath(); } else @@ -414,7 +414,7 @@ void wxFileConfig::Init() wxTextFile fileLocal(m_strLocalFile); if ( fileLocal.Open(m_conv/*ignored in ANSI build*/) ) { - Parse(fileLocal, TRUE /* local */); + Parse(fileLocal, true /* local */); SetRootPath(); } else @@ -540,7 +540,7 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv) memText.AddLine(strTrans); // Finally we can parse it all. - Parse(memText, TRUE /* local */); + Parse(memText, true /* local */); SetRootPath(); } @@ -641,12 +641,12 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal) } // check that there is nothing except comments left on this line - bool bCont = TRUE; + bool bCont = true; while ( *++pEnd != wxT('\0') && bCont ) { switch ( *pEnd ) { case wxT('#'): case wxT(';'): - bCont = FALSE; + bCont = false; break; case wxT(' '): @@ -657,7 +657,7 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal) default: wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."), buffer.GetName(), n + 1, pEnd); - bCont = FALSE; + bCont = false; } } } @@ -724,7 +724,7 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal) if ( !(GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS) ) value = FilterInValue(value); - pEntry->SetValue(value, FALSE); + pEntry->SetValue(value, false); } } } @@ -791,10 +791,10 @@ bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name(); - return TRUE; + return true; } else - return FALSE; + return false; } bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const @@ -807,10 +807,10 @@ bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name(); - return TRUE; + return true; } else - return FALSE; + return false; } size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const @@ -821,7 +821,7 @@ size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const size_t nSubgroups = m_pCurrentGroup->Groups().Count(); for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) { CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup]; - n += GetNumberOfEntries(TRUE); + n += GetNumberOfEntries(true); CONST_CAST m_pCurrentGroup = pOldCurrentGroup; } } @@ -837,7 +837,7 @@ size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const size_t nSubgroups = m_pCurrentGroup->Groups().Count(); for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) { CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup]; - n += GetNumberOfGroups(TRUE); + n += GetNumberOfGroups(true); CONST_CAST m_pCurrentGroup = pOldCurrentGroup; } } @@ -875,19 +875,19 @@ bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); if (pEntry == NULL) { - return FALSE; + return false; } *pStr = pEntry->Value(); - return TRUE; + return true; } bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const { wxString str; if ( !Read(key, &str) ) - return FALSE; + return false; // extra spaces shouldn't prevent us from reading numeric values str.Trim(); @@ -933,7 +933,7 @@ bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) { wxLogError( _("Config entry name cannot start with '%c'."), wxCONFIG_IMMUTABLE_PREFIX); - return FALSE; + return false; } wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName); @@ -952,7 +952,7 @@ bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) pEntry->SetValue(szValue); } - return TRUE; + return true; } bool wxFileConfig::DoWriteLong(const wxString& key, long lValue) @@ -963,7 +963,7 @@ bool wxFileConfig::DoWriteLong(const wxString& key, long lValue) bool wxFileConfig::Flush(bool /* bCurrentOnly */) { if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile ) - return TRUE; + return true; #ifdef __UNIX__ // set the umask if needed @@ -979,7 +979,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) if ( !file.IsOpened() ) { wxLogError(_("can't open user configuration file.")); - return FALSE; + return false; } // write all strings to file @@ -990,7 +990,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) if ( !file.Write(line, m_conv) ) { wxLogError(_("can't write user configuration file.")); - return FALSE; + return false; } } @@ -1001,18 +1001,18 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) { FSRef fsRef ; FSCatalogInfo catInfo; - FileInfo *finfo ; - - if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr ) - { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - finfo->fileType = 'TEXT' ; - finfo->fileCreator = 'ttxt' ; - FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; - } - } + FileInfo *finfo ; + + if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr ) + { + if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) + { + finfo = (FileInfo*)&catInfo.finderInfo; + finfo->fileType = 'TEXT' ; + finfo->fileCreator = 'ttxt' ; + FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; + } + } } #endif // __WXMAC__ @@ -1037,21 +1037,21 @@ bool wxFileConfig::RenameEntry(const wxString& oldName, // check that the entry exists wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName); if ( !oldEntry ) - return FALSE; + return false; // check that the new entry doesn't already exist if ( m_pCurrentGroup->FindEntry(newName) ) - return FALSE; + return false; // delete the old entry, create the new one wxString value = oldEntry->Value(); if ( !m_pCurrentGroup->DeleteEntry(oldName) ) - return FALSE; + return false; wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName); newEntry->SetValue(value); - return TRUE; + return true; } bool wxFileConfig::RenameGroup(const wxString& oldName, @@ -1060,15 +1060,15 @@ bool wxFileConfig::RenameGroup(const wxString& oldName, // check that the group exists wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName); if ( !group ) - return FALSE; + return false; // check that the new group doesn't already exist if ( m_pCurrentGroup->FindSubgroup(newName) ) - return FALSE; + return false; group->Rename(newName); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -1080,7 +1080,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso) wxConfigPathChanger path(this, key); if ( !m_pCurrentGroup->DeleteEntry(path.Name()) ) - return FALSE; + return false; if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) { if ( m_pCurrentGroup != m_pRootGroup ) { @@ -1091,7 +1091,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso) //else: never delete the root group } - return TRUE; + return true; } bool wxFileConfig::DeleteGroup(const wxString& key) @@ -1108,13 +1108,13 @@ bool wxFileConfig::DeleteAll() if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 ) { wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); - return FALSE; + return false; } m_strLocalFile = m_strGlobalFile = wxT(""); Init(); - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -1269,7 +1269,7 @@ wxFileConfigGroup::wxFileConfigGroup(wxFileConfigGroup *pParent, { m_pConfig = pConfig; m_pParent = pParent; - m_bDirty = FALSE; + m_bDirty = false; m_pLine = NULL; m_pLastEntry = NULL; @@ -1565,14 +1565,14 @@ bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName) { wxFileConfigGroup * const pGroup = FindSubgroup(szName); - return pGroup ? DeleteSubgroup(pGroup) : FALSE; + return pGroup ? DeleteSubgroup(pGroup) : false; } // Delete the subgroup and remove all references to it from // other data structures. bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) { - wxCHECK_MSG( pGroup, FALSE, _T("deleting non existing group?") ); + wxCHECK_MSG( pGroup, false, _T("deleting non existing group?") ); wxLogTrace( _T("wxFileConfig"), _T("Deleting group '%s' from '%s'"), @@ -1706,13 +1706,13 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) m_aSubgroups.Remove(pGroup); delete pGroup; - return TRUE; + return true; } bool wxFileConfigGroup::DeleteEntry(const wxChar *szName) { wxFileConfigEntry *pEntry = FindEntry(szName); - wxCHECK( pEntry != NULL, FALSE ); // deleting non existing item? + wxCHECK( pEntry != NULL, false ); // deleting non existing item? wxFileConfigLineList *pLine = pEntry->GetLine(); if ( pLine != NULL ) { @@ -1756,7 +1756,7 @@ bool wxFileConfigGroup::DeleteEntry(const wxChar *szName) m_aEntries.Remove(pEntry); delete pEntry; - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -1764,7 +1764,7 @@ bool wxFileConfigGroup::DeleteEntry(const wxChar *szName) // ---------------------------------------------------------------------------- void wxFileConfigGroup::SetDirty() { - m_bDirty = TRUE; + m_bDirty = true; if ( Parent() != NULL ) // propagate upwards Parent()->SetDirty(); } @@ -1788,7 +1788,7 @@ wxFileConfigEntry::wxFileConfigEntry(wxFileConfigGroup *pParent, m_pLine = NULL; m_bDirty = - m_bHasValue = FALSE; + m_bHasValue = false; m_bImmutable = strName[0] == wxCONFIG_IMMUTABLE_PREFIX; if ( m_bImmutable ) @@ -1810,7 +1810,7 @@ void wxFileConfigEntry::SetLine(wxFileConfigLineList *pLine) Group()->SetLastEntry(this); } -// second parameter is FALSE if we read the value from file and prevents the +// second parameter is false if we read the value from file and prevents the // entry from being marked as 'dirty' void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) { @@ -1828,7 +1828,7 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) if ( m_bHasValue && strValue == m_strValue ) return; - m_bHasValue = TRUE; + m_bHasValue = true; m_strValue = strValue; if ( bUser ) @@ -1866,7 +1866,7 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) void wxFileConfigEntry::SetDirty() { - m_bDirty = TRUE; + m_bDirty = true; Group()->SetDirty(); } @@ -2033,7 +2033,7 @@ static wxString FilterOutEntryName(const wxString& str) // // NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR // should *not* be quoted - if ( + if ( #if !wxUSE_UNICODE ((unsigned char)c < 127) && #endif // ANSI diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 650dad3402..28473ef67a 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -564,9 +564,9 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) trimchars[3] = 0; #ifdef __WXMSW__ - const wxChar SEP = wxT('\\'); + const wxChar SEP = wxT('\\'); #else - const wxChar SEP = wxT('/'); + const wxChar SEP = wxT('/'); #endif buf[0] = wxT('\0'); if (name == NULL || *name == wxT('\0')) @@ -915,9 +915,9 @@ wxString wxPathOnly (const wxString& path) #define kDefaultPathStyle kCFURLHFSPathStyle #endif -wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent ) +wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent ) { - CFURLRef fullURLRef; + CFURLRef fullURLRef; fullURLRef = CFURLCreateFromFSRef(NULL, fsRef); if ( additionalPathComponent ) { @@ -926,19 +926,19 @@ wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathCompon additionalPathComponent,false); CFRelease( parentURLRef ) ; } - CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle); - CFRelease( fullURLRef ) ; - return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding()); + CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle); + CFRelease( fullURLRef ) ; + return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding()); } -OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) +OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) { OSStatus err = noErr ; - CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false); - if ( NULL != url ) - { - if ( CFURLGetFSRef(url, fsRef) == false ) - err = fnfErr ; + CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false); + if ( NULL != url ) + { + if ( CFURLGetFSRef(url, fsRef) == false ) + err = fnfErr ; CFRelease( url ) ; } else @@ -948,7 +948,7 @@ OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) return err ; } -wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ) +wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ) { CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault, uniname->unicode, @@ -1426,7 +1426,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) if ( getcwd( lbuf , sizeof( lbuf ) ) ) { wxString res( lbuf , *wxConvCurrent ) ; - wxStrcpy( buf , res ) ; + wxStrcpy( buf , res ) ; ok = true; } else @@ -1435,12 +1435,12 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) APIRET rc; ULONG ulDriveNum = 0; ULONG ulDriveMap = 0; - rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); + rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); ok = rc == 0; - if (ok) - { - sz -= 3; - rc = ::DosQueryCurrentDir( 0 // current drive + if (ok) + { + sz -= 3; + rc = ::DosQueryCurrentDir( 0 // current drive ,cbuf + 3 ,(PULONG)&sz ); @@ -1517,7 +1517,7 @@ bool wxSetWorkingDirectory(const wxString& d) #elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__) return (chdir(wxFNSTRINGCAST d.fn_str()) == 0); #elif defined(__WINDOWS__) - + #ifdef __WIN32__ #ifdef __WXWINCE__ // No equivalent in WinCE @@ -1531,11 +1531,11 @@ bool wxSetWorkingDirectory(const wxString& d) if (isDriveSpec) { wxChar firstChar = d[0]; - + // To upper case if (firstChar > 90) firstChar = firstChar - 32; - + // To a drive number unsigned int driveNo = firstChar - 64; if (driveNo > 0) @@ -1545,10 +1545,10 @@ bool wxSetWorkingDirectory(const wxString& d) } } bool success = (chdir(WXSTRINGCAST d) == 0); - + return success; #endif - + #endif } @@ -1649,13 +1649,13 @@ time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) { wxLogLastError(_T("FileTimeToLocalFileTime")); } - + SYSTEMTIME st; if ( !::FileTimeToSystemTime(&ftLocal, &st) ) { wxLogLastError(_T("FileTimeToSystemTime")); } - + dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); return dateTime.GetTicks(); diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 84af36bbf2..83731a291a 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -677,7 +677,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) else // mkstemp() succeeded { path = wxConvFile.cMB2WX( (const char*) buf ); - + // avoid leaking the fd if ( fileTemp ) { @@ -794,12 +794,12 @@ bool wxFileName::Mkdir( const wxString& dir, int perm, int flags ) size_t count = dirs.GetCount(); for ( size_t i = 0; i < count; i++ ) { - if ( i > 0 || + if ( i > 0 || #if defined(__WXMAC__) && !defined(__DARWIN__) - // relative pathnames are exactely the other way round under mac... - !filename.IsAbsolute() + // relative pathnames are exactely the other way round under mac... + !filename.IsAbsolute() #else - filename.IsAbsolute() + filename.IsAbsolute() #endif ) currPath += wxFILE_SEP_PATH; @@ -951,7 +951,7 @@ bool wxFileName::Normalize(int flags, m_dirs.Add(dir); } - + #if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE if ( (flags & wxPATH_NORM_SHORTCUT) ) { @@ -1021,49 +1021,49 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe { wxString path, file, ext; wxSplitPath(shortcutPath, & path, & file, & ext); - - HRESULT hres; - IShellLink* psl; - bool success = FALSE; + + HRESULT hres; + IShellLink* psl; + bool success = false; // Assume it's not a shortcut if it doesn't end with lnk if (ext.Lower() != wxT("lnk")) - return FALSE; - - // create a ShellLink object - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_IShellLink, (LPVOID*) &psl); - - if (SUCCEEDED(hres)) - { - IPersistFile* ppf; - hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf); - if (SUCCEEDED(hres)) - { - WCHAR wsz[MAX_PATH]; - - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz, - MAX_PATH); - - hres = ppf->Load(wsz, 0); - if (SUCCEEDED(hres)) - { + return false; + + // create a ShellLink object + hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + IID_IShellLink, (LPVOID*) &psl); + + if (SUCCEEDED(hres)) + { + IPersistFile* ppf; + hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf); + if (SUCCEEDED(hres)) + { + WCHAR wsz[MAX_PATH]; + + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz, + MAX_PATH); + + hres = ppf->Load(wsz, 0); + if (SUCCEEDED(hres)) + { wxChar buf[2048]; - psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY); - targetFilename = wxString(buf); + psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY); + targetFilename = wxString(buf); success = (shortcutPath != targetFilename); - psl->GetArguments(buf, 2048); + psl->GetArguments(buf, 2048); wxString args(buf); if (!args.IsEmpty() && arguments) { *arguments = args; - } - } - } - } - psl->Release(); - return success; + } + } + } + } + psl->Release(); + return success; } #endif @@ -2040,14 +2040,14 @@ bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - finfo->fileType = type ; - finfo->fileCreator = creator ; - FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; + if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) + { + finfo = (FileInfo*)&catInfo.finderInfo; + finfo->fileType = type ; + finfo->fileCreator = creator ; + FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; return true ; - } + } } return false ; } @@ -2060,13 +2060,13 @@ bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - *type = finfo->fileType ; - *creator = finfo->fileCreator ; + if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) + { + finfo = (FileInfo*)&catInfo.finderInfo; + *type = finfo->fileType ; + *creator = finfo->fileCreator ; return true ; - } + } } return false ; } diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 814d17d6a6..bfc82fbab6 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -105,15 +105,15 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) return mime; #else - if ( ext.IsSameAs(wxT("htm"), FALSE) || ext.IsSameAs(_T("html"), FALSE) ) + if ( ext.IsSameAs(wxT("htm"), false) || ext.IsSameAs(_T("html"), false) ) return wxT("text/html"); - if ( ext.IsSameAs(wxT("jpg"), FALSE) || ext.IsSameAs(_T("jpeg"), FALSE) ) + if ( ext.IsSameAs(wxT("jpg"), false) || ext.IsSameAs(_T("jpeg"), false) ) return wxT("image/jpeg"); - if ( ext.IsSameAs(wxT("gif"), FALSE) ) + if ( ext.IsSameAs(wxT("gif"), false) ) return wxT("image/gif"); - if ( ext.IsSameAs(wxT("png"), FALSE) ) + if ( ext.IsSameAs(wxT("png"), false) ) return wxT("image/png"); - if ( ext.IsSameAs(wxT("bmp"), FALSE) ) + if ( ext.IsSameAs(wxT("bmp"), false) ) return wxT("image/bmp"); return wxEmptyString; #endif @@ -125,11 +125,10 @@ wxString wxFileSystemHandler::GetProtocol(const wxString& location) const { wxString s = wxEmptyString; int i, l = location.Length(); - bool fnd; + bool fnd = false; - fnd = FALSE; for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) { - if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = TRUE; + if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true; } if (!fnd) return wxT("file"); for (++i; (i < l) && (location[i] != wxT(':')); i++) s << location[i]; @@ -140,11 +139,10 @@ wxString wxFileSystemHandler::GetProtocol(const wxString& location) const wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const { int i; - bool fnd; + bool fnd = false; - fnd = FALSE; for (i = location.Length()-1; i >= 0; i--) { - if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = TRUE; + if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true; else if (fnd && (location[i] == wxT('#'))) return location.Left(i); } return wxEmptyString; @@ -155,8 +153,8 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const int i, l = location.Length(); int l2 = l + 1; - for (i = l-1; - (i >= 0) && + for (i = l-1; + (i >= 0) && ((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':'))); i--) { @@ -468,44 +466,44 @@ const static wxString g_nativePathString(wxFILE_SEP_PATH); // Returns the native path for a file URL wxFileName wxFileSystem::URLToFileName(const wxString& url) { - wxString path = url; + wxString path = url; - if ( path.Find(wxT("file://")) == 0 ) - { - path = path.Mid(7); - } + if ( path.Find(wxT("file://")) == 0 ) + { + path = path.Mid(7); + } else if ( path.Find(wxT("file:")) == 0 ) - { - path = path.Mid(5); - } - // Remove preceding double slash on Mac Classic + { + path = path.Mid(5); + } + // Remove preceding double slash on Mac Classic #if defined(__WXMAC__) && !defined(__UNIX__) else if ( path.Find(wxT("//")) == 0 ) path = path.Mid(2); #endif - + path.Replace(wxT("%25"), wxT("%")); path.Replace(wxT("%3A"), wxT(":")); #ifdef __WXMSW__ - // file urls either start with a forward slash (local harddisk), + // file urls either start with a forward slash (local harddisk), // otherwise they have a servername/sharename notation, // which only exists on msw and corresponds to a unc - if ( path[0u] == wxT('/') && path [1u] != wxT('/')) - { - path = path.Mid(1); - } - else if ( (url.Find(wxT("file://")) == 0) && + if ( path[0u] == wxT('/') && path [1u] != wxT('/')) + { + path = path.Mid(1); + } + else if ( (url.Find(wxT("file://")) == 0) && (path.Find(wxT('/')) != wxNOT_FOUND) && (path.Length() > 1) && (path[1u] != wxT(':')) ) - { - path = wxT("//") + path; - } + { + path = wxT("//") + path; + } #endif - path.Replace(g_unixPathString, g_nativePathString); + path.Replace(g_unixPathString, g_nativePathString); - return wxFileName(path, wxPATH_NATIVE); + return wxFileName(path, wxPATH_NATIVE); } // Returns the file URL for a native path @@ -517,7 +515,7 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename) #ifndef __UNIX__ // unc notation, wxMSW - if ( url.Find(wxT("\\\\")) == 0 ) + if ( url.Find(wxT("\\\\")) == 0 ) { url = wxT("//") + url.Mid(2); } diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 119665674f..6736072ba1 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -99,7 +99,7 @@ wxString wxFileDialogBase::AppendExtension(const wxString &filePath, wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH); // if fileName is of form "foo.bar" it's ok, return it - int idx_dot = fileName.Find(wxT('.'), TRUE); + int idx_dot = fileName.Find(wxT('.'), true); if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.Len() - 1)) return filePath; @@ -107,7 +107,7 @@ wxString wxFileDialogBase::AppendExtension(const wxString &filePath, wxString ext = extensionList.BeforeFirst(wxT(';')); // if ext == "foo" or "foo." there's no extension - int idx_ext_dot = ext.Find(wxT('.'), TRUE); + int idx_ext_dot = ext.Find(wxT('.'), true); if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.Len() - 1)) return filePath; else @@ -277,7 +277,7 @@ WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what, const wxChar *default_name, wxWindow *parent) { - return wxDefaultFileSelector(TRUE, what, extension, default_name, parent); + return wxDefaultFileSelector(true, what, extension, default_name, parent); } //---------------------------------------------------------------------------- @@ -289,7 +289,7 @@ WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what, const wxChar *default_name, wxWindow *parent) { - return wxDefaultFileSelector(FALSE, what, extension, default_name, parent); + return wxDefaultFileSelector(false, what, extension, default_name, parent); } #endif // wxUSE_FILEDLG diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index f1e324cb92..b7107408bd 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -198,7 +198,7 @@ class wxFontMapperModule : public wxModule { public: wxFontMapperModule() : wxModule() { } - virtual bool OnInit() { return TRUE; } + virtual bool OnInit() { return true; } virtual void OnExit() { delete wxFontMapper::Set(NULL); } DECLARE_DYNAMIC_CLASS(wxFontMapperModule) @@ -221,7 +221,7 @@ wxFontMapperBase::wxFontMapperBase() { #if wxUSE_CONFIG && wxUSE_FILECONFIG m_config = NULL; - m_configIsDummy = FALSE; + m_configIsDummy = false; #endif // wxUSE_CONFIG } @@ -295,7 +295,7 @@ wxConfigBase *wxFontMapperBase::GetConfig() if ( !m_config ) { // try the default - m_config = wxConfig::Get(FALSE /*don't create on demand*/ ); + m_config = wxConfig::Get(false /*don't create on demand*/ ); if ( !m_config ) { @@ -305,7 +305,7 @@ wxConfigBase *wxFontMapperBase::GetConfig() // but will allow us to remember the results of the questions at // least during this run m_config = new wxMemoryConfig; - m_configIsDummy = TRUE; + m_configIsDummy = true; // VS: we can't call wxConfig::Set(m_config) here because that would // disable automatic wxConfig instance creation if this code was // called before wxApp::OnInit (this happens in wxGTK -- it sets @@ -313,13 +313,13 @@ wxConfigBase *wxFontMapperBase::GetConfig() } } - if ( m_configIsDummy && wxConfig::Get(FALSE) != NULL ) + if ( m_configIsDummy && wxConfig::Get(false) != NULL ) { // VS: in case we created dummy m_config (see above), we want to switch back // to the real one as soon as one becomes available. delete m_config; - m_config = wxConfig::Get(FALSE); - m_configIsDummy = FALSE; + m_config = wxConfig::Get(false); + m_configIsDummy = false; // FIXME: ideally, we should add keys from dummy config to the real one now, // but it is a low-priority task because typical wxWin application // either doesn't use wxConfig at all or creates wxConfig object in @@ -349,7 +349,7 @@ bool wxFontMapperBase::ChangePath(const wxString& pathNew, wxString *pathOld) { wxConfigBase *config = GetConfig(); if ( !config ) - return FALSE; + return false; *pathOld = config->GetPath(); @@ -366,7 +366,7 @@ bool wxFontMapperBase::ChangePath(const wxString& pathNew, wxString *pathOld) config->SetPath(path); - return TRUE; + return true; } void wxFontMapperBase::RestorePath(const wxString& pathOld) @@ -437,7 +437,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH); wxString alias = config->Read(charset); - if ( !!alias ) + if ( !alias.IsEmpty() ) { // yes, we do - use it instead cs = alias; @@ -523,7 +523,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) cs == wxT("EUC_KR") ) { encoding = wxFONTENCODING_CP949; - } + } else if ( cs == wxT("KOI8-R") || cs == wxT("KOI8-RU") ) { @@ -543,14 +543,14 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) const wxChar *p = cs.c_str() + 3; if ( *p == wxT('-') ) p++; - + // printf( "iso %s\n", (const char*) cs.ToAscii() ); unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { // printf( "value %d\n", (int)value ); - + // make it 0 based and check that it is strictly positive in // the process (no such thing as iso8859-0 encoding) if ( (value-- > 0) && @@ -566,12 +566,12 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) else if ( cs.Left(4) == wxT("8859") ) { const wxChar *p = cs.c_str(); - + unsigned int value; if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 ) { // printf( "value %d\n", (int)value ); - + // make it 0 based and check that it is strictly positive in // the process (no such thing as iso8859-0 encoding) if ( (value-- > 0) && diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 6b09c8298a..7a5e05ca0c 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -284,42 +284,42 @@ bool wxNativeFontInfo::FromString(const wxString& s) token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; pointSize = (int)l; token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; family = (wxFontFamily)l; token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; style = (wxFontStyle)l; token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; weight = (wxFontWeight)l; token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; underlined = l != 0; faceName = tokenizer.GetNextToken(); #ifndef __WXMAC__ if( !faceName ) - return FALSE; + return false; #endif token = tokenizer.GetNextToken(); if ( !token.ToLong(&l) ) - return FALSE; + return false; encoding = (wxFontEncoding)l; - return TRUE; + return true; } wxString wxNativeFontInfo::ToString() const @@ -345,7 +345,7 @@ void wxNativeFontInfo::Init() family = wxFONTFAMILY_DEFAULT; style = wxFONTSTYLE_NORMAL; weight = wxFONTWEIGHT_NORMAL; - underlined = FALSE; + underlined = false; faceName.clear(); encoding = wxFONTENCODING_DEFAULT; } @@ -519,12 +519,12 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) wxString token = tokenizer.GetNextToken(); // normalize it - token.Trim(TRUE).Trim(FALSE).MakeLower(); + token.Trim(true).Trim(false).MakeLower(); // look for the known tokens if ( token == _T("underlined") || token == _("underlined") ) { - SetUnderlined(TRUE); + SetUnderlined(true); } else if ( token == _T("light") || token == _("light") ) { @@ -543,7 +543,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) SetPointSize(size); } #if wxUSE_FONTMAP - else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, FALSE)) + else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, false)) != wxFONTENCODING_DEFAULT ) { SetEncoding(encoding); @@ -578,7 +578,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) SetFaceName(face); } - return TRUE; + return true; } #endif // generic or wxMSW or wxOS2 diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 7d4b57ff19..a30c4f14bb 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -316,7 +316,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, wxString configEntry, encName = GetEncodingName(encoding); - if ( !!facename ) + if ( !facename.IsEmpty() ) { configEntry = facename + _T("_"); } @@ -340,13 +340,13 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, } else // use the info entered the last time { - if ( !!fontinfo && !!facename ) + if ( !fontinfo.IsEmpty() && !facename.IsEmpty() ) { // we tried to find a match with facename -- now try without it fontinfo = GetConfig()->Read(encName); } - if ( !!fontinfo ) + if ( !fontinfo.IsEmpty() ) { if ( info->FromString(fontinfo) ) { diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index eadab8e700..2e47154b2d 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -218,7 +218,7 @@ bool wxFrameBase::ProcessCommand(int id) void wxFrameBase::UpdateWindowUI(long flags) { wxWindowBase::UpdateWindowUI(flags); - + #if wxUSE_TOOLBAR if (GetToolBar()) GetToolBar()->UpdateWindowUI(flags); @@ -286,7 +286,7 @@ void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event)) void wxFrameBase::OnInternalIdle() { wxTopLevelWindow::OnInternalIdle(); - + #if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES if (wxUpdateUIEvent::CanUpdate(this)) DoMenuUpdates(); diff --git a/src/common/fs_inet.cpp b/src/common/fs_inet.cpp index 79fe5b3662..7e9ce0fe02 100644 --- a/src/common/fs_inet.cpp +++ b/src/common/fs_inet.cpp @@ -42,7 +42,7 @@ class wxTemporaryFileInputStream : public wxFileInputStream public: wxTemporaryFileInputStream(const wxString& filename) : wxFileInputStream(filename), m_filename(filename) {} - + ~wxTemporaryFileInputStream() { // NB: copied from wxFileInputStream dtor, we need to do it before @@ -52,7 +52,7 @@ public: delete m_file; m_file_destroy = false; } - wxRemoveFile(m_filename); + wxRemoveFile(m_filename); } protected: @@ -91,7 +91,7 @@ bool wxInternetFSHandler::CanOpen(const wxString& location) return (url.GetError() == wxURL_NOERR); } - return FALSE; + return false; } @@ -117,7 +117,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), s->Read(sout); } delete s; - + return new wxFSFile(new wxTemporaryFileInputStream(tmpfile), right, content, @@ -141,7 +141,7 @@ class wxFileSystemInternetModule : public wxModule virtual bool OnInit() { wxFileSystem::AddHandler(new wxInternetFSHandler); - return TRUE; + return true; } virtual void OnExit() {} }; diff --git a/src/common/fs_mem.cpp b/src/common/fs_mem.cpp index de45ca8b96..aa59f1b48c 100644 --- a/src/common/fs_mem.cpp +++ b/src/common/fs_mem.cpp @@ -9,7 +9,7 @@ #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__) // Some older compilers (such as EMX) cannot handle -// #pragma interface/implementation correctly, iff +// #pragma interface/implementation correctly, iff // #pragma implementation is used in _two_ translation // units (as created by e.g. event.cpp compiled for // libwx_base and event.cpp compiled for libwx_gui_core). @@ -79,7 +79,7 @@ class MemFSHashObj : public wxObject { #if wxUSE_DATETIME m_Time = wxDateTime::Now(); -#endif // wxUSE_DATETIME +#endif // wxUSE_DATETIME } }; @@ -137,7 +137,7 @@ wxFSFile* wxMemoryFSHandlerBase::OpenFile(wxFileSystem& WXUNUSED(fs), const wxSt GetAnchor(location) #if wxUSE_DATETIME , obj -> m_Time -#endif // wxUSE_DATETIME +#endif // wxUSE_DATETIME ); } else return NULL; @@ -175,10 +175,10 @@ bool wxMemoryFSHandlerBase::CheckHash(const wxString& filename) wxString s; s.Printf(_("Memory VFS already contains file '%s'!"), filename.c_str()); wxLogError(s); - return FALSE; + return false; } else - return TRUE; + return true; } diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index b3790e6a16..65fbf89cc2 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -47,7 +47,7 @@ wxZipFSHandler::wxZipFSHandler() : wxFileSystemHandler() { m_Archive = NULL; m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString; - m_AllowDirs = m_AllowFiles = TRUE; + m_AllowDirs = m_AllowFiles = true; m_DirsFound = NULL; } @@ -92,7 +92,7 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX); right = rightPart.GetFullPath(wxPATH_UNIX); } - + if (right.GetChar(0) == wxT('/')) right = right.Mid(1); wxFileName leftFilename = wxFileSystem::URLToFileName(left); @@ -138,11 +138,11 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags) switch (flags) { case wxFILE: - m_AllowDirs = FALSE, m_AllowFiles = TRUE; break; + m_AllowDirs = false, m_AllowFiles = true; break; case wxDIR: - m_AllowDirs = TRUE, m_AllowFiles = FALSE; break; + m_AllowDirs = true, m_AllowFiles = false; break; default: - m_AllowDirs = m_AllowFiles = TRUE; break; + m_AllowDirs = m_AllowFiles = true; break; } m_ZipFile = left; @@ -208,7 +208,7 @@ wxString wxZipFSHandler::DoFind() filename = dir.AfterLast(wxT('/')); dir = dir.BeforeLast(wxT('/')); if (!filename.IsEmpty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, FALSE)) + wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename; } else @@ -219,7 +219,7 @@ wxString wxZipFSHandler::DoFind() filename = namestr.AfterLast(wxT('/')); dir = namestr.BeforeLast(wxT('/')); if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir && - wxMatchWild(m_Pattern, filename, FALSE)) + wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + namestr; if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK) diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 5edc4b2e8b..fbb119d4de 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -69,7 +69,7 @@ static const size_t LEN_CODE = 3; // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol) -IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), TRUE) +IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), true) // ============================================================================ // implementation @@ -82,7 +82,7 @@ IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), TRUE) wxFTP::wxFTP() { m_lastError = wxPROTO_NOERR; - m_streaming = FALSE; + m_streaming = false; m_currentTransfermode = NONE; m_user = wxT("anonymous"); @@ -111,20 +111,20 @@ bool wxFTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait)) if ( !wxProtocol::Connect(addr) ) { m_lastError = wxPROTO_NETERR; - return FALSE; + return false; } if ( !m_user ) { m_lastError = wxPROTO_CONNERR; - return FALSE; + return false; } // we should have 220 welcome message if ( !CheckResult('2') ) { Close(); - return FALSE; + return false; } wxString command; @@ -133,23 +133,23 @@ bool wxFTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait)) if ( rc == '2' ) { // 230 return: user accepted without password - return TRUE; + return true; } if ( rc != '3' ) { Close(); - return FALSE; + return false; } command.Printf(wxT("PASS %s"), m_passwd.c_str()); if ( !CheckCommand(command, '2') ) { Close(); - return FALSE; + return false; } - return TRUE; + return true; } bool wxFTP::Connect(const wxString& host) @@ -166,7 +166,7 @@ bool wxFTP::Close() if ( m_streaming ) { m_lastError = wxPROTO_STREAMING; - return FALSE; + return false; } if ( IsConnected() ) @@ -241,9 +241,9 @@ char wxFTP::GetResult() // ... // xyz ... // and the intermeidate lines may start with xyz or not - bool badReply = FALSE; - bool firstLine = TRUE; - bool endOfReply = FALSE; + bool badReply = false; + bool firstLine = true; + bool endOfReply = false; while ( !endOfReply && !badReply ) { wxString line; @@ -265,7 +265,7 @@ char wxFTP::GetResult() { if ( firstLine ) { - badReply = TRUE; + badReply = true; } else { @@ -287,16 +287,16 @@ char wxFTP::GetResult() switch ( chMarker ) { case _T(' '): - endOfReply = TRUE; + endOfReply = true; break; case _T('-'): - firstLine = FALSE; + firstLine = false; break; default: // unexpected - badReply = TRUE; + badReply = true; } } else // subsequent line of multiline reply @@ -305,7 +305,7 @@ char wxFTP::GetResult() { if ( chMarker == _T(' ') ) { - endOfReply = TRUE; + endOfReply = true; } wxLogTrace(FTP_TRACE_MASK, _T("<== %s %s"), @@ -344,7 +344,7 @@ bool wxFTP::SetTransferMode(TransferMode transferMode) if ( transferMode == m_currentTransfermode ) { // nothing to do - return TRUE; + return true; } wxString mode; @@ -368,14 +368,14 @@ bool wxFTP::SetTransferMode(TransferMode transferMode) wxLogError(_("Failed to set FTP transfer mode to %s."), (const wxChar*) (transferMode == ASCII ? _("ASCII") : _("binary"))); - return FALSE; + return false; } // If we get here the operation has been succesfully completed // Set the status-member m_currentTransfermode = transferMode; - return TRUE; + return true; } bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg) @@ -390,10 +390,10 @@ bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg) { wxLogDebug(_T("FTP command '%s' failed."), fullcmd.c_str()); - return FALSE; + return false; } - return TRUE; + return true; } bool wxFTP::ChDir(const wxString& dir) @@ -468,7 +468,7 @@ bool wxFTP::Rename(const wxString& src, const wxString& dst) str = wxT("RNFR ") + src; if ( !CheckCommand(str, '3') ) - return FALSE; + return false; str = wxT("RNTO ") + dst; @@ -512,7 +512,7 @@ public: // wait for "226 transfer completed" m_ftp->CheckResult('2'); - m_ftp->m_streaming = FALSE; + m_ftp->m_streaming = false; } else { @@ -547,7 +547,7 @@ public: // read this reply m_ftp->CheckResult('2'); - m_ftp->m_streaming = FALSE; + m_ftp->m_streaming = false; } else { @@ -613,7 +613,7 @@ wxSocketClient *wxFTP::GetPort() return NULL; } - client->Notify(FALSE); + client->Notify(false); return client; } @@ -621,11 +621,11 @@ wxSocketClient *wxFTP::GetPort() bool wxFTP::Abort() { if ( !m_streaming ) - return TRUE; + return true; - m_streaming = FALSE; + m_streaming = false; if ( !CheckCommand(wxT("ABOR"), '4') ) - return FALSE; + return false; return CheckResult('2'); } @@ -650,7 +650,7 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) if ( !CheckCommand(tmp_str, '1') ) return NULL; - m_streaming = TRUE; + m_streaming = true; in_stream = new wxInputFTPStream(this, sock); @@ -678,7 +678,7 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) if ( !CheckCommand(tmp_str, '1') ) return NULL; - m_streaming = TRUE; + m_streaming = true; return new wxOutputFTPStream(this, sock); } @@ -693,7 +693,7 @@ bool wxFTP::GetList(wxArrayString& files, { wxSocketBase *sock = GetPort(); if (!sock) - return FALSE; + return false; // NLST : List of Filenames (including Directory's !) // LIST : depending on BS of FTP-Server @@ -701,14 +701,14 @@ bool wxFTP::GetList(wxArrayString& files, // - Windows : like "dir" command // - others : ? wxString line(details ? _T("LIST") : _T("NLST")); - if ( !!wildcard ) + if ( !wildcard.IsEmpty() ) { line << _T(' ') << wildcard; } if (!CheckCommand(line, '1')) { - return FALSE; + return false; } files.Empty(); while ( ReadLine(sock, line) == wxPROTO_NOERR ) @@ -719,9 +719,9 @@ bool wxFTP::GetList(wxArrayString& files, // the file list should be terminated by "226 Transfer complete"" if ( !CheckResult('2') ) - return FALSE; + return false; - return TRUE; + return true; } bool wxFTP::FileExists(const wxString& fileName) @@ -730,10 +730,10 @@ bool wxFTP::FileExists(const wxString& fileName) // current dir. It does so by simply doing an NLST (via GetList). // If this succeeds (and the list is not empty) the file exists. - bool retval = FALSE; + bool retval = false; wxArrayString fileList; - if ( GetList(fileList, fileName, FALSE) ) + if ( GetList(fileList, fileName, false) ) { // Some ftp-servers (Ipswitch WS_FTP Server 1.0.5 does this) // displays this behaviour when queried on a non-existing file: @@ -787,13 +787,13 @@ int wxFTP::GetFileSize(const wxString& fileName) &statuscode, &filesize) == 2 ) { // We've gotten a good reply. - ok = TRUE; + ok = true; } else { // Something bad happened.. A "2yz" reply with no size // Fallback - ok = FALSE; + ok = false; } } @@ -813,7 +813,7 @@ int wxFTP::GetFileSize(const wxString& fileName) // We now try to get details for the file with a "LIST"-command // and then parse the output from there.. wxArrayString fileList; - if ( GetList(fileList, fileName, TRUE) ) + if ( GetList(fileList, fileName, true) ) { if ( !fileList.IsEmpty() ) { @@ -822,7 +822,7 @@ int wxFTP::GetFileSize(const wxString& fileName) // substring containing the name we are looking for. We // stop the iteration at the first occurrence of the // filename. The search is not case-sensitive. - bool foundIt = FALSE; + bool foundIt = false; size_t i; for ( i = 0; !foundIt && i < fileList.Count(); i++ ) -- 2.45.2