diff --git a/include/wx/config.h b/include/wx/config.h index 6f1adce1c8..f8114b3901 100644 --- a/include/wx/config.h +++ b/include/wx/config.h @@ -123,8 +123,8 @@ public: virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0; // get number of entries/subgroups in the current group, with or without // it's subgroups - virtual uint GetNumberOfEntries(bool bRecursive = FALSE) const = 0; - virtual uint GetNumberOfGroups(bool bRecursive = FALSE) const = 0; + virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const = 0; + virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const = 0; // tests of existence // returns TRUE if the group by this name exists diff --git a/include/wx/defs.h b/include/wx/defs.h index 456eb162ed..75e3546dc6 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -169,22 +169,9 @@ typedef int wxWindowID; class WXDLLEXPORT wxObject; class WXDLLEXPORT wxEvent; -// Vadim's types - check whether we need them all - -/// the type for various indexes (string, arrays, ...) -typedef unsigned int uint; - -/// extended boolean type: { yes, no, may be } -typedef signed int EBool; - -/// with TRUE and FALSE is a possible value for a "3-state" boolean var -#define UNKNOWN (-1) - /** symbolic constant used by all Find()-like functions returning positive + /** symbolic constant used by all Find()-like functions returning positive integer on success as failure indicator */ #define NOT_FOUND (-1) - /** useful for Windows programmers: makes somewhat more clear all these - zeroes being passed to Windows APIs */ -#define RESERVED (NULL) // ---------------------------------------------------------------------------- // Error codes @@ -244,14 +231,6 @@ enum ErrCode #endif // OS -#if defined(__UNIX__) - #define FILE_PATH_SEPARATOR ('/') -#elif defined(__WXMSW__) - #define FILE_PATH_SEPARATOR ('\\') -#else - #define FILE_PATH_SEPARATOR ('/') -#endif - // ---------------------------------------------------------------------------- // compiler specific settings // ---------------------------------------------------------------------------- diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 37e106f5f2..1afdd85316 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -90,13 +90,13 @@ public: /// empties the list and releases memory void Clear(); /// preallocates memory for given number of items - void Alloc(uint uiSize); + void Alloc(size_t uiSize); //@} /** @name simple accessors */ //@{ /// number of elements in the array - uint Count() const { return m_uiCount; } + size_t Count() const { return m_uiCount; } /// is it empty? bool IsEmpty() const { return m_uiCount == 0; } //@} @@ -109,10 +109,10 @@ protected: /** @name items access */ //@{ /// get item at position uiIndex (range checking is done in debug version) - long& Item(uint uiIndex) const + long& Item(size_t uiIndex) const { wxASSERT( uiIndex < m_uiCount ); return m_pItems[uiIndex]; } /// same as Item() - long& operator[](uint uiIndex) const { return Item(uiIndex); } + long& operator[](size_t uiIndex) const { return Item(uiIndex); } //@} /** @name item management */ @@ -131,11 +131,11 @@ protected: /// add item assuming the array is sorted with fnCompare function void Add(long lItem, CMPFUNC fnCompare); /// add new element at given position (it becomes Item[uiIndex]) - void Insert(long lItem, uint uiIndex); + void Insert(long lItem, size_t uiIndex); /// remove first item matching this value void Remove(long lItem); /// remove item by index - void Remove(uint uiIndex); + void Remove(size_t uiIndex); //@} /// sort array elements using given compare function @@ -144,7 +144,7 @@ protected: private: void Grow(); // makes array bigger if needed - uint m_uiSize, // current size of the array + size_t m_uiSize, // current size of the array m_uiCount; // current number of elements long *m_pItems; // pointer to data @@ -172,9 +172,9 @@ public: \ { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src); \ return *this; } \ \ - T& operator[](uint uiIndex) const \ + T& operator[](size_t uiIndex) const \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ - T& Item(uint uiIndex) const \ + T& Item(size_t uiIndex) const \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ T& Last() const \ { return (T&)(wxBaseArray::Item(Count() - 1)); } \ @@ -184,15 +184,15 @@ public: \ \ void Add(T Item) \ { wxBaseArray::Add((long)Item); } \ - void Insert(T Item, uint uiIndex) \ + void Insert(T Item, size_t uiIndex) \ { wxBaseArray::Insert((long)Item, uiIndex) ; } \ \ - void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); } \ + void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); } \ void Remove(T Item) \ { int iIndex = Index(Item); \ wxCHECK2_MSG( iIndex != NOT_FOUND, return, \ "removing inexisting element in wxArray::Remove" ); \ - wxBaseArray::Remove((uint)iIndex); } \ + wxBaseArray::Remove((size_t)iIndex); } \ \ void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \ } @@ -227,9 +227,9 @@ public: \ m_fnCompare = src.m_fnCompare; \ return *this; } \ \ - T& operator[](uint uiIndex) const \ + T& operator[](size_t uiIndex) const \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ - T& Item(uint uiIndex) const \ + T& Item(size_t uiIndex) const \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ T& Last() const \ { return (T&)(wxBaseArray::Item(Count() - 1)); } \ @@ -240,12 +240,12 @@ public: \ void Add(T Item) \ { wxBaseArray::Add((long)Item, (CMPFUNC)m_fnCompare); } \ \ - void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); } \ + void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); } \ void Remove(T Item) \ { int iIndex = Index(Item); \ wxCHECK2_MSG( iIndex != NOT_FOUND, return, \ "removing inexisting element in wxArray::Remove" ); \ - wxBaseArray::Remove((uint)iIndex); } \ + wxBaseArray::Remove((size_t)iIndex); } \ \ private: \ SCMPFUNC##T m_fnCompare; \ @@ -265,9 +265,9 @@ public: \ \ ~name(); \ \ - T& operator[](uint uiIndex) const \ + T& operator[](size_t uiIndex) const \ { return *(T*)wxBaseArray::Item(uiIndex); } \ - T& Item(uint uiIndex) const \ + T& Item(size_t uiIndex) const \ { return *(T*)wxBaseArray::Item(uiIndex); } \ T& Last() const \ { return *(T*)(wxBaseArray::Item(Count() - 1)); } \ @@ -278,16 +278,16 @@ public: \ void Add(const T* pItem) \ { wxBaseArray::Add((long)pItem); } \ \ - void Insert(const T& Item, uint uiIndex); \ - void Insert(const T* pItem, uint uiIndex) \ + void Insert(const T& Item, size_t uiIndex); \ + void Insert(const T* pItem, size_t uiIndex) \ { wxBaseArray::Insert((long)pItem, uiIndex); } \ \ void Empty(); \ \ - T* Detach(uint uiIndex) \ + T* Detach(size_t uiIndex) \ { T* p = (T*)wxBaseArray::Item(uiIndex); \ wxBaseArray::Remove(uiIndex); return p; } \ - void Remove(uint uiIndex); \ + void Remove(size_t uiIndex); \ \ void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \ \ diff --git a/include/wx/file.h b/include/wx/file.h index c422a034ef..31c2aa6699 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -95,7 +95,7 @@ public: // returns number of bytes read or ofsInvalid on error off_t Read(void *pBuf, off_t nCount); // returns true on success - uint Write(const void *pBuf, uint nCount); + size_t Write(const void *pBuf, size_t nCount); // returns true on success bool Write(const wxString& s) { return Write(s.c_str(), s.Len()) != 0; } // flush data not yet written @@ -156,7 +156,7 @@ public: bool IsOpened() const { return m_file.IsOpened(); } // I/O (both functions return true on success, false on failure) - bool Write(const void *p, uint n) { return m_file.Write(p, n) != 0; } + bool Write(const void *p, size_t n) { return m_file.Write(p, n) != 0; } bool Write(const wxString& str) { return m_file.Write(str); } // different ways to close the file diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index b7a24d7747..819467f267 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -135,8 +135,8 @@ public: virtual bool GetFirstEntry(wxString& str, long& lIndex) const; virtual bool GetNextEntry (wxString& str, long& lIndex) const; - virtual uint GetNumberOfEntries(bool bRecursive = FALSE) const; - virtual uint 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; diff --git a/include/wx/gtk/dnd.h b/include/wx/gtk/dnd.h index 1ca1e33671..fa97fdc5cd 100644 --- a/include/wx/gtk/dnd.h +++ b/include/wx/gtk/dnd.h @@ -80,7 +80,7 @@ public: // StdFormat enumerations or a user-defined format) virtual bool IsSupportedFormat(wxDataFormat format) const = 0; // get the (total) size of data - virtual uint GetDataSize() const = 0; + virtual size_t GetDataSize() const = 0; // copy raw data to provided pointer virtual void GetDataHere(void *pBuf) const = 0; @@ -103,7 +103,7 @@ public: { return wxDF_TEXT; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_TEXT; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_strText.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } @@ -130,7 +130,7 @@ public: { return wxDF_FILENAME; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_FILENAME; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_files.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_files.c_str(), GetDataSize()); } diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index a30a9d6ba0..097101d094 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -153,7 +153,7 @@ private: wxImageList* m_imageList; wxList m_pages; - uint m_idHandler; // the change page handler id + size_t m_idHandler; // the change page handler id DECLARE_DYNAMIC_CLASS(wxNotebook) }; diff --git a/include/wx/gtk/treectrl.h b/include/wx/gtk/treectrl.h index d6949a6482..d5fc08a88f 100644 --- a/include/wx/gtk/treectrl.h +++ b/include/wx/gtk/treectrl.h @@ -183,8 +183,8 @@ private: return m_childlist.Number(); } - guint expand_handler; - guint collapse_handler; + guit expand_handler; + guit collapse_handler; DECLARE_DYNAMIC_CLASS(wxTreeItem) }; diff --git a/include/wx/gtk1/dnd.h b/include/wx/gtk1/dnd.h index 1ca1e33671..fa97fdc5cd 100644 --- a/include/wx/gtk1/dnd.h +++ b/include/wx/gtk1/dnd.h @@ -80,7 +80,7 @@ public: // StdFormat enumerations or a user-defined format) virtual bool IsSupportedFormat(wxDataFormat format) const = 0; // get the (total) size of data - virtual uint GetDataSize() const = 0; + virtual size_t GetDataSize() const = 0; // copy raw data to provided pointer virtual void GetDataHere(void *pBuf) const = 0; @@ -103,7 +103,7 @@ public: { return wxDF_TEXT; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_TEXT; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_strText.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } @@ -130,7 +130,7 @@ public: { return wxDF_FILENAME; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_FILENAME; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_files.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_files.c_str(), GetDataSize()); } diff --git a/include/wx/gtk1/notebook.h b/include/wx/gtk1/notebook.h index a30a9d6ba0..097101d094 100644 --- a/include/wx/gtk1/notebook.h +++ b/include/wx/gtk1/notebook.h @@ -153,7 +153,7 @@ private: wxImageList* m_imageList; wxList m_pages; - uint m_idHandler; // the change page handler id + size_t m_idHandler; // the change page handler id DECLARE_DYNAMIC_CLASS(wxNotebook) }; diff --git a/include/wx/gtk1/treectrl.h b/include/wx/gtk1/treectrl.h index d6949a6482..d5fc08a88f 100644 --- a/include/wx/gtk1/treectrl.h +++ b/include/wx/gtk1/treectrl.h @@ -183,8 +183,8 @@ private: return m_childlist.Number(); } - guint expand_handler; - guint collapse_handler; + guit expand_handler; + guit collapse_handler; DECLARE_DYNAMIC_CLASS(wxTreeItem) }; diff --git a/include/wx/intl.h b/include/wx/intl.h index e6a597ed45..1c33a3ab4e 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -28,8 +28,8 @@ // ---------------------------------------------------------------------------- // # adjust if necessary -typedef unsigned char uint8; -typedef unsigned long uint32; +typedef unsigned char size_t8; +typedef unsigned long size_t32; // ---------------------------------------------------------------------------- // macros diff --git a/include/wx/ownerdrw.h b/include/wx/ownerdrw.h index c319899d2a..050d8d9986 100644 --- a/include/wx/ownerdrw.h +++ b/include/wx/ownerdrw.h @@ -17,7 +17,7 @@ #endif typedef wxColour wxColor; -typedef unsigned int uint; +typedef unsigned int size_t; // ---------------------------------------------------------------------------- // wxOwnerDrawn - a mix-in base class, derive from it to implement owner-drawn @@ -69,8 +69,8 @@ public: // // NB: default is too small for bitmaps, but ok for checkmarks. inline void SetMarginWidth(int nWidth) - { ms_nLastMarginWidth = m_nMarginWidth = (uint) nWidth; - if ( ((uint) nWidth) != ms_nDefaultMarginWidth ) m_bOwnerDrawn = TRUE; } + { ms_nLastMarginWidth = m_nMarginWidth = (size_t) nWidth; + if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) m_bOwnerDrawn = TRUE; } inline int GetMarginWidth() const { return (int) m_nMarginWidth; } inline static int GetDefaultMarginWidth() { return (int) ms_nDefaultMarginWidth; } @@ -109,15 +109,15 @@ public: }; // virtual functions to implement drawing (return TRUE if processed) - virtual bool OnMeasureItem(uint *pwidth, uint *pheight); + virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight); virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); protected: wxString m_strName; // label for a manu item private: - static uint ms_nDefaultMarginWidth; // menu check mark width - static uint ms_nLastMarginWidth; // handy for aligning all items + static size_t ms_nDefaultMarginWidth; // menu check mark width + static size_t ms_nLastMarginWidth; // handy for aligning all items bool m_bCheckable, // used only for menu or check listbox items m_bOwnerDrawn; // true if something is non standard @@ -128,7 +128,7 @@ private: wxBitmap m_bmpChecked, // bitmap to put near the item m_bmpUnchecked; // (checked is used also for 'uncheckable' items) - uint m_nHeight, // font height + size_t m_nHeight, // font height m_nMarginWidth; // space occupied by bitmap to the left of the item }; diff --git a/include/wx/qt/dnd.h b/include/wx/qt/dnd.h index 9a83f6e0cd..217561903a 100644 --- a/include/wx/qt/dnd.h +++ b/include/wx/qt/dnd.h @@ -80,7 +80,7 @@ public: // StdFormat enumerations or a user-defined format) virtual bool IsSupportedFormat(wxDataFormat format) const = 0; // get the (total) size of data - virtual uint GetDataSize() const = 0; + virtual size_t GetDataSize() const = 0; // copy raw data to provided pointer virtual void GetDataHere(void *pBuf) const = 0; @@ -103,7 +103,7 @@ public: { return wxDF_TEXT; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_TEXT; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_strText.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } @@ -130,7 +130,7 @@ public: { return wxDF_FILENAME; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_FILENAME; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_files.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_files.c_str(), GetDataSize()); } diff --git a/include/wx/string.h b/include/wx/string.h index a4442365f3..592e5835f5 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -125,7 +125,7 @@ inline const wxString& wxGetEmptyString() { return *(wxString *)&g_szNul; } struct WXDLLEXPORT wxStringData { int nRefs; // reference count - uint nDataLength, // actual string length + size_t nDataLength, // actual string length nAllocLength; // allocated memory size // mimics declaration 'char data[nAllocLength]' @@ -254,7 +254,7 @@ public: /** @name generic attributes & operations */ //@{ /// as standard strlen() - uint Len() const { return GetStringData()->nDataLength; } + size_t Len() const { return GetStringData()->nDataLength; } /// string contains any characters? bool IsEmpty() const { return Len() == 0; } /// reinitialize string (and free data!) @@ -452,7 +452,7 @@ public: @param bReplaceAll: global replace (default) or only the first occurence @return the number of replacements made */ - uint Replace(const char *szOld, const char *szNew, bool bReplaceAll = TRUE); + size_t Replace(const char *szOld, const char *szNew, bool bReplaceAll = TRUE); //@} /// check if the string contents matches a mask containing '*' and '?' @@ -471,7 +471,7 @@ public: //@{ /// ensure that string has space for at least nLen characters // only works if the data of this string is not shared - void Alloc(uint nLen); + void Alloc(size_t nLen); /// minimize the string's memory // only works if the data of this string is not shared void Shrink(); @@ -480,7 +480,7 @@ public: Unget() *must* be called a.s.a.p. to put string back in a reasonable state! */ - char *GetWriteBuf(uint nLen); + char *GetWriteBuf(size_t nLen); /// call this immediately after GetWriteBuf() has been used void UngetWriteBuf(); //@} @@ -818,7 +818,7 @@ public: /** @name simple accessors */ //@{ /// number of elements in the array - uint Count() const { return m_nCount; } + size_t Count() const { return m_nCount; } /// is it empty? bool IsEmpty() const { return m_nCount == 0; } //@} @@ -847,7 +847,7 @@ public: /// add new element at the end void Add (const wxString& str); /// add new element at given position - void Insert(const wxString& str, uint uiIndex); + void Insert(const wxString& str, size_t uiIndex); /// remove first item matching this value void Remove(const char *sz); /// remove item by index @@ -861,7 +861,7 @@ private: void Grow(); // makes array bigger if needed void Free(); // free the string stored - size_t m_nSize, // current size of the array + size_t m_nSize, // current size of the array m_nCount; // current number of elements char **m_pItems; // pointer to data diff --git a/include/wx/stubs/checklst.h b/include/wx/stubs/checklst.h index 5cc193d98a..19b4ccb8d3 100644 --- a/include/wx/stubs/checklst.h +++ b/include/wx/stubs/checklst.h @@ -19,7 +19,7 @@ #include "wx/listbox.h" -typedef unsigned int uint; +typedef unsigned int size_t; class wxCheckListBox : public wxListBox { @@ -37,8 +37,8 @@ public: const wxString& name = wxListBoxNameStr); // items may be checked - bool IsChecked(uint uiIndex) const; - void Check(uint uiIndex, bool bCheck = TRUE); + bool IsChecked(size_t uiIndex) const; + void Check(size_t uiIndex, bool bCheck = TRUE); DECLARE_EVENT_TABLE() }; diff --git a/include/wx/stubs/dnd.h b/include/wx/stubs/dnd.h index a7c29c6613..2d3ad2f737 100644 --- a/include/wx/stubs/dnd.h +++ b/include/wx/stubs/dnd.h @@ -79,7 +79,7 @@ public: // StdFormat enumerations or a user-defined format) virtual bool IsSupportedFormat(wxDataFormat format) const = 0; // get the (total) size of data - virtual uint GetDataSize() const = 0; + virtual size_t GetDataSize() const = 0; // copy raw data to provided pointer virtual void GetDataHere(void *pBuf) const = 0; @@ -102,7 +102,7 @@ public: { return wxDF_TEXT; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_TEXT; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_strText.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } @@ -129,7 +129,7 @@ public: { return wxDF_FILENAME; } virtual bool IsSupportedFormat(wxDataFormat format) const { return format == wxDF_FILENAME; } - virtual uint GetDataSize() const + virtual size_t GetDataSize() const { return m_files.Len() + 1; } // +1 for trailing '\0'of course virtual void GetDataHere(void *pBuf) const { memcpy(pBuf, m_files.c_str(), GetDataSize()); } diff --git a/include/wx/textfile.h b/include/wx/textfile.h index 9999ffdd46..ca4b623890 100644 --- a/include/wx/textfile.h +++ b/include/wx/textfile.h @@ -63,10 +63,10 @@ public: // get the number of lines in the file size_t GetLineCount() const { return m_aLines.Count(); } // the returned line may be modified (but don't add CR/LF at the end!) - wxString& GetLine(uint n) const { return m_aLines[n]; } - wxString& operator[](uint n) const { return m_aLines[n]; } + wxString& GetLine(size_t n) const { return m_aLines[n]; } + wxString& operator[](size_t n) const { return m_aLines[n]; } // get the type of the line (see also GetEOL) - Type GetLineType(uint n) const { return m_aTypes[n]; } + Type GetLineType(size_t n) const { return m_aTypes[n]; } // guess the type of file (m_file is supposed to be opened) Type GuessType() const; // get the name of the file @@ -77,10 +77,10 @@ public: void AddLine(const wxString& str, Type type = typeDefault) { m_aLines.Add(str); m_aTypes.Add(type); } // insert a line before the line number n - void InsertLine(const wxString& str, uint n, Type type = typeDefault) + void InsertLine(const wxString& str, size_t n, Type type = typeDefault) { m_aLines.Insert(str, n); m_aTypes.Insert(type, n); } // delete one line - void RemoveLine(uint n) { m_aLines.Remove(n); m_aTypes.Remove(n); } + void RemoveLine(size_t n) { m_aLines.Remove(n); m_aTypes.Remove(n); } // change the file on disk (default argument means "don't change type") // possibly in another format diff --git a/src/common/config.cpp b/src/common/config.cpp index 1ba9f4edf2..a60ca5bc2b 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -164,8 +164,8 @@ wxString wxExpandEnvVars(const wxString& str) #endif }; - uint m; - for ( uint n = 0; n < str.Len(); n++ ) { + size_t m; + for ( size_t n = 0; n < str.Len(); n++ ) { switch ( str[n] ) { #ifdef __WXMSW__ case '%': diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 40ada21b23..eb2b4e6be9 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -101,7 +101,7 @@ void wxBaseArray::Grow() else { // add 50% but not too much - uint uiIncrement = m_uiSize < WX_ARRAY_DEFAULT_INITIAL_SIZE + size_t uiIncrement = m_uiSize < WX_ARRAY_DEFAULT_INITIAL_SIZE ? WX_ARRAY_DEFAULT_INITIAL_SIZE : m_uiSize >> 1; if ( uiIncrement > ARRAY_MAXSIZE_INCREMENT ) uiIncrement = ARRAY_MAXSIZE_INCREMENT; @@ -132,7 +132,7 @@ void wxBaseArray::Clear() } // pre-allocates memory (frees the previous data!) -void wxBaseArray::Alloc(uint uiSize) +void wxBaseArray::Alloc(size_t uiSize) { wxASSERT( uiSize > 0 ); @@ -151,7 +151,7 @@ int wxBaseArray::Index(long lItem, bool bFromEnd) const { if ( bFromEnd ) { if ( m_uiCount > 0 ) { - uint ui = m_uiCount; + size_t ui = m_uiCount; do { if ( m_pItems[--ui] == lItem ) return ui; @@ -160,7 +160,7 @@ int wxBaseArray::Index(long lItem, bool bFromEnd) const } } else { - for( uint ui = 0; ui < m_uiCount; ui++ ) { + for( size_t ui = 0; ui < m_uiCount; ui++ ) { if( m_pItems[ui] == lItem ) return ui; } @@ -172,7 +172,7 @@ int wxBaseArray::Index(long lItem, bool bFromEnd) const // search for an item in a sorted array (binary search) int wxBaseArray::Index(long lItem, CMPFUNC fnCompare) const { - uint i, + size_t i, lo = 0, hi = m_uiCount; int res; @@ -201,7 +201,7 @@ void wxBaseArray::Add(long lItem) // add item assuming the array is sorted with fnCompare function void wxBaseArray::Add(long lItem, CMPFUNC fnCompare) { - uint i, + size_t i, lo = 0, hi = m_uiCount; int res; @@ -226,7 +226,7 @@ void wxBaseArray::Add(long lItem, CMPFUNC fnCompare) } // add item at the given position -void wxBaseArray::Insert(long lItem, uint uiIndex) +void wxBaseArray::Insert(long lItem, size_t uiIndex) { wxCHECK_RET( uiIndex <= m_uiCount, _("bad index in wxArray::Insert") ); @@ -239,7 +239,7 @@ void wxBaseArray::Insert(long lItem, uint uiIndex) } // removes item from array (by index) -void wxBaseArray::Remove(uint uiIndex) +void wxBaseArray::Remove(size_t uiIndex) { wxCHECK_RET( uiIndex <= m_uiCount, _("bad index in wxArray::Remove") ); @@ -256,7 +256,7 @@ void wxBaseArray::Remove(long lItem) wxCHECK_RET( iIndex != NOT_FOUND, _("removing inexistent item in wxArray::Remove") ); - Remove((uint)iIndex); + Remove((size_t)iIndex); } // sort array elements using passed comparaison function diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 7e2f336baf..906f7d83a3 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -166,7 +166,7 @@ wxClassLibrary::wxClassLibrary(void) wxClassLibrary::~wxClassLibrary(void) { - uint i; + size_t i; for (i=0;iclass_info == class_info) { @@ -200,7 +200,7 @@ bool wxClassLibrary::CreateObjects(const wxString& path, wxArrayClassInfo& objs) { wxClassLibInfo *info; - uint i = 0; + size_t i = 0; while (i < m_list.Count()) { info = m_list[i]; @@ -215,7 +215,7 @@ bool wxClassLibrary::FetchInfos(const wxString& path, wxArrayClassLibInfo& infos) { wxClassLibInfo *info; - uint i = 0; + size_t i = 0; while (i < m_list.Count()) { info = m_list[i]; @@ -232,7 +232,7 @@ bool wxClassLibrary::FetchInfos(const wxString& path, wxObject *wxClassLibrary::CreateObject(const wxString& path) { wxClassLibInfo *info; - uint i = 0; + size_t i = 0; while (i < m_list.Count()) { info = m_list[i]; diff --git a/src/common/file.cpp b/src/common/file.cpp index b32441ff97..44c4b7b77f 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -252,11 +252,11 @@ off_t wxFile::Read(void *pBuf, off_t nCount) return wxInvalidOffset; } else - return (uint)iRc; + return (size_t)iRc; } // write -uint wxFile::Write(const void *pBuf, uint nCount) +size_t wxFile::Write(const void *pBuf, size_t nCount) { wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 5688b9aa41..454dc463ad 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -267,8 +267,8 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) const char *pEnd; wxString strLine; - uint nLineCount = file.GetLineCount(); - for ( uint n = 0; n < nLineCount; n++ ) { + size_t nLineCount = file.GetLineCount(); + for ( size_t n = 0; n < nLineCount; n++ ) { strLine = file[n]; // add the line to linked list @@ -419,7 +419,7 @@ void wxFileConfig::SetPath(const wxString& strPath) } // change current group - uint n; + size_t n; m_pCurrentGroup = m_pRootGroup; for ( n = 0; n < aParts.Count(); n++ ) { ConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]); @@ -447,7 +447,7 @@ bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const { - if ( uint(lIndex) < m_pCurrentGroup->Groups().Count() ) { + if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { str = m_pCurrentGroup->Groups()[lIndex++]->Name(); return TRUE; } @@ -463,7 +463,7 @@ bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const { - if ( uint(lIndex) < m_pCurrentGroup->Entries().Count() ) { + if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { str = m_pCurrentGroup->Entries()[lIndex++]->Name(); return TRUE; } @@ -471,13 +471,13 @@ bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const return FALSE; } -uint wxFileConfig::GetNumberOfEntries(bool bRecursive) const +size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const { - uint n = m_pCurrentGroup->Entries().Count(); + size_t n = m_pCurrentGroup->Entries().Count(); if ( bRecursive ) { ConfigGroup *pOldCurrentGroup = m_pCurrentGroup; - uint nSubgroups = m_pCurrentGroup->Groups().Count(); - for ( uint nGroup = 0; nGroup < nSubgroups; nGroup++ ) { + 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); CONST_CAST m_pCurrentGroup = pOldCurrentGroup; @@ -487,13 +487,13 @@ uint wxFileConfig::GetNumberOfEntries(bool bRecursive) const return n; } -uint wxFileConfig::GetNumberOfGroups(bool bRecursive) const +size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const { - uint n = m_pCurrentGroup->Groups().Count(); + size_t n = m_pCurrentGroup->Groups().Count(); if ( bRecursive ) { ConfigGroup *pOldCurrentGroup = m_pCurrentGroup; - uint nSubgroups = m_pCurrentGroup->Groups().Count(); - for ( uint nGroup = 0; nGroup < nSubgroups; nGroup++ ) { + 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); CONST_CAST m_pCurrentGroup = pOldCurrentGroup; @@ -790,7 +790,7 @@ wxFileConfig::ConfigGroup::ConfigGroup(wxFileConfig::ConfigGroup *pParent, wxFileConfig::ConfigGroup::~ConfigGroup() { // entries - uint n, nCount = m_aEntries.Count(); + size_t n, nCount = m_aEntries.Count(); for ( n = 0; n < nCount; n++ ) delete m_aEntries[n]; @@ -921,7 +921,7 @@ wxString wxFileConfig::ConfigGroup::GetFullName() const wxFileConfig::ConfigEntry * wxFileConfig::ConfigGroup::FindEntry(const char *szName) const { - uint i, + size_t i, lo = 0, hi = m_aEntries.Count(); int res; @@ -951,7 +951,7 @@ wxFileConfig::ConfigGroup::FindEntry(const char *szName) const wxFileConfig::ConfigGroup * wxFileConfig::ConfigGroup::FindSubgroup(const char *szName) const { - uint i, + size_t i, lo = 0, hi = m_aSubgroups.Count(); int res; @@ -1030,8 +1030,8 @@ bool wxFileConfig::ConfigGroup::DeleteSubgroup(ConfigGroup *pGroup) wxCHECK( pGroup != NULL, FALSE ); // deleting non existing group? // delete all entries - uint nCount = pGroup->m_aEntries.Count(); - for ( uint nEntry = 0; nEntry < nCount; nEntry++ ) { + size_t nCount = pGroup->m_aEntries.Count(); + for ( size_t nEntry = 0; nEntry < nCount; nEntry++ ) { LineList *pLine = pGroup->m_aEntries[nEntry]->GetLine(); if ( pLine != NULL ) m_pConfig->LineListRemove(pLine); @@ -1039,7 +1039,7 @@ bool wxFileConfig::ConfigGroup::DeleteSubgroup(ConfigGroup *pGroup) // and subgroups of this sungroup nCount = pGroup->m_aSubgroups.Count(); - for ( uint nGroup = 0; nGroup < nCount; nGroup++ ) { + for ( size_t nGroup = 0; nGroup < nCount; nGroup++ ) { pGroup->DeleteSubgroup(pGroup->m_aSubgroups[nGroup]); } @@ -1053,7 +1053,7 @@ bool wxFileConfig::ConfigGroup::DeleteSubgroup(ConfigGroup *pGroup) // go back until we find a subgroup or reach the group's line ConfigGroup *pNewLast = NULL; - uint n, nSubgroups = m_aSubgroups.Count(); + size_t n, nSubgroups = m_aSubgroups.Count(); LineList *pl; for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) { // is it our subgroup? @@ -1104,7 +1104,7 @@ bool wxFileConfig::ConfigGroup::DeleteEntry(const char *szName) // go back until we find another entry or reach the group's line ConfigEntry *pNewLast = NULL; - uint n, nEntries = m_aEntries.Count(); + size_t n, nEntries = m_aEntries.Count(); LineList *pl; for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) { // is it our subgroup? @@ -1273,7 +1273,7 @@ wxString FilterIn(const wxString& str) bool bQuoted = !str.IsEmpty() && str[0] == '"'; - for ( uint n = bQuoted ? 1 : 0; n < str.Len(); n++ ) { + for ( size_t n = bQuoted ? 1 : 0; n < str.Len(); n++ ) { if ( str[n] == '\\' ) { switch ( str[++n] ) { case 'n': @@ -1327,7 +1327,7 @@ wxString FilterOut(const wxString& str) strResult += '"'; char c; - for ( uint n = 0; n < str.Len(); n++ ) { + for ( size_t n = 0; n < str.Len(); n++ ) { switch ( str[n] ) { case '\n': c = 'n'; diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index cb4b81d818..66f56e999e 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1349,16 +1349,16 @@ void WXDLLEXPORT wxSplitPath(const char *pszFileName, const char *pSepDos = strrchr(pszFileName, FILE_SEP_PATH_DOS); // take the last of the two - uint nPosUnix = pSepUnix ? pSepUnix - pszFileName : 0; - uint nPosDos = pSepDos ? pSepDos - pszFileName : 0; + size_t nPosUnix = pSepUnix ? pSepUnix - pszFileName : 0; + size_t nPosDos = pSepDos ? pSepDos - pszFileName : 0; if ( nPosDos > nPosUnix ) nPosUnix = nPosDos; -// uint nLen = Strlen(pszFileName); +// size_t nLen = Strlen(pszFileName); if ( pstrPath ) *pstrPath = wxString(pszFileName, nPosUnix); if ( pDot ) { - uint nPosDot = pDot - pszFileName; + size_t nPosDot = pDot - pszFileName; if ( pstrName ) *pstrName = wxString(pszFileName + nPosUnix + 1, nPosDot - nPosUnix); if ( pstrExt ) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 8943f15518..6cb46f1be0 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -46,8 +46,8 @@ // ---------------------------------------------------------------------------- // magic number identifying the .mo format file -const uint32 MSGCATALOG_MAGIC = 0x950412de; -const uint32 MSGCATALOG_MAGIC_SW = 0xde120495; +const size_t32 MSGCATALOG_MAGIC = 0x950412de; +const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495; // extension of ".mo" files #define MSGCATALOG_EXTENSION ".mo" @@ -104,40 +104,40 @@ private: // an entry in the string table struct wxMsgTableEntry { - uint32 nLen; // length of the string - uint32 ofsString; // pointer to the string + size_t32 nLen; // length of the string + size_t32 ofsString; // pointer to the string }; // header of a .mo file struct wxMsgCatalogHeader { - uint32 magic, // offset +00: magic id + size_t32 magic, // offset +00: magic id revision, // +04: revision numStrings; // +08: number of strings in the file - uint32 ofsOrigTable, // +0C: start of original string table + size_t32 ofsOrigTable, // +0C: start of original string table ofsTransTable; // +10: start of translated string table - uint32 nHashSize, // +14: hash table size + size_t32 nHashSize, // +14: hash table size ofsHashTable; // +18: offset of hash table start }; // all data is stored here, NULL if no data loaded - uint8 *m_pData; + size_t8 *m_pData; // data description - uint32 m_numStrings, // number of strings in this domain + size_t32 m_numStrings, // number of strings in this domain m_nHashSize; // number of entries in hash table - uint32 *m_pHashTable; // pointer to hash table + size_t32 *m_pHashTable; // pointer to hash table wxMsgTableEntry *m_pOrigTable, // pointer to original strings *m_pTransTable; // translated - const char *StringAtOfs(wxMsgTableEntry *pTable, uint32 index) const + const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 index) const { return (const char *)(m_pData + Swap(pTable[index].ofsString)); } // utility functions // calculate the hash value of given string - static inline uint32 GetHash(const char *sz); + static inline size_t32 GetHash(const char *sz); // big<->little endian - inline uint32 Swap(uint32 ui) const; + inline size_t32 Swap(size_t32 ui) const; // internal state bool HasHashTable() const // true if hash table is present @@ -158,16 +158,16 @@ private: // calculate hash value using the so called hashpjw function by P.J. Weinberger // [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools] -uint32 wxMsgCatalog::GetHash(const char *sz) +size_t32 wxMsgCatalog::GetHash(const char *sz) { - #define HASHWORDBITS 32 // the length of uint32 + #define HASHWORDBITS 32 // the length of size_t32 - uint32 hval = 0; - uint32 g; + size_t32 hval = 0; + size_t32 g; while ( *sz != '\0' ) { hval <<= 4; - hval += (uint32)*sz++; - g = hval & ((uint32)0xf << (HASHWORDBITS - 4)); + hval += (size_t32)*sz++; + g = hval & ((size_t32)0xf << (HASHWORDBITS - 4)); if ( g != 0 ) { hval ^= g >> (HASHWORDBITS - 8); hval ^= g; @@ -178,7 +178,7 @@ uint32 wxMsgCatalog::GetHash(const char *sz) } // swap the 2 halves of 32 bit integer if needed -uint32 wxMsgCatalog::Swap(uint32 ui) const +size_t32 wxMsgCatalog::Swap(size_t32 ui) const { return m_bSwapped ? (ui << 24) | ((ui & 0xff00) << 8) | ((ui >> 8) & 0xff00) | (ui >> 24) @@ -266,7 +266,7 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName) return FALSE; // read the whole file in memory - m_pData = new uint8[nSize]; + m_pData = new size_t8[nSize]; if ( fileMsg.Read(m_pData, nSize) != nSize ) { wxDELETEA(m_pData); return FALSE; @@ -302,7 +302,7 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName) Swap(pHeader->ofsTransTable)); m_nHashSize = Swap(pHeader->nHashSize); - m_pHashTable = (uint32 *)(m_pData + Swap(pHeader->ofsHashTable)); + m_pHashTable = (size_t32 *)(m_pData + Swap(pHeader->ofsHashTable)); m_pszName = new char[strlen(szName) + 1]; strcpy(m_pszName, szName); @@ -318,13 +318,13 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const return NULL; if ( HasHashTable() ) { // use hash table for lookup if possible - uint32 nHashVal = GetHash(szOrig); - uint32 nIndex = nHashVal % m_nHashSize; + size_t32 nHashVal = GetHash(szOrig); + size_t32 nIndex = nHashVal % m_nHashSize; - uint32 nIncr = 1 + (nHashVal % (m_nHashSize - 2)); + size_t32 nIncr = 1 + (nHashVal % (m_nHashSize - 2)); while ( TRUE ) { - uint32 nStr = Swap(m_pHashTable[nIndex]); + size_t32 nStr = Swap(m_pHashTable[nIndex]); if ( nStr == 0 ) return NULL; @@ -338,7 +338,7 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const } } else { // no hash table: use default binary search - uint32 bottom = 0, + size_t32 bottom = 0, top = m_numStrings, current; while ( bottom < top ) { diff --git a/src/common/log.cpp b/src/common/log.cpp index e1840f24ad..5c9e5f3386 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -428,13 +428,13 @@ void wxLogGui::Flush() // concatenate all strings (but not too many to not overfill the msg box) wxString str; - uint nLines = 0, + size_t nLines = 0, nMsgCount = m_aMessages.Count(); // start from the most recent message - for ( uint n = nMsgCount; n > 0; n-- ) { + for ( size_t n = nMsgCount; n > 0; n-- ) { // for Windows strings longer than this value are wrapped (NT 4.0) - const uint nMsgLineWidth = 156; + const size_t nMsgLineWidth = 156; nLines += (m_aMessages[n - 1].Len() + nMsgLineWidth - 1) / nMsgLineWidth; diff --git a/src/common/string.cpp b/src/common/string.cpp index 1273610fb6..7739a1b864 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -135,10 +135,10 @@ NAMESPACE istream& operator>>(NAMESPACE istream& is, wxString& WXUNUSED(str)) ~Averager() { printf("wxString: average %s = %f\n", m_sz, ((float)m_nTotal)/m_nCount); } - void Add(uint n) { m_nTotal += n; m_nCount++; } + void Add(size_t n) { m_nTotal += n; m_nCount++; } private: - uint m_nCount, m_nTotal; + size_t m_nCount, m_nTotal; const char *m_sz; } g_averageLength("allocation size"), g_averageSummandLength("summand length"), @@ -255,7 +255,7 @@ void wxString::CopyBeforeWrite() if ( pData->IsShared() ) { pData->Unlock(); // memory not freed because shared - uint nLen = pData->nDataLength; + size_t nLen = pData->nDataLength; AllocBuffer(nLen); memcpy(m_pchData, pData->data(), nLen*sizeof(char)); } @@ -280,7 +280,7 @@ void wxString::AllocBeforeWrite(size_t nLen) } // allocate enough memory for nLen characters -void wxString::Alloc(uint nLen) +void wxString::Alloc(size_t nLen) { wxStringData *pData = GetStringData(); if ( pData->nAllocLength <= nLen ) { @@ -297,7 +297,7 @@ void wxString::Alloc(uint nLen) } else if ( pData->IsShared() ) { pData->Unlock(); // memory not freed because shared - uint nOldLen = pData->nDataLength; + size_t nOldLen = pData->nDataLength; AllocBuffer(nLen); memcpy(m_pchData, pData->data(), nOldLen*sizeof(char)); } @@ -338,7 +338,7 @@ void wxString::Shrink() } // get the pointer to writable buffer of (at least) nLen bytes -char *wxString::GetWriteBuf(uint nLen) +char *wxString::GetWriteBuf(size_t nLen) { AllocBeforeWrite(nLen); @@ -441,8 +441,8 @@ void wxString::ConcatSelf(int nSrcLen, const char *pszSrcData) // so we don't waste our time checking for it // if ( nSrcLen > 0 ) wxStringData *pData = GetStringData(); - uint nLen = pData->nDataLength; - uint nNewLen = nLen + nSrcLen; + size_t nLen = pData->nDataLength; + size_t nNewLen = nLen + nSrcLen; // alloc new buffer if current is too small if ( pData->IsShared() ) { @@ -648,11 +648,11 @@ wxString wxString::After(char ch) const } // replace first (or all) occurences of some substring with another one -uint wxString::Replace(const char *szOld, const char *szNew, bool bReplaceAll) +size_t wxString::Replace(const char *szOld, const char *szNew, bool bReplaceAll) { - uint uiCount = 0; // count of replacements made + size_t uiCount = 0; // count of replacements made - uint uiOldLen = Strlen(szOld); + size_t uiOldLen = Strlen(szOld); wxString strTemp; const char *pCurrent = m_pchData; @@ -886,7 +886,7 @@ bool wxString::Matches(const char *pszMask) const return TRUE; // are there any other metacharacters in the mask? - uint uiLenMask; + size_t uiLenMask; const char *pEndMask = strpbrk(pszMask, "*?"); if ( pEndMask != NULL ) { @@ -1099,7 +1099,7 @@ wxArrayString& wxArrayString::operator=(const wxArrayString& src) // we can't just copy the pointers here because otherwise we would share // the strings with another array - for ( uint n = 0; n < src.m_nCount; n++ ) + for ( size_t n = 0; n < src.m_nCount; n++ ) Add(src[n]); if ( m_nCount != 0 ) @@ -1197,7 +1197,7 @@ int wxArrayString::Index(const char *sz, bool bCase, bool bFromEnd) const { if ( bFromEnd ) { if ( m_nCount > 0 ) { - uint ui = m_nCount; + size_t ui = m_nCount; do { if ( STRING(m_pItems[--ui])->IsSameAs(sz, bCase) ) return ui; @@ -1206,7 +1206,7 @@ int wxArrayString::Index(const char *sz, bool bCase, bool bFromEnd) const } } else { - for( uint ui = 0; ui < m_nCount; ui++ ) { + for( size_t ui = 0; ui < m_nCount; ui++ ) { if( STRING(m_pItems[ui])->IsSameAs(sz, bCase) ) return ui; } @@ -1266,7 +1266,7 @@ void wxArrayString::Remove(const char *sz) wxCHECK_RET( iIndex != NOT_FOUND, _("removing inexistent element in wxArrayString::Remove") ); - Remove((size_t)iIndex); + Remove(iIndex); } // sort array elements using passed comparaison function diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index d67663557e..cf3095cd5e 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -101,13 +101,13 @@ wxTextFile::Type wxTextFile::GuessType() const wxASSERT( m_file.IsOpened() && m_file.Tell() == 0 ); // scan the file lines - uint nUnix = 0, // number of '\n's alone + size_t nUnix = 0, // number of '\n's alone nDos = 0, // number of '\r\n' nMac = 0; // number of '\r's // we take MAX_LINES_SCAN in the beginning, middle and the end of file #define MAX_LINES_SCAN (10) - uint nCount = m_aLines.Count() / 3, + size_t nCount = m_aLines.Count() / 3, nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3; #define AnalyseLine(n) \ @@ -118,7 +118,7 @@ wxTextFile::Type wxTextFile::GuessType() const default: wxFAIL_MSG(_("unknown line terminator")); \ } - uint n; + size_t n; for ( n = 0; n < nScan; n++ ) // the beginning AnalyseLine(n); for ( n = (nCount - nScan)/2; n < (nCount + nScan)/2; n++ ) @@ -228,8 +228,8 @@ bool wxTextFile::Write(Type typeNew) return FALSE; } - uint nCount = m_aLines.Count(); - for ( uint n = 0; n < nCount; n++ ) { + size_t nCount = m_aLines.Count(); + for ( size_t n = 0; n < nCount; n++ ) { fileTmp.Write(m_aLines[n] + GetEOL(typeNew == Type_None ? m_aTypes[n] : typeNew)); } diff --git a/src/gtk.inc b/src/gtk.inc index ab11a9c095..33c7871a84 100644 --- a/src/gtk.inc +++ b/src/gtk.inc @@ -33,7 +33,6 @@ LIB_CPP_SRC=\ common/memory.cpp \ common/module.cpp \ common/object.cpp \ - common/odbc.cpp \ common/postscrp.cpp \ common/prntbase.cpp \ common/resource.cpp \ @@ -162,20 +161,20 @@ LIB_C_SRC=\ gdk_imlib/misc.c \ gdk_imlib/rend.c \ gdk_imlib/save.c \ - gdk_imlib/utils.c \ -\ - iodbc/dlf.c \ - iodbc/dlproc.c \ - iodbc/herr.c \ - iodbc/henv.c \ - iodbc/hdbc.c \ - iodbc/hstmt.c \ - iodbc/connect.c \ - iodbc/prepare.c \ - iodbc/result.c \ - iodbc/execute.c \ - iodbc/fetch.c \ - iodbc/info.c \ - iodbc/catalog.c \ - iodbc/misc.c \ - iodbc/itrace.c + gdk_imlib/utils.c +# \ +# iodbc/dlf.c \ +# iodbc/dlproc.c \ +# iodbc/herr.c \ +# iodbc/henv.c \ +# iodbc/hdbc.c \ +# iodbc/hstmt.c \ +# iodbc/connect.c \ +# iodbc/prepare.c \ +# iodbc/result.c \ +# iodbc/execute.c \ +# iodbc/fetch.c \ +# iodbc/info.c \ +# iodbc/catalog.c \ +# iodbc/misc.c \ +# iodbc/itrace.c diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index 71a4a2e6ed..c84b714204 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -57,7 +57,7 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget ) wxString formats; int valid = 0; - for ( uint i = 0; i < GetFormatCount(); i++ ) + for ( size_t i = 0; i < GetFormatCount(); i++ ) { wxDataFormat df = GetFormat( i ); switch (df) @@ -150,7 +150,7 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source wxDataObject *data = source->m_data; - uint size = data->GetDataSize(); + size_t size = data->GetDataSize(); char *ptr = new char[size]; data->GetDataHere( ptr ); diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index 71a4a2e6ed..c84b714204 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -57,7 +57,7 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget ) wxString formats; int valid = 0; - for ( uint i = 0; i < GetFormatCount(); i++ ) + for ( size_t i = 0; i < GetFormatCount(); i++ ) { wxDataFormat df = GetFormat( i ); switch (df) @@ -150,7 +150,7 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source wxDataObject *data = source->m_data; - uint size = data->GetDataSize(); + size_t size = data->GetDataSize(); char *ptr = new char[size]; data->GetDataHere( ptr ); diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index e388e1fb2d..f0c2c0ee23 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -47,7 +47,7 @@ class wxCheckListBoxItem : public wxOwnerDrawn { public: // ctor - wxCheckListBoxItem(wxCheckListBox *pParent, uint nIndex); + wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); // drawing functions virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); @@ -60,10 +60,10 @@ public: private: bool m_bChecked; wxCheckListBox *m_pParent; - uint m_nIndex; + size_t m_nIndex; }; -wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, uint nIndex) +wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) : wxOwnerDrawn("", TRUE) // checkable { m_bChecked = FALSE; @@ -95,7 +95,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, if ( wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) ) { // ## using native API for performance and precision - uint nCheckWidth = GetDefaultMarginWidth(), + size_t nCheckWidth = GetDefaultMarginWidth(), nCheckHeight = m_pParent->GetItemHeight(); int x = rc.GetX(), @@ -188,8 +188,8 @@ void wxCheckListBoxItem::Toggle() { m_bChecked = !m_bChecked; - uint nHeight = m_pParent->GetItemHeight(); - uint y = m_nIndex * nHeight; + size_t nHeight = m_pParent->GetItemHeight(); + size_t y = m_nIndex * nHeight; RECT rcUpdate = { 0, y, GetDefaultMarginWidth(), y + nHeight}; InvalidateRect((HWND)m_pParent->GetHWND(), &rcUpdate, FALSE); @@ -236,7 +236,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, // -------------------- // create a check list box item -wxOwnerDrawn *wxCheckListBox::CreateItem(uint nIndex) +wxOwnerDrawn *wxCheckListBox::CreateItem(size_t nIndex) { wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex); if ( m_windowFont.Ok() ) @@ -270,12 +270,12 @@ bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) // check items // ----------- -bool wxCheckListBox::IsChecked(uint uiIndex) const +bool wxCheckListBox::IsChecked(size_t uiIndex) const { return GetItem(uiIndex)->IsChecked(); } -void wxCheckListBox::Check(uint uiIndex, bool bCheck) +void wxCheckListBox::Check(size_t uiIndex, bool bCheck) { GetItem(uiIndex)->Check(bCheck); } @@ -296,8 +296,8 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event) // clicking on the item selects it, clicking on the checkmark toggles if ( event.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth() ) { // # better use LB_ITEMFROMPOINT perhaps? - uint nItem = ((uint)event.GetY()) / m_nItemHeight; - if ( nItem < (uint)m_noItems ) + size_t nItem = ((size_t)event.GetY()) / m_nItemHeight; + if ( nItem < (size_t)m_noItems ) GetItem(nItem)->Toggle(); //else: it's not an error, just click outside of client zone } diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 4c6b19b03b..48f1c0345c 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -100,7 +100,7 @@ static PAINTSTRUCT g_paintStruct; // for example, if calling a base class OnPaint. WXHDC wxPaintDC::ms_PaintHDC = 0; -uint wxPaintDC::ms_PaintCount = 0; // count of ms_PaintHDC usage +size_t wxPaintDC::ms_PaintCount = 0; // count of ms_PaintHDC usage wxPaintDC::wxPaintDC(wxWindow *canvas) { diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp index 18a824f274..6a33921c5b 100644 --- a/src/msw/iniconf.cpp +++ b/src/msw/iniconf.cpp @@ -97,7 +97,7 @@ void wxIniConfig::SetPath(const wxString& strPath) wxSplitPath(aParts, strFullPath); } - uint nPartsCount = aParts.Count(); + size_t nPartsCount = aParts.Count(); m_strPath.Empty(); if ( nPartsCount == 0 ) { // go to the root @@ -106,7 +106,7 @@ void wxIniConfig::SetPath(const wxString& strPath) else { // translate m_strGroup = aParts[0u]; - for ( uint nPart = 1; nPart < nPartsCount; nPart++ ) { + for ( size_t nPart = 1; nPart < nPartsCount; nPart++ ) { if ( nPart > 1 ) m_strPath << PATH_SEP_REPLACE; m_strPath << aParts[nPart]; @@ -206,18 +206,18 @@ bool wxIniConfig::GetNextEntry (wxString& str, long& lIndex) const // ---------------------------------------------------------------------------- // not implemented -uint wxIniConfig::GetNumberOfEntries(bool bRecursive) const +size_t wxIniConfig::GetNumberOfEntries(bool bRecursive) const { wxFAIL_MSG("not implemented"); - return (uint)-1; + return (size_t)-1; } -uint wxIniConfig::GetNumberOfGroups(bool bRecursive) const +size_t wxIniConfig::GetNumberOfGroups(bool bRecursive) const { wxFAIL_MSG("not implemented"); - return (uint)-1; + return (size_t)-1; } bool wxIniConfig::HasGroup(const wxString& strName) const @@ -408,7 +408,7 @@ bool wxIniConfig::DeleteAll() // then delete our own ini file char szBuf[MAX_PATH]; - uint nRc = GetWindowsDirectory(szBuf, WXSIZEOF(szBuf)); + size_t nRc = GetWindowsDirectory(szBuf, WXSIZEOF(szBuf)); if ( nRc == 0 ) wxLogLastError("GetWindowsDirectory"); else if ( nRc > WXSIZEOF(szBuf) ) diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 8eac8338fa..f15ecf02e9 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -67,7 +67,7 @@ wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE) SetMarginWidth(0); } -wxOwnerDrawn *wxListBox::CreateItem(uint n) +wxOwnerDrawn *wxListBox::CreateItem(size_t n) { return new wxListBoxItem(); } @@ -224,14 +224,14 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, // Subclass again to catch messages SubclassWin((WXHWND)wx_list); - uint ui; - for (ui = 0; ui < (uint)n; ui++) { + size_t ui; + for (ui = 0; ui < (size_t)n; ui++) { SendMessage(wx_list, LB_ADDSTRING, 0, (LPARAM)(const char *)choices[ui]); } #if USE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { - for (ui = 0; ui < (uint)n; ui++) { + for (ui = 0; ui < (size_t)n; ui++) { // create new item which will process WM_{DRAW|MEASURE}ITEM messages wxOwnerDrawn *pNewItem = CreateItem(ui); pNewItem->SetName(choices[ui]); @@ -256,7 +256,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, wxListBox::~wxListBox(void) { #if USE_OWNER_DRAWN - uint uiCount = m_aItems.Count(); + size_t uiCount = m_aItems.Count(); while ( uiCount-- != 0 ) { delete m_aItems[uiCount]; } @@ -340,14 +340,14 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData) #if USE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // first delete old items - uint ui = m_aItems.Count(); + size_t ui = m_aItems.Count(); while ( ui-- != 0 ) { delete m_aItems[ui]; } m_aItems.Empty(); // then create new ones - for (ui = 0; ui < (uint)n; ui++) { + for (ui = 0; ui < (size_t)n; ui++) { wxOwnerDrawn *pNewItem = CreateItem(ui); pNewItem->SetName(choices[ui]); m_aItems.Add(pNewItem); @@ -595,9 +595,9 @@ wxListBox::InsertItems(int nItems, const wxString items[], int pos) #if USE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { for ( i = 0; i < nItems; i++ ) { - wxOwnerDrawn *pNewItem = CreateItem((uint)(pos + i)); + wxOwnerDrawn *pNewItem = CreateItem((size_t)(pos + i)); pNewItem->SetName(items[i]); - m_aItems.Insert(pNewItem, (uint)(pos + i)); + m_aItems.Insert(pNewItem, (size_t)(pos + i)); ListBox_SetItemData(hwnd, i, pNewItem); } } diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 0e583d7f1f..538c053be0 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -363,8 +363,8 @@ void wxNotebook::OnSize(wxSizeEvent& event) GetSize((int *)&rc.right, (int *)&rc.bottom); TabCtrl_AdjustRect(m_hwnd, FALSE, &rc); - uint nCount = m_aPages.Count(); - for ( uint nPage = 0; nPage < nCount; nPage++ ) { + size_t nCount = m_aPages.Count(); + for ( size_t nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_aPages[nPage]; pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); if ( pPage->GetAutoLayout() ) diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index 2de92ce709..efec456070 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -159,7 +159,7 @@ const char *GetIidName(REFIID riid) #undef ADD_KNOWN_IID // try to find the interface in the table - for ( uint ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) { + for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) { if ( riid == *aKnownIids[ui].pIid ) { return aKnownIids[ui].szName; } diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index 117b784af3..a1dd82145f 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -46,18 +46,18 @@ wxOwnerDrawn::wxOwnerDrawn(const wxString& str, } #if defined(__WXMSW__) && defined(__WIN32__) - uint wxOwnerDrawn::ms_nDefaultMarginWidth = GetSystemMetrics(SM_CXMENUCHECK); + size_t wxOwnerDrawn::ms_nDefaultMarginWidth = GetSystemMetrics(SM_CXMENUCHECK); #else // # what is the reasonable default? - uint wxOwnerDrawn::ms_nDefaultMarginWidth = 15; + size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 15; #endif -uint wxOwnerDrawn::ms_nLastMarginWidth = ms_nDefaultMarginWidth; +size_t wxOwnerDrawn::ms_nLastMarginWidth = ms_nDefaultMarginWidth; // drawing // ------- // get size of the item -bool wxOwnerDrawn::OnMeasureItem(uint *pwidth, uint *pheight) +bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) { wxMemoryDC dc; dc.SetFont(GetFont()); diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 854d39f7d0..991e334f5b 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -111,7 +111,7 @@ void wxRegConfig::SetPath(const wxString& strPath) // recombine path parts in one variable wxString strRegPath; m_strPath.Empty(); - for ( uint n = 0; n < aParts.Count(); n++ ) { + for ( size_t n = 0; n < aParts.Count(); n++ ) { strRegPath << '\\' << aParts[n]; m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n]; } @@ -198,9 +198,9 @@ bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const return bOk; } -uint wxRegConfig::GetNumberOfEntries(bool bRecursive) const +size_t wxRegConfig::GetNumberOfEntries(bool bRecursive) const { - uint nEntries = 0; + size_t nEntries = 0; // dummy vars wxString str; @@ -215,9 +215,9 @@ uint wxRegConfig::GetNumberOfEntries(bool bRecursive) const return nEntries; } -uint wxRegConfig::GetNumberOfGroups(bool bRecursive) const +size_t wxRegConfig::GetNumberOfGroups(bool bRecursive) const { - uint nGroups = 0; + size_t nGroups = 0; // dummy vars wxString str; diff --git a/src/msw/region.cpp b/src/msw/region.cpp index a65999c240..dc55e46bff 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -342,7 +342,7 @@ void wxRegionIterator::Reset(const wxRegion& region) m_rects = new wxRect[header->nCount]; RECT* rect = (RECT*) (rgnData + sizeof(RGNDATAHEADER)) ; - uint i; + size_t i; for (i = 0; i < header->nCount; i++) { m_rects[i] = wxRect(rect->left, rect->top, diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 0653504aea..c4b547d93f 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -86,6 +86,10 @@ aStdKeys[] = // the registry name separator (perhaps one day MS will change it to '/' ;-) #define REG_SEPARATOR '\\' +// useful for Windows programmers: makes somewhat more clear all these zeroes +// being passed to Windows APIs +#define RESERVED (NULL) + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -122,7 +126,7 @@ const size_t wxRegKey::nStdKeys = WXSIZEOF(aStdKeys); // @@ should take a `StdKey key', but as it's often going to be used in loops // it would require casts in user code. -const char *wxRegKey::GetStdKeyName(uint key) +const char *wxRegKey::GetStdKeyName(size_t key) { // return empty string if key is invalid wxCHECK_MSG( key < nStdKeys, "", "invalid key in wxRegKey::GetStdKeyName" ); @@ -130,7 +134,7 @@ const char *wxRegKey::GetStdKeyName(uint key) return aStdKeys[key].szName; } -const char *wxRegKey::GetStdKeyShortName(uint key) +const char *wxRegKey::GetStdKeyShortName(size_t key) { // return empty string if key is invalid wxCHECK( key < nStdKeys, "" ); @@ -143,7 +147,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey) wxString strRoot = strKey.Left(REG_SEPARATOR); HKEY hRootKey; - uint ui; + size_t ui; for ( ui = 0; ui < nStdKeys; ui++ ) { if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 || strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) { @@ -168,7 +172,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey) wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(HKEY hkey) { - for ( uint ui = 0; ui < nStdKeys; ui++ ) { + for ( size_t ui = 0; ui < nStdKeys; ui++ ) { if ( aStdKeys[ui].hkey == hkey ) return (StdKey)ui; } @@ -298,10 +302,10 @@ wxString wxRegKey::GetName(bool bShortPrefix) const } #ifdef __GNUWIN32__ -bool wxRegKey::GetKeyInfo(uint* pnSubKeys, - uint* pnMaxKeyLen, - uint* pnValues, - uint* pnMaxValueLen) const +bool wxRegKey::GetKeyInfo(size_t* pnSubKeys, + size_t* pnMaxKeyLen, + size_t* pnValues, + size_t* pnMaxValueLen) const #else bool wxRegKey::GetKeyInfo(ulong *pnSubKeys, ulong *pnMaxKeyLen, @@ -427,8 +431,8 @@ bool wxRegKey::DeleteSelf() bCont = GetNextKey(strKey, lIndex); } - uint nKeyCount = astrSubkeys.Count(); - for ( uint nKey = 0; nKey < nKeyCount; nKey++ ) { + size_t nKeyCount = astrSubkeys.Count(); + for ( size_t nKey = 0; nKey < nKeyCount; nKey++ ) { wxRegKey key(*this, astrSubkeys[nKey]); if ( !key.DeleteSelf() ) return FALSE;