Source cleaning: whitespaces, tabs, -1/wxID_ANY/wxNOT_FOUND/wxDefaultCoord, TRUE/true, FALSE/false.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-09-22 14:38:52 +00:00
parent 0837533260
commit d775fa8235
32 changed files with 405 additions and 405 deletions

View File

@@ -107,7 +107,7 @@ public:
virtual int Type() { return wxSockAddress::IPV4; } virtual int Type() { return wxSockAddress::IPV4; }
virtual wxSockAddress *Clone() const; virtual wxSockAddress *Clone() const;
bool operator==(wxIPV4address& addr); bool operator==(wxIPV4address& addr);
private: private:
@@ -131,7 +131,7 @@ public:
// IPV6 name formats // IPV6 name formats
// //
// hostname // hostname
// 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566
// compact (base85) Itu&-ZQ82s>J%s99FJXT // compact (base85) Itu&-ZQ82s>J%s99FJXT
// compressed format ::1 // compressed format ::1
// ipv4 mapped ::ffff:1.2.3.4 // ipv4 mapped ::ffff:1.2.3.4
@@ -148,7 +148,7 @@ public:
// any (0000:0000:0000:0000:0000:0000:0000:0000 (::)) // any (0000:0000:0000:0000:0000:0000:0000:0000 (::))
virtual bool AnyAddress(); virtual bool AnyAddress();
// 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 // 3ffe:ffff:0100:f101:0210:a4ff:fee3:9566
virtual wxString IPAddress() const; virtual wxString IPAddress() const;
virtual wxString Hostname() const; virtual wxString Hostname() const;

View File

@@ -79,8 +79,8 @@ public:
virtual bool Disconnect(void); virtual bool Disconnect(void);
// Callbacks to BOTH - override at will // Callbacks to BOTH - override at will
// Default behaviour is to delete connection and return TRUE // Default behaviour is to delete connection and return true
virtual bool OnDisconnect(void) { delete this; return TRUE; } virtual bool OnDisconnect(void) { delete this; return true; }
// To enable the compressor (NOTE: not implemented!) // To enable the compressor (NOTE: not implemented!)
void Compress(bool on); void Compress(bool on);
@@ -116,7 +116,7 @@ public:
wxTCPServer(); wxTCPServer();
virtual ~wxTCPServer(); virtual ~wxTCPServer();
// Returns FALSE on error (e.g. port number is already in use) // Returns false on error (e.g. port number is already in use)
virtual bool Create(const wxString& serverName); virtual bool Create(const wxString& serverName);
// Callbacks to SERVER - override at will // Callbacks to SERVER - override at will

View File

@@ -32,7 +32,7 @@ namespace wxPrivate
// ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't // ScopeGuardImplBase but gcc 2.8 which is still used for OS/2 doesn't
// support member templates and so we must make it global // support member templates and so we must make it global
template <typename ScopeGuardImpl> template <typename ScopeGuardImpl>
void OnScopeExit(ScopeGuardImpl& guard) void OnScopeExit(ScopeGuardImpl& guard)
{ {
if ( !guard.WasDismissed() ) if ( !guard.WasDismissed() )
{ {
@@ -51,7 +51,7 @@ namespace wxPrivate
{ {
} }
} // namespace wxPrivate } // namespace wxPrivate
// ============================================================================ // ============================================================================
// wxScopeGuard for functions and functors // wxScopeGuard for functions and functors
// ============================================================================ // ============================================================================
@@ -73,7 +73,7 @@ public:
protected: protected:
~wxScopeGuardImplBase() { } ~wxScopeGuardImplBase() { }
wxScopeGuardImplBase(const wxScopeGuardImplBase& other) wxScopeGuardImplBase(const wxScopeGuardImplBase& other)
: m_wasDismissed(other.m_wasDismissed) : m_wasDismissed(other.m_wasDismissed)
{ {
other.Dismiss(); other.Dismiss();
@@ -111,7 +111,7 @@ protected:
wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&); wxScopeGuardImpl0& operator=(const wxScopeGuardImpl0&);
}; };
template <typename F> template <typename F>
inline wxScopeGuardImpl0<F> wxMakeGuard(F fun) inline wxScopeGuardImpl0<F> wxMakeGuard(F fun)
{ {
return wxScopeGuardImpl0<F>::MakeGuard(fun); return wxScopeGuardImpl0<F>::MakeGuard(fun);
@@ -143,7 +143,7 @@ protected:
wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&); wxScopeGuardImpl1& operator=(const wxScopeGuardImpl1&);
}; };
template <typename F, typename P1> template <typename F, typename P1>
inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1) inline wxScopeGuardImpl1<F, P1> wxMakeGuard(F fun, P1 p1)
{ {
return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1); return wxScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
@@ -233,7 +233,7 @@ public:
void Execute() { (m_obj.*m_memfun)(m_p1); } void Execute() { (m_obj.*m_memfun)(m_p1); }
protected: protected:
wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) wxObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1)
: m_obj(obj), m_memfun(memFun), m_p1(p1) { } : m_obj(obj), m_memfun(memFun), m_p1(p1) { }
Obj& m_obj; Obj& m_obj;
@@ -263,7 +263,7 @@ public:
void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); } void Execute() { (m_obj.*m_memfun)(m_p1, m_p2); }
protected: protected:
wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) wxObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2)
: m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { } : m_obj(obj), m_memfun(memFun), m_p1(p1), m_p2(p2) { }
Obj& m_obj; Obj& m_obj;

View File

@@ -37,7 +37,7 @@ public:
virtual void SetThumbPosition(int viewStart) = 0; virtual void SetThumbPosition(int viewStart) = 0;
virtual void SetScrollbar(int position, int thumbSize, virtual void SetScrollbar(int position, int thumbSize,
int range, int pageSize, int range, int pageSize,
bool refresh = TRUE) = 0; bool refresh = true) = 0;
private: private:
DECLARE_NO_COPY_CLASS(wxScrollBarBase) DECLARE_NO_COPY_CLASS(wxScrollBarBase)

View File

@@ -35,7 +35,7 @@ public:
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY, int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0, int xPos = 0, int yPos = 0,
bool noRefresh = FALSE ); bool noRefresh = false );
// scroll to the given (in logical coords) position // scroll to the given (in logical coords) position
virtual void Scroll(int x, int y); virtual void Scroll(int x, int y);
@@ -51,9 +51,9 @@ public:
virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX, virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
int *pixelsPerUnitY) const; int *pixelsPerUnitY) const;
// Enable/disable Windows scrolling in either direction. If TRUE, wxWidgets // Enable/disable Windows scrolling in either direction. If true, wxWidgets
// scrolls the canvas and only a bit of the canvas is invalidated; no // scrolls the canvas and only a bit of the canvas is invalidated; no
// Clear() is necessary. If FALSE, the whole canvas is invalidated and a // Clear() is necessary. If false, the whole canvas is invalidated and a
// Clear() is necessary. Disable for when the scroll increment is used to // Clear() is necessary. Disable for when the scroll increment is used to
// actually scroll a non-constant distance // actually scroll a non-constant distance
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
@@ -121,7 +121,7 @@ public:
// stop the timer, so it will be called repeatedly and will typically // stop the timer, so it will be called repeatedly and will typically
// return different values depending on the current mouse position // return different values depending on the current mouse position
// //
// the base class version just returns TRUE // the base class version just returns true
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
// the methods to be called from the window event handlers // the methods to be called from the window event handlers
@@ -219,7 +219,7 @@ protected:
public: public:
wxScrolledWindow() { } wxScrolledWindow() { }
wxScrolledWindow(wxWindow *parent, wxScrolledWindow(wxWindow *parent,
wxWindowID winid = -1, wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxScrolledWindowStyle, long style = wxScrolledWindowStyle,

View File

@@ -48,7 +48,7 @@ public:
void SetItemCount(size_t count) { m_count = count; } void SetItemCount(size_t count) { m_count = count; }
// special case of SetItemCount(0) // special case of SetItemCount(0)
void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = FALSE; } void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; }
// must be called when a new item is inserted/added // must be called when a new item is inserted/added
void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( _T("TODO") ); } void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( _T("TODO") ); }
@@ -59,7 +59,7 @@ public:
// select one item, use SelectRange() insted if possible! // select one item, use SelectRange() insted if possible!
// //
// returns true if the items selection really changed // returns true if the items selection really changed
bool SelectItem(size_t item, bool select = TRUE); bool SelectItem(size_t item, bool select = true);
// select the range of items // select the range of items
// //
@@ -68,7 +68,7 @@ public:
// (meaning that too many items changed state to bother counting them // (meaning that too many items changed state to bother counting them
// individually) // individually)
bool SelectRange(size_t itemFrom, size_t itemTo, bool SelectRange(size_t itemFrom, size_t itemTo,
bool select = TRUE, bool select = true,
wxArrayInt *itemsChanged = NULL); wxArrayInt *itemsChanged = NULL);
// return true if the given item is selected // return true if the given item is selected
@@ -83,12 +83,12 @@ public:
private: private:
// (re)init // (re)init
void Init() { m_defaultState = FALSE; } void Init() { m_defaultState = false; }
// the total number of items we handle // the total number of items we handle
size_t m_count; size_t m_count;
// the default state: normally, FALSE (i.e. off) but maybe set to TRUE if // the default state: normally, false (i.e. off) but maybe set to true if
// there are more selected items than non selected ones - this allows to // there are more selected items than non selected ones - this allows to
// handle selection of all items efficiently // handle selection of all items efficiently
bool m_defaultState; bool m_defaultState;

View File

@@ -44,7 +44,7 @@ public:
// path is optional and is ignored under Win32 and used as the directory to // path is optional and is ignored under Win32 and used as the directory to
// create the lock file in under Unix (default is wxGetHomeDir()) // create the lock file in under Unix (default is wxGetHomeDir())
// //
// returns FALSE if initialization failed, it doesn't mean that another // returns false if initialization failed, it doesn't mean that another
// instance is running - use IsAnotherRunning() to check it // instance is running - use IsAnotherRunning() to check it
bool Create(const wxString& name, const wxString& path = wxEmptyString); bool Create(const wxString& name, const wxString& path = wxEmptyString);

View File

@@ -136,7 +136,7 @@ public:
wxSocketBase& Write(const void *buffer, wxUint32 nbytes); wxSocketBase& Write(const void *buffer, wxUint32 nbytes);
wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes); wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes);
void InterruptWait() { m_interrupt = TRUE; }; void InterruptWait() { m_interrupt = true; };
bool Wait(long seconds = -1, long milliseconds = 0); bool Wait(long seconds = -1, long milliseconds = 0);
bool WaitForRead(long seconds = -1, long milliseconds = 0); bool WaitForRead(long seconds = -1, long milliseconds = 0);
bool WaitForWrite(long seconds = -1, long milliseconds = 0); bool WaitForWrite(long seconds = -1, long milliseconds = 0);
@@ -153,7 +153,7 @@ public:
// event handling // event handling
void *GetClientData() const { return m_clientData; } void *GetClientData() const { return m_clientData; }
void SetClientData(void *data) { m_clientData = data; } void SetClientData(void *data) { m_clientData = data; }
void SetEventHandler(wxEvtHandler& handler, int id = -1); void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY);
void SetNotify(wxSocketEventFlags flags); void SetNotify(wxSocketEventFlags flags);
void Notify(bool notify); void Notify(bool notify);
@@ -236,8 +236,8 @@ class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase
public: public:
wxSocketServer(wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); wxSocketServer(wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE);
wxSocketBase* Accept(bool wait = TRUE); wxSocketBase* Accept(bool wait = true);
bool AcceptWith(wxSocketBase& socket, bool wait = TRUE); bool AcceptWith(wxSocketBase& socket, bool wait = true);
bool WaitForAccept(long seconds = -1, long milliseconds = 0); bool WaitForAccept(long seconds = -1, long milliseconds = 0);
@@ -257,7 +257,7 @@ public:
wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
virtual ~wxSocketClient(); virtual ~wxSocketClient();
virtual bool Connect(wxSockAddress& addr, bool wait = TRUE); virtual bool Connect(wxSockAddress& addr, bool wait = true);
bool WaitOnConnect(long seconds = -1, long milliseconds = 0); bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
@@ -321,7 +321,7 @@ public:
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
#define EVT_SOCKET(id, func) \ #define EVT_SOCKET(id, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SOCKET, id, -1, \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SOCKET, id, wxID_ANY, \
(wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSocketEventFunction, & func ), \ (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSocketEventFunction, & func ), \
(wxObject *) NULL ), (wxObject *) NULL ),

View File

@@ -6,7 +6,7 @@
// Created: 2004/02/01 // Created: 2004/02/01
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 2004, Vaclav Slavik // Copyright: (c) 2004, Vaclav Slavik
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SOUND_H_BASE_ #ifndef _WX_SOUND_H_BASE_
@@ -27,7 +27,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Flags for wxSound::Play // Flags for wxSound::Play
// NB: We can't use enum because there would be ambiguity between the // NB: We can't use enum because there would be ambiguity between the
// two Play() prototypes when called without explicit parameters // two Play() prototypes when called without explicit parameters
// if WXWIN_COMPATIBILITY_2_4. // if WXWIN_COMPATIBILITY_2_4.
@@ -56,7 +56,7 @@ public:
// Plays sound from filename: // Plays sound from filename:
static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC); static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC);
protected: protected:
virtual bool DoPlay(unsigned flags) const = 0; virtual bool DoPlay(unsigned flags) const = 0;
}; };

View File

@@ -112,11 +112,11 @@ typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
// macros for handling spin events // macros for handling spin events
#define EVT_SPIN_UP(winid, func) \ #define EVT_SPIN_UP(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEUP, winid, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ), DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEUP, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ),
#define EVT_SPIN_DOWN(winid, func) \ #define EVT_SPIN_DOWN(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEDOWN, winid, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ), DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEDOWN, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ),
#define EVT_SPIN(winid, func) \ #define EVT_SPIN(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, winid, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ), DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & func ), NULL ),
#endif // wxUSE_SPINBTN #endif // wxUSE_SPINBTN

View File

@@ -70,7 +70,7 @@ protected:
#endif // platform #endif // platform
#define EVT_SPINCTRL(id, fn) \ #define EVT_SPINCTRL(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_SPINCTRL_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & fn ), (wxObject *) NULL ), DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_SPINCTRL_UPDATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSpinEventFunction, & fn ), (wxObject *) NULL ),
#endif // _WX_SPINCTRL_H_ #endif // _WX_SPINCTRL_H_

View File

@@ -16,28 +16,28 @@
#define WX_DECLARE_STACK(obj, cls)\ #define WX_DECLARE_STACK(obj, cls)\
class cls : public wxVectorBase\ class cls : public wxVectorBase\
{\ {\
WX_DECLARE_VECTORBASE(obj, cls);\ WX_DECLARE_VECTORBASE(obj, cls);\
public:\ public:\
void push(const obj& o)\ void push(const obj& o)\
{\ {\
bool rc = Alloc(size() + 1);\ bool rc = Alloc(size() + 1);\
wxASSERT(rc);\ wxASSERT(rc);\
Append(new obj(o));\ Append(new obj(o));\
};\ };\
\ \
void pop()\ void pop()\
{\ {\
RemoveAt(size() - 1);\ RemoveAt(size() - 1);\
};\ };\
\ \
obj& top()\ obj& top()\
{\ {\
return *(obj *) GetItem(size() - 1);\ return *(obj *) GetItem(size() - 1);\
};\ };\
const obj& top() const\ const obj& top() const\
{\ {\
return *(obj *) GetItem(size() - 1);\ return *(obj *) GetItem(size() - 1);\
};\ };\
} }
#endif // _WX_STACK_H_ #endif // _WX_STACK_H_

View File

@@ -34,14 +34,14 @@ class WXDLLEXPORT wxStaticBitmapBase : public wxControl
public: public:
wxStaticBitmapBase() { } wxStaticBitmapBase() { }
virtual ~wxStaticBitmapBase(); virtual ~wxStaticBitmapBase();
// our interface // our interface
virtual void SetIcon(const wxIcon& icon) = 0; virtual void SetIcon(const wxIcon& icon) = 0;
virtual void SetBitmap(const wxBitmap& bitmap) = 0; virtual void SetBitmap(const wxBitmap& bitmap) = 0;
virtual wxBitmap GetBitmap() const = 0; virtual wxBitmap GetBitmap() const = 0;
// overriden base class virtuals // overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; } virtual bool AcceptsFocus() const { return false; }
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;

View File

@@ -58,12 +58,12 @@ protected:
wxSize sizeReal(size); wxSize sizeReal(size);
if ( IsVertical() ) if ( IsVertical() )
{ {
if ( size.x == -1 ) if ( size.x == wxDefaultCoord )
sizeReal.x = GetDefaultSize(); sizeReal.x = GetDefaultSize();
} }
else else
{ {
if ( size.y == -1 ) if ( size.y == wxDefaultCoord )
sizeReal.y = GetDefaultSize(); sizeReal.y = GetDefaultSize();
} }

View File

@@ -76,8 +76,8 @@ public:
// field styles // field styles
// ------------ // ------------
// Set the field style. Use either wxSB_NORMAL (default) for a standard 3D // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
// border around a field, wxSB_FLAT for no border around a field, so that it // border around a field, wxSB_FLAT for no border around a field, so that it
// appears flat or wxSB_POPOUT to make the field appear raised. // appears flat or wxSB_POPOUT to make the field appear raised.
// Setting field styles only works on wxMSW // Setting field styles only works on wxMSW
virtual void SetStatusStyles(int n, const int styles[]); virtual void SetStatusStyles(int n, const int styles[]);
@@ -96,7 +96,7 @@ public:
virtual int GetBorderY() const = 0; virtual int GetBorderY() const = 0;
// don't want status bars to accept the focus at all // don't want status bars to accept the focus at all
virtual bool AcceptsFocus() const { return FALSE; } virtual bool AcceptsFocus() const { return false; }
protected: protected:
// set the widths array to NULL // set the widths array to NULL
@@ -132,7 +132,7 @@ protected:
// width otherwise // width otherwise
int *m_statusWidths; int *m_statusWidths;
// the styles of the fields // the styles of the fields
int *m_statusStyles; int *m_statusStyles;
// stacks of previous values for PushStatusText/PopStatusText // stacks of previous values for PushStatusText/PopStatusText

View File

@@ -73,7 +73,7 @@ void WXDLLIMPEXP_BASE wxStartTimer();
// Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime
// -- DEPRECATED: use wxStopWatch instead // -- DEPRECATED: use wxStopWatch instead
long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = TRUE); long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true);
#endif // wxUSE_LONGLONG #endif // wxUSE_LONGLONG

View File

@@ -159,7 +159,7 @@ public:
// all the requested data or not // all the requested data or not
virtual size_t LastRead() const { return wxStreamBase::m_lastcount; } virtual size_t LastRead() const { return wxStreamBase::m_lastcount; }
// returns TRUE if some data is available in the stream right now, so that // returns true if some data is available in the stream right now, so that
// calling Read() wouldn't block // calling Read() wouldn't block
virtual bool CanRead() const; virtual bool CanRead() const;
@@ -181,7 +181,7 @@ public:
// put back the specified character in the stream // put back the specified character in the stream
// //
// returns TRUE if ok, FALSE on error // returns true if ok, false on error
bool Ungetch(char c); bool Ungetch(char c);
@@ -284,7 +284,7 @@ public:
wxCountingOutputStream(); wxCountingOutputStream();
size_t GetSize() const; size_t GetSize() const;
bool Ok() const { return TRUE; } bool Ok() const { return true; }
protected: protected:
virtual size_t OnSysWrite(const void *buffer, size_t size); virtual size_t OnSysWrite(const void *buffer, size_t size);
@@ -375,9 +375,9 @@ public:
void ResetBuffer(); void ResetBuffer();
// NB: the buffer must always be allocated with malloc() if takeOwn is // NB: the buffer must always be allocated with malloc() if takeOwn is
// TRUE as it will be deallocated by free() // true as it will be deallocated by free()
void SetBufferIO(void *start, void *end, bool takeOwnership = FALSE); void SetBufferIO(void *start, void *end, bool takeOwnership = false);
void SetBufferIO(void *start, size_t len, bool takeOwnership = FALSE); void SetBufferIO(void *start, size_t len, bool takeOwnership = false);
void SetBufferIO(size_t bufsize); void SetBufferIO(size_t bufsize);
void *GetBufferStart() const { return m_buffer_start; } void *GetBufferStart() const { return m_buffer_start; }
void *GetBufferEnd() const { return m_buffer_end; } void *GetBufferEnd() const { return m_buffer_end; }

View File

@@ -698,7 +698,7 @@ public:
size_t Len() const { return length(); } size_t Len() const { return length(); }
// string contains any characters? // string contains any characters?
bool IsEmpty() const { return empty(); } bool IsEmpty() const { return empty(); }
// empty string is "FALSE", so !str will return TRUE // empty string is "false", so !str will return true
bool operator!() const { return IsEmpty(); } bool operator!() const { return IsEmpty(); }
// truncate the string to given length // truncate the string to given length
wxString& Truncate(size_t uiLen); wxString& Truncate(size_t uiLen);
@@ -978,10 +978,10 @@ public:
int CmpNoCase(const wxChar *psz) const { return wxStricmp(c_str(), psz); } int CmpNoCase(const wxChar *psz) const { return wxStricmp(c_str(), psz); }
// test for the string equality, either considering case or not // test for the string equality, either considering case or not
// (if compareWithCase then the case matters) // (if compareWithCase then the case matters)
bool IsSameAs(const wxChar *psz, bool compareWithCase = TRUE) const bool IsSameAs(const wxChar *psz, bool compareWithCase = true) const
{ return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; } { return (compareWithCase ? Cmp(psz) : CmpNoCase(psz)) == 0; }
// comparison with a signle character: returns TRUE if equal // comparison with a signle character: returns true if equal
bool IsSameAs(wxChar c, bool compareWithCase = TRUE) const bool IsSameAs(wxChar c, bool compareWithCase = true) const
{ {
return (length() == 1) && (compareWithCase ? GetChar(0u) == c return (length() == 1) && (compareWithCase ? GetChar(0u) == c
: wxToupper(GetChar(0u)) == wxToupper(c)); : wxToupper(GetChar(0u)) == wxToupper(c));
@@ -998,7 +998,7 @@ public:
// check that the string starts with prefix and return the rest of the // check that the string starts with prefix and return the rest of the
// string in the provided pointer if it is not NULL, otherwise return // string in the provided pointer if it is not NULL, otherwise return
// FALSE // false
bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const;
// get first nCount characters // get first nCount characters
@@ -1035,25 +1035,25 @@ public:
// trimming/padding whitespace (either side) and truncating // trimming/padding whitespace (either side) and truncating
// remove spaces from left or from right (default) side // remove spaces from left or from right (default) side
wxString& Trim(bool bFromRight = TRUE); wxString& Trim(bool bFromRight = true);
// add nCount copies chPad in the beginning or at the end (default) // add nCount copies chPad in the beginning or at the end (default)
wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = TRUE); wxString& Pad(size_t nCount, wxChar chPad = wxT(' '), bool bFromRight = true);
// searching and replacing // searching and replacing
// searching (return starting index, or -1 if not found) // searching (return starting index, or -1 if not found)
int Find(wxChar ch, bool bFromEnd = FALSE) const; // like strchr/strrchr int Find(wxChar ch, bool bFromEnd = false) const; // like strchr/strrchr
// searching (return starting index, or -1 if not found) // searching (return starting index, or -1 if not found)
int Find(const wxChar *pszSub) const; // like strstr int Find(const wxChar *pszSub) const; // like strstr
// replace first (or all of bReplaceAll) occurences of substring with // replace first (or all of bReplaceAll) occurences of substring with
// another string, returns the number of replacements made // another string, returns the number of replacements made
size_t Replace(const wxChar *szOld, size_t Replace(const wxChar *szOld,
const wxChar *szNew, const wxChar *szNew,
bool bReplaceAll = TRUE); bool bReplaceAll = true);
// check if the string contents matches a mask containing '*' and '?' // check if the string contents matches a mask containing '*' and '?'
bool Matches(const wxChar *szMask) const; bool Matches(const wxChar *szMask) const;
// conversion to numbers: all functions return TRUE only if the whole // conversion to numbers: all functions return true only if the whole
// string is a number and put the value of this number into the pointer // string is a number and put the value of this number into the pointer
// provided, the base is the numeric base in which the conversion should be // provided, the base is the numeric base in which the conversion should be
// done and must be comprised between 2 and 36 or be 0 in which case the // done and must be comprised between 2 and 36 or be 0 in which case the
@@ -1136,8 +1136,8 @@ public:
int First( const wxChar ch ) const { return Find(ch); } int First( const wxChar ch ) const { return Find(ch); }
int First( const wxChar* psz ) const { return Find(psz); } int First( const wxChar* psz ) const { return Find(psz); }
int First( const wxString &str ) const { return Find(str); } int First( const wxString &str ) const { return Find(str); }
int Last( const wxChar ch ) const { return Find(ch, TRUE); } int Last( const wxChar ch ) const { return Find(ch, true); }
bool Contains(const wxString& str) const { return Find(str) != -1; } bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
// use IsEmpty() // use IsEmpty()
bool IsNull() const { return IsEmpty(); } bool IsNull() const { return IsEmpty(); }

View File

@@ -6,7 +6,7 @@
// Created: 2001-07-10 // Created: 2001-07-10
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SYSOPT_H_ #ifndef _WX_SYSOPT_H_

View File

@@ -144,7 +144,7 @@ bool wxIPV4address::Hostname(const wxString& name)
if (name == wxT("")) if (name == wxT(""))
{ {
wxLogWarning( _("Trying to solve a NULL hostname: giving up") ); wxLogWarning( _("Trying to solve a NULL hostname: giving up") );
return FALSE; return false;
} }
m_origHostname = name; m_origHostname = name;
return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR); return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR);
@@ -207,21 +207,21 @@ wxSockAddress *wxIPV4address::Clone() const
} }
wxString wxIPV4address::IPAddress() const wxString wxIPV4address::IPAddress() const
{ {
unsigned long raw = GAddress_INET_GetHostAddress(m_address); unsigned long raw = GAddress_INET_GetHostAddress(m_address);
return wxString::Format( return wxString::Format(
_T("%u.%u.%u.%u"), _T("%u.%u.%u.%u"),
(unsigned char)((raw>>24) & 0xff), (unsigned char)((raw>>24) & 0xff),
(unsigned char)((raw>>16) & 0xff), (unsigned char)((raw>>16) & 0xff),
(unsigned char)((raw>>8) & 0xff), (unsigned char)((raw>>8) & 0xff),
(unsigned char)(raw & 0xff) (unsigned char)(raw & 0xff)
); );
} }
bool wxIPV4address::operator==(wxIPV4address& addr) bool wxIPV4address::operator==(wxIPV4address& addr)
{ {
if(Hostname().Cmp(addr.Hostname().c_str()) == 0 && Service() == addr.Service()) return true; if(Hostname().Cmp(addr.Hostname().c_str()) == 0 && Service() == addr.Service()) return true;
return false; return false;
} }
#if wxUSE_IPV6 #if wxUSE_IPV6
@@ -248,14 +248,14 @@ bool wxIPV6address::Hostname(const wxString& name)
if (name == wxT("")) if (name == wxT(""))
{ {
wxLogWarning( _("Trying to solve a NULL hostname: giving up") ); wxLogWarning( _("Trying to solve a NULL hostname: giving up") );
return FALSE; return false;
} }
return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR); return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR);
} }
bool wxIPV6address::Hostname(unsigned char[16] WXUNUSED(addr)) bool wxIPV6address::Hostname(unsigned char[16] WXUNUSED(addr))
{ {
return TRUE; return true;
} }
bool wxIPV6address::Service(const wxString& name) bool wxIPV6address::Service(const wxString& name)
@@ -284,15 +284,15 @@ bool wxIPV6address::AnyAddress()
} }
wxString wxIPV6address::IPAddress() const wxString wxIPV6address::IPAddress() const
{ {
unsigned long raw = GAddress_INET_GetHostAddress(m_address); unsigned long raw = GAddress_INET_GetHostAddress(m_address);
return wxString::Format( return wxString::Format(
_T("%u.%u.%u.%u"), _T("%u.%u.%u.%u"),
(unsigned char)((raw>>24) & 0xff), (unsigned char)((raw>>24) & 0xff),
(unsigned char)((raw>>16) & 0xff), (unsigned char)((raw>>16) & 0xff),
(unsigned char)((raw>>8) & 0xff), (unsigned char)((raw>>8) & 0xff),
(unsigned char)(raw & 0xff) (unsigned char)(raw & 0xff)
); );
} }
wxString wxIPV6address::Hostname() const wxString wxIPV6address::Hostname() const
@@ -342,7 +342,7 @@ wxString wxUNIXaddress::Filename()
path[0] = 0; path[0] = 0;
GAddress_UNIX_GetPath(m_address, path, 1024); GAddress_UNIX_GetPath(m_address, path, 1024);
return wxString::FromAscii(path); return wxString::FromAscii(path);
} }

View File

@@ -30,7 +30,7 @@
#include "wx/protocol/file.h" #include "wx/protocol/file.h"
IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, FALSE) IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false)
wxFileProto::wxFileProto() wxFileProto::wxFileProto()
: wxProtocol() : wxProtocol()

View File

@@ -206,7 +206,7 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host,
client->SetEventHandler(*gs_handler, _CLIENT_ONREQUEST_ID); client->SetEventHandler(*gs_handler, _CLIENT_ONREQUEST_ID);
client->SetClientData(connection); client->SetClientData(connection);
client->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG); client->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
client->Notify(TRUE); client->Notify(true);
return connection; return connection;
} }
else else
@@ -253,7 +253,7 @@ bool wxTCPServer::Create(const wxString& serverName)
wxSockAddress *addr = GetAddressFromName(serverName); wxSockAddress *addr = GetAddressFromName(serverName);
if ( !addr ) if ( !addr )
return FALSE; return false;
#ifdef __UNIX_LIKE__ #ifdef __UNIX_LIKE__
mode_t umaskOld; mode_t umaskOld;
@@ -266,7 +266,7 @@ bool wxTCPServer::Create(const wxString& serverName)
{ {
delete addr; delete addr;
return FALSE; return false;
} }
// also set the umask to prevent the others from reading our file // also set the umask to prevent the others from reading our file
@@ -300,15 +300,15 @@ bool wxTCPServer::Create(const wxString& serverName)
m_server->Destroy(); m_server->Destroy();
m_server = NULL; m_server = NULL;
return FALSE; return false;
} }
m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID); m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID);
m_server->SetClientData(this); m_server->SetClientData(this);
m_server->SetNotify(wxSOCKET_CONNECTION_FLAG); m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
m_server->Notify(TRUE); m_server->Notify(true);
return TRUE; return true;
} }
wxTCPServer::~wxTCPServer() wxTCPServer::~wxTCPServer()
@@ -379,20 +379,20 @@ void wxTCPConnection::Compress(bool WXUNUSED(on))
bool wxTCPConnection::Disconnect () bool wxTCPConnection::Disconnect ()
{ {
if ( !GetConnected() ) if ( !GetConnected() )
return TRUE; return true;
// Send the the disconnect message to the peer. // Send the the disconnect message to the peer.
m_codeco->Write8(IPC_DISCONNECT); m_codeco->Write8(IPC_DISCONNECT);
m_sock->Notify(FALSE); m_sock->Notify(false);
m_sock->Close(); m_sock->Close();
SetConnected(FALSE); SetConnected(false);
return TRUE; return true;
} }
bool wxTCPConnection::Execute(const wxChar *data, int size, wxIPCFormat format) bool wxTCPConnection::Execute(const wxChar *data, int size, wxIPCFormat format)
{ {
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return false;
// Prepare EXECUTE message // Prepare EXECUTE message
m_codeco->Write8(IPC_EXECUTE); m_codeco->Write8(IPC_EXECUTE);
@@ -404,7 +404,7 @@ bool wxTCPConnection::Execute(const wxChar *data, int size, wxIPCFormat format)
m_codeco->Write32(size); m_codeco->Write32(size);
m_sockstrm->Write(data, size); m_sockstrm->Write(data, size);
return TRUE; return true;
} }
wxChar *wxTCPConnection::Request (const wxString& item, int *size, wxIPCFormat format) wxChar *wxTCPConnection::Request (const wxString& item, int *size, wxIPCFormat format)
@@ -441,7 +441,7 @@ wxChar *wxTCPConnection::Request (const wxString& item, int *size, wxIPCFormat f
bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCFormat format) bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCFormat format)
{ {
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return false;
m_codeco->Write8(IPC_POKE); m_codeco->Write8(IPC_POKE);
m_codeco->WriteString(item); m_codeco->WriteString(item);
@@ -453,7 +453,7 @@ bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCF
m_codeco->Write32(size); m_codeco->Write32(size);
m_sockstrm->Write(data, size); m_sockstrm->Write(data, size);
return TRUE; return true;
} }
bool wxTCPConnection::StartAdvise (const wxString& item) bool wxTCPConnection::StartAdvise (const wxString& item)
@@ -461,7 +461,7 @@ bool wxTCPConnection::StartAdvise (const wxString& item)
int ret; int ret;
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return false;
m_codeco->Write8(IPC_ADVISE_START); m_codeco->Write8(IPC_ADVISE_START);
m_codeco->WriteString(item); m_codeco->WriteString(item);
@@ -469,9 +469,9 @@ bool wxTCPConnection::StartAdvise (const wxString& item)
ret = m_codeci->Read8(); ret = m_codeci->Read8();
if (ret != IPC_FAIL) if (ret != IPC_FAIL)
return TRUE; return true;
else else
return FALSE; return false;
} }
bool wxTCPConnection::StopAdvise (const wxString& item) bool wxTCPConnection::StopAdvise (const wxString& item)
@@ -479,7 +479,7 @@ bool wxTCPConnection::StopAdvise (const wxString& item)
int msg; int msg;
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return false;
m_codeco->Write8(IPC_ADVISE_STOP); m_codeco->Write8(IPC_ADVISE_STOP);
m_codeco->WriteString(item); m_codeco->WriteString(item);
@@ -487,9 +487,9 @@ bool wxTCPConnection::StopAdvise (const wxString& item)
msg = m_codeci->Read8(); msg = m_codeci->Read8();
if (msg != IPC_FAIL) if (msg != IPC_FAIL)
return TRUE; return true;
else else
return FALSE; return false;
} }
// Calls that SERVER can make // Calls that SERVER can make
@@ -497,7 +497,7 @@ bool wxTCPConnection::Advise (const wxString& item,
wxChar *data, int size, wxIPCFormat format) wxChar *data, int size, wxIPCFormat format)
{ {
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return false;
m_codeco->Write8(IPC_ADVISE); m_codeco->Write8(IPC_ADVISE);
m_codeco->WriteString(item); m_codeco->WriteString(item);
@@ -509,7 +509,7 @@ bool wxTCPConnection::Advise (const wxString& item,
m_codeco->Write32(size); m_codeco->Write32(size);
m_sockstrm->Write(data, size); m_sockstrm->Write(data, size);
return TRUE; return true;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -540,7 +540,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
// We lost the connection: destroy everything // We lost the connection: destroy everything
if (evt == wxSOCKET_LOST) if (evt == wxSOCKET_LOST)
{ {
sock->Notify(FALSE); sock->Notify(false);
sock->Close(); sock->Close();
connection->OnDisconnect(); connection->OnDisconnect();
return; return;
@@ -658,9 +658,9 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
} }
case IPC_DISCONNECT: case IPC_DISCONNECT:
{ {
sock->Notify(FALSE); sock->Notify(false);
sock->Close(); sock->Close();
connection->SetConnected(FALSE); connection->SetConnected(false);
connection->OnDisconnect(); connection->OnDisconnect();
break; break;
} }
@@ -719,7 +719,7 @@ void wxTCPEventHandler::Server_OnRequest(wxSocketEvent &event)
sock->SetEventHandler(*gs_handler, _CLIENT_ONREQUEST_ID); sock->SetEventHandler(*gs_handler, _CLIENT_ONREQUEST_ID);
sock->SetClientData(new_connection); sock->SetClientData(new_connection);
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG); sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
sock->Notify(TRUE); sock->Notify(true);
return; return;
} }
else else
@@ -748,7 +748,7 @@ class wxTCPEventHandlerModule: public wxModule
DECLARE_DYNAMIC_CLASS(wxTCPEventHandlerModule) DECLARE_DYNAMIC_CLASS(wxTCPEventHandlerModule)
public: public:
bool OnInit() { gs_handler = new wxTCPEventHandler(); return TRUE; } bool OnInit() { gs_handler = new wxTCPEventHandler(); return true; }
void OnExit() { wxDELETE(gs_handler); } void OnExit() { wxDELETE(gs_handler); }
}; };

View File

@@ -49,16 +49,16 @@ wxSystemScreenType wxSystemSettings::GetScreenType()
int x = GetMetric( wxSYS_SCREEN_X ); int x = GetMetric( wxSYS_SCREEN_X );
ms_screen = wxSYS_SCREEN_DESKTOP; ms_screen = wxSYS_SCREEN_DESKTOP;
if (x < 800) if (x < 800)
ms_screen = wxSYS_SCREEN_SMALL; ms_screen = wxSYS_SCREEN_SMALL;
if (x < 640) if (x < 640)
ms_screen = wxSYS_SCREEN_PDA; ms_screen = wxSYS_SCREEN_PDA;
if (x < 200) if (x < 200)
ms_screen = wxSYS_SCREEN_TINY; ms_screen = wxSYS_SCREEN_TINY;
// This is probably a bug, but VNC seems to report 0 // This is probably a bug, but VNC seems to report 0
if (x < 10) if (x < 10)
ms_screen = wxSYS_SCREEN_DESKTOP; ms_screen = wxSYS_SCREEN_DESKTOP;
@@ -66,7 +66,7 @@ wxSystemScreenType wxSystemSettings::GetScreenType()
return ms_screen; return ms_screen;
} }
void wxSystemSettings::SetScreenType( wxSystemScreenType screen ) void wxSystemSettings::SetScreenType( wxSystemScreenType screen )
{ {
ms_screen = screen; ms_screen = screen;

View File

@@ -595,9 +595,9 @@ wxSize wxSizer::FitSize( wxWindow *window )
// Limit the size if sizeMax != wxDefaultSize // Limit the size if sizeMax != wxDefaultSize
if ( size.x > sizeMax.x && sizeMax.x != -1 ) if ( size.x > sizeMax.x && sizeMax.x != wxDefaultCoord )
size.x = sizeMax.x; size.x = sizeMax.x;
if ( size.y > sizeMax.y && sizeMax.y != -1 ) if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y; size.y = sizeMax.y;
return size; return size;
@@ -631,9 +631,9 @@ wxSize wxSizer::VirtualFitSize( wxWindow *window )
// Limit the size if sizeMax != wxDefaultSize // Limit the size if sizeMax != wxDefaultSize
if ( size.x > sizeMax.x && sizeMax.x != -1 ) if ( size.x > sizeMax.x && sizeMax.x != wxDefaultCoord )
size.x = sizeMax.x; size.x = sizeMax.x;
if ( size.y > sizeMax.y && sizeMax.y != -1 ) if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y; size.y = sizeMax.y;
return size; return size;

View File

@@ -146,11 +146,11 @@ bool wxSocketBase::Initialize()
{ {
m_countInit--; m_countInit--;
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
void wxSocketBase::Shutdown() void wxSocketBase::Shutdown()
@@ -178,10 +178,10 @@ void wxSocketBase::Init()
m_establishing = m_establishing =
m_reading = m_reading =
m_writing = m_writing =
m_error = FALSE; m_error = false;
m_lcount = 0; m_lcount = 0;
m_timeout = 600; m_timeout = 600;
m_beingDeleted = FALSE; m_beingDeleted = false;
// pushback buffer // pushback buffer
m_unread = NULL; m_unread = NULL;
@@ -189,10 +189,10 @@ void wxSocketBase::Init()
m_unrd_cur = 0; m_unrd_cur = 0;
// events // events
m_id = -1; m_id = wxID_ANY;
m_handler = NULL; m_handler = NULL;
m_clientData = NULL; m_clientData = NULL;
m_notify = FALSE; m_notify = false;
m_eventmask = 0; m_eventmask = 0;
if ( !IsInitialized() ) if ( !IsInitialized() )
@@ -242,13 +242,13 @@ bool wxSocketBase::Destroy()
// Delayed destruction: the socket will be deleted during the next // Delayed destruction: the socket will be deleted during the next
// idle loop iteration. This ensures that all pending events have // idle loop iteration. This ensures that all pending events have
// been processed. // been processed.
m_beingDeleted = TRUE; m_beingDeleted = true;
// Shutdown and close the socket // Shutdown and close the socket
Close(); Close();
// Supress events from now on // Supress events from now on
Notify(FALSE); Notify(false);
// schedule this object for deletion // schedule this object for deletion
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
@@ -263,7 +263,7 @@ bool wxSocketBase::Destroy()
delete this; delete this;
} }
return TRUE; return true;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -290,15 +290,15 @@ bool wxSocketBase::Close()
m_socket->Shutdown(); m_socket->Shutdown();
} }
m_connected = FALSE; m_connected = false;
m_establishing = FALSE; m_establishing = false;
return TRUE; return true;
} }
wxSocketBase& wxSocketBase::Read(void* buffer, wxUint32 nbytes) wxSocketBase& wxSocketBase::Read(void* buffer, wxUint32 nbytes)
{ {
// Mask read events // Mask read events
m_reading = TRUE; m_reading = true;
m_lcount = _Read(buffer, nbytes); m_lcount = _Read(buffer, nbytes);
@@ -309,7 +309,7 @@ wxSocketBase& wxSocketBase::Read(void* buffer, wxUint32 nbytes)
m_error = (m_lcount == 0); m_error = (m_lcount == 0);
// Allow read events from now on // Allow read events from now on
m_reading = FALSE; m_reading = false;
return *this; return *this;
} }
@@ -319,7 +319,7 @@ wxUint32 wxSocketBase::_Read(void* buffer, wxUint32 nbytes)
int total; int total;
// Try the pushback buffer first // Try the pushback buffer first
total = GetPushback(buffer, nbytes, FALSE); total = GetPushback(buffer, nbytes, false);
nbytes -= total; nbytes -= total;
buffer = (char *)buffer + total; buffer = (char *)buffer + total;
@@ -350,7 +350,7 @@ wxUint32 wxSocketBase::_Read(void* buffer, wxUint32 nbytes)
} }
else else
{ {
bool more = TRUE; bool more = true;
while (more) while (more)
{ {
@@ -389,10 +389,10 @@ wxSocketBase& wxSocketBase::ReadMsg(void* buffer, wxUint32 nbytes)
} msg; } msg;
// Mask read events // Mask read events
m_reading = TRUE; m_reading = true;
total = 0; total = 0;
error = TRUE; error = true;
old_flags = m_flags; old_flags = m_flags;
SetFlags((m_flags & wxSOCKET_BLOCK) | wxSOCKET_WAITALL); SetFlags((m_flags & wxSOCKET_BLOCK) | wxSOCKET_WAITALL);
@@ -465,12 +465,12 @@ wxSocketBase& wxSocketBase::ReadMsg(void* buffer, wxUint32 nbytes)
} }
// everything was OK // everything was OK
error = FALSE; error = false;
exit: exit:
m_error = error; m_error = error;
m_lcount = total; m_lcount = total;
m_reading = FALSE; m_reading = false;
SetFlags(old_flags); SetFlags(old_flags);
return *this; return *this;
@@ -479,7 +479,7 @@ exit:
wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes) wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes)
{ {
// Mask read events // Mask read events
m_reading = TRUE; m_reading = true;
m_lcount = _Read(buffer, nbytes); m_lcount = _Read(buffer, nbytes);
Pushback(buffer, m_lcount); Pushback(buffer, m_lcount);
@@ -491,7 +491,7 @@ wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes)
m_error = (m_lcount == 0); m_error = (m_lcount == 0);
// Allow read events again // Allow read events again
m_reading = FALSE; m_reading = false;
return *this; return *this;
} }
@@ -499,7 +499,7 @@ wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes)
wxSocketBase& wxSocketBase::Write(const void *buffer, wxUint32 nbytes) wxSocketBase& wxSocketBase::Write(const void *buffer, wxUint32 nbytes)
{ {
// Mask write events // Mask write events
m_writing = TRUE; m_writing = true;
m_lcount = _Write(buffer, nbytes); m_lcount = _Write(buffer, nbytes);
@@ -510,7 +510,7 @@ wxSocketBase& wxSocketBase::Write(const void *buffer, wxUint32 nbytes)
m_error = (m_lcount == 0); m_error = (m_lcount == 0);
// Allow write events again // Allow write events again
m_writing = FALSE; m_writing = false;
return *this; return *this;
} }
@@ -541,7 +541,7 @@ wxUint32 wxSocketBase::_Write(const void *buffer, wxUint32 nbytes)
} }
else else
{ {
bool more = TRUE; bool more = true;
while (more) while (more)
{ {
@@ -579,9 +579,9 @@ wxSocketBase& wxSocketBase::WriteMsg(const void *buffer, wxUint32 nbytes)
} msg; } msg;
// Mask write events // Mask write events
m_writing = TRUE; m_writing = true;
error = TRUE; error = true;
total = 0; total = 0;
SetFlags((m_flags & wxSOCKET_BLOCK) | wxSOCKET_WAITALL); SetFlags((m_flags & wxSOCKET_BLOCK) | wxSOCKET_WAITALL);
@@ -613,12 +613,12 @@ wxSocketBase& wxSocketBase::WriteMsg(const void *buffer, wxUint32 nbytes)
goto exit; goto exit;
// everything was OK // everything was OK
error = FALSE; error = false;
exit: exit:
m_error = error; m_error = error;
m_lcount = total; m_lcount = total;
m_writing = FALSE; m_writing = false;
return *this; return *this;
} }
@@ -628,7 +628,7 @@ wxSocketBase& wxSocketBase::Unread(const void *buffer, wxUint32 nbytes)
if (nbytes != 0) if (nbytes != 0)
Pushback(buffer, nbytes); Pushback(buffer, nbytes);
m_error = FALSE; m_error = false;
m_lcount = nbytes; m_lcount = nbytes;
return *this; return *this;
@@ -641,7 +641,7 @@ wxSocketBase& wxSocketBase::Discard()
wxUint32 total = 0; wxUint32 total = 0;
// Mask read events // Mask read events
m_reading = TRUE; m_reading = true;
SetFlags(wxSOCKET_NOWAIT); SetFlags(wxSOCKET_NOWAIT);
@@ -654,10 +654,10 @@ wxSocketBase& wxSocketBase::Discard()
delete[] buffer; delete[] buffer;
m_lcount = total; m_lcount = total;
m_error = FALSE; m_error = false;
// Allow read events again // Allow read events again
m_reading = FALSE; m_reading = false;
return *this; return *this;
} }
@@ -679,12 +679,12 @@ bool wxSocketBase::_Wait(long seconds,
GSocketEventFlags result; GSocketEventFlags result;
long timeout; long timeout;
// Set this to TRUE to interrupt ongoing waits // Set this to true to interrupt ongoing waits
m_interrupt = FALSE; m_interrupt = false;
// Check for valid socket // Check for valid socket
if (!m_socket) if (!m_socket)
return FALSE; return false;
// Check for valid timeout value. // Check for valid timeout value.
if (seconds != -1) if (seconds != -1)
@@ -707,7 +707,7 @@ bool wxSocketBase::_Wait(long seconds,
// we are just polling). Also, if just polling, do not yield. // we are just polling). Also, if just polling, do not yield.
wxStopWatch chrono; wxStopWatch chrono;
bool done = FALSE; bool done = false;
while (!done) while (!done)
{ {
@@ -716,33 +716,33 @@ bool wxSocketBase::_Wait(long seconds,
// Incoming connection (server) or connection established (client) // Incoming connection (server) or connection established (client)
if (result & GSOCK_CONNECTION_FLAG) if (result & GSOCK_CONNECTION_FLAG)
{ {
m_connected = TRUE; m_connected = true;
m_establishing = FALSE; m_establishing = false;
return TRUE; return true;
} }
// Data available or output buffer ready // Data available or output buffer ready
if ((result & GSOCK_INPUT_FLAG) || (result & GSOCK_OUTPUT_FLAG)) if ((result & GSOCK_INPUT_FLAG) || (result & GSOCK_OUTPUT_FLAG))
{ {
return TRUE; return true;
} }
// Connection lost // Connection lost
if (result & GSOCK_LOST_FLAG) if (result & GSOCK_LOST_FLAG)
{ {
m_connected = FALSE; m_connected = false;
m_establishing = FALSE; m_establishing = false;
return (flags & GSOCK_LOST_FLAG) != 0; return (flags & GSOCK_LOST_FLAG) != 0;
} }
// Wait more? // Wait more?
if ((!timeout) || (chrono.Time() > timeout) || (m_interrupt)) if ((!timeout) || (chrono.Time() > timeout) || (m_interrupt))
done = TRUE; done = true;
else else
PROCESS_EVENTS(); PROCESS_EVENTS();
} }
return FALSE; return false;
} }
bool wxSocketBase::Wait(long seconds, long milliseconds) bool wxSocketBase::Wait(long seconds, long milliseconds)
@@ -757,11 +757,11 @@ bool wxSocketBase::WaitForRead(long seconds, long milliseconds)
{ {
// Check pushback buffer before entering _Wait // Check pushback buffer before entering _Wait
if (m_unread) if (m_unread)
return TRUE; return true;
// Note that GSOCK_INPUT_LOST has to be explicitly passed to // Note that GSOCK_INPUT_LOST has to be explicitly passed to
// _Wait becuase of the semantics of WaitForRead: a return // _Wait becuase of the semantics of WaitForRead: a return
// value of TRUE means that a GSocket_Read call will return // value of true means that a GSocket_Read call will return
// immediately, not that there is actually data to read. // immediately, not that there is actually data to read.
return _Wait(seconds, milliseconds, GSOCK_INPUT_FLAG | return _Wait(seconds, milliseconds, GSOCK_INPUT_FLAG |
@@ -792,19 +792,19 @@ bool wxSocketBase::GetPeer(wxSockAddress& addr_man) const
GAddress *peer; GAddress *peer;
if (!m_socket) if (!m_socket)
return FALSE; return false;
peer = m_socket->GetPeer(); peer = m_socket->GetPeer();
// copying a null address would just trigger an assert anyway // copying a null address would just trigger an assert anyway
if (!peer) if (!peer)
return FALSE; return false;
addr_man.SetAddress(peer); addr_man.SetAddress(peer);
GAddress_destroy(peer); GAddress_destroy(peer);
return TRUE; return true;
} }
bool wxSocketBase::GetLocal(wxSockAddress& addr_man) const bool wxSocketBase::GetLocal(wxSockAddress& addr_man) const
@@ -812,13 +812,13 @@ bool wxSocketBase::GetLocal(wxSockAddress& addr_man) const
GAddress *local; GAddress *local;
if (!m_socket) if (!m_socket)
return FALSE; return false;
local = m_socket->GetLocal(); local = m_socket->GetLocal();
addr_man.SetAddress(local); addr_man.SetAddress(local);
GAddress_destroy(local); GAddress_destroy(local);
return TRUE; return true;
} }
// //
@@ -919,8 +919,8 @@ void wxSocketBase::OnRequest(wxSocketNotify notification)
switch(notification) switch(notification)
{ {
case wxSOCKET_CONNECTION: case wxSOCKET_CONNECTION:
m_establishing = FALSE; m_establishing = false;
m_connected = TRUE; m_connected = true;
break; break;
// If we are in the middle of a R/W operation, do not // If we are in the middle of a R/W operation, do not
@@ -938,8 +938,8 @@ void wxSocketBase::OnRequest(wxSocketNotify notification)
break; break;
case wxSOCKET_LOST: case wxSOCKET_LOST:
m_connected = FALSE; m_connected = false;
m_establishing = FALSE; m_establishing = false;
break; break;
default: default:
@@ -1068,7 +1068,7 @@ wxSocketServer::wxSocketServer(wxSockAddress& addr_man,
// Setup the socket as server // Setup the socket as server
m_socket->SetLocal(addr_man.GetAddress()); m_socket->SetLocal(addr_man.GetAddress());
if (GetFlags() & wxSOCKET_REUSEADDR) { if (GetFlags() & wxSOCKET_REUSEADDR) {
m_socket->SetReusable(); m_socket->SetReusable();
} }
@@ -1097,9 +1097,9 @@ bool wxSocketServer::AcceptWith(wxSocketBase& sock, bool wait)
GSocket *child_socket; GSocket *child_socket;
if (!m_socket) if (!m_socket)
return FALSE; return false;
// If wait == FALSE, then the call should be nonblocking. // If wait == false, then the call should be nonblocking.
// When we are finished, we put the socket to blocking mode // When we are finished, we put the socket to blocking mode
// again. // again.
@@ -1112,18 +1112,18 @@ bool wxSocketServer::AcceptWith(wxSocketBase& sock, bool wait)
m_socket->SetNonBlocking(0); m_socket->SetNonBlocking(0);
if (!child_socket) if (!child_socket)
return FALSE; return false;
sock.m_type = wxSOCKET_BASE; sock.m_type = wxSOCKET_BASE;
sock.m_socket = child_socket; sock.m_socket = child_socket;
sock.m_connected = TRUE; sock.m_connected = true;
sock.m_socket->SetTimeout(sock.m_timeout * 1000); sock.m_socket->SetTimeout(sock.m_timeout * 1000);
sock.m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | sock.m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
wx_socket_callback, (char *)&sock); wx_socket_callback, (char *)&sock);
return TRUE; return true;
} }
wxSocketBase *wxSocketServer::Accept(bool wait) wxSocketBase *wxSocketServer::Accept(bool wait)
@@ -1151,9 +1151,9 @@ bool wxSocketBase::GetOption(int level, int optname, void *optval, int *optlen)
if (m_socket->GetSockOpt(level, optname, optval, optlen) if (m_socket->GetSockOpt(level, optname, optval, optlen)
!= GSOCK_NOERROR) != GSOCK_NOERROR)
{ {
return FALSE; return false;
} }
return TRUE; return true;
} }
bool wxSocketBase::SetOption(int level, int optname, const void *optval, bool wxSocketBase::SetOption(int level, int optname, const void *optval,
@@ -1162,9 +1162,9 @@ bool wxSocketBase::SetOption(int level, int optname, const void *optval,
if (m_socket->SetSockOpt(level, optname, optval, optlen) if (m_socket->SetSockOpt(level, optname, optval, optlen)
!= GSOCK_NOERROR) != GSOCK_NOERROR)
{ {
return FALSE; return false;
} }
return TRUE; return true;
} }
// ========================================================================== // ==========================================================================
@@ -1200,18 +1200,18 @@ bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait)
} }
m_socket = GSocket_new(); m_socket = GSocket_new();
m_connected = FALSE; m_connected = false;
m_establishing = FALSE; m_establishing = false;
if (!m_socket) if (!m_socket)
return FALSE; return false;
m_socket->SetTimeout(m_timeout * 1000); m_socket->SetTimeout(m_timeout * 1000);
m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
wx_socket_callback, (char *)this); wx_socket_callback, (char *)this);
// If wait == FALSE, then the call should be nonblocking. // If wait == false, then the call should be nonblocking.
// When we are finished, we put the socket to blocking mode // When we are finished, we put the socket to blocking mode
// again. // again.
@@ -1227,22 +1227,22 @@ bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait)
if (err != GSOCK_NOERROR) if (err != GSOCK_NOERROR)
{ {
if (err == GSOCK_WOULDBLOCK) if (err == GSOCK_WOULDBLOCK)
m_establishing = TRUE; m_establishing = true;
return FALSE; return false;
} }
m_connected = TRUE; m_connected = true;
return TRUE; return true;
} }
bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds) bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds)
{ {
if (m_connected) // Already connected if (m_connected) // Already connected
return TRUE; return true;
if (!m_establishing || !m_socket) // No connection in progress if (!m_establishing || !m_socket) // No connection in progress
return FALSE; return false;
return _Wait(seconds, milliseconds, GSOCK_CONNECTION_FLAG | return _Wait(seconds, milliseconds, GSOCK_CONNECTION_FLAG |
GSOCK_LOST_FLAG); GSOCK_LOST_FLAG);
@@ -1276,8 +1276,8 @@ wxDatagramSocket::wxDatagramSocket( wxSockAddress& addr,
} }
// Initialize all stuff // Initialize all stuff
m_connected = FALSE; m_connected = false;
m_establishing = FALSE; m_establishing = false;
m_socket->SetTimeout( m_timeout ); m_socket->SetTimeout( m_timeout );
m_socket->SetCallback( GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | m_socket->SetCallback( GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
@@ -1313,7 +1313,7 @@ public:
virtual bool OnInit() virtual bool OnInit()
{ {
// wxSocketBase will call GSocket_Init() itself when/if needed // wxSocketBase will call GSocket_Init() itself when/if needed
return TRUE; return true;
} }
virtual void OnExit() virtual void OnExit()

View File

@@ -99,7 +99,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
{ {
wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") ); wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") );
bool refresh = FALSE; bool refresh = false;
if ( number != m_nFields ) if ( number != m_nFields )
{ {
@@ -152,7 +152,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
ReinitWidths(); ReinitWidths();
refresh = TRUE; refresh = true;
} }
//else: keep the old m_statusWidths if we had them //else: keep the old m_statusWidths if we had them
@@ -161,7 +161,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
SetStatusWidths(number, widths); SetStatusWidths(number, widths);
// already done from SetStatusWidths() // already done from SetStatusWidths()
refresh = FALSE; refresh = false;
} }
if ( refresh ) if ( refresh )

View File

@@ -158,7 +158,7 @@ wxString wxGetStockLabel(wxWindowID id)
}; };
#undef STOCKITEM #undef STOCKITEM
return wxEmptyString; return wxEmptyString;
} }
@@ -171,11 +171,11 @@ bool wxIsStockLabel(wxWindowID id, const wxString& label)
if (label == stock) if (label == stock)
return true; return true;
stock.Replace(_T("&"), wxEmptyString); stock.Replace(_T("&"), wxEmptyString);
if (label == stock) if (label == stock)
return true; return true;
return false; return false;
} }
@@ -189,7 +189,7 @@ const char *wxGetStockGtkID(wxWindowID id)
#define STOCKITEM(wx,gtk) \ #define STOCKITEM(wx,gtk) \
case wx: \ case wx: \
return gtk; return gtk;
#define STOCKITEM_MISSING(wx) \ #define STOCKITEM_MISSING(wx) \
case wx: \ case wx: \
return NULL; return NULL;
@@ -259,7 +259,7 @@ const char *wxGetStockGtkID(wxWindowID id)
}; };
#undef STOCKITEM #undef STOCKITEM
return NULL; return NULL;
} }

View File

@@ -222,7 +222,7 @@ wxLongLong wxGetLocalTimeMillis()
wxLongLong now( nowft.dwHighDateTime, nowft.dwLowDateTime ); // time in 100 nanoseconds wxLongLong now( nowft.dwHighDateTime, nowft.dwLowDateTime ); // time in 100 nanoseconds
return ( now - then ) / 10000.0; // time from 00:00:00 Jan 1st 1970 to now in milliseconds return ( now - then ) / 10000.0; // time from 00:00:00 Jan 1st 1970 to now in milliseconds
#elif defined(HAVE_GETTIMEOFDAY) #elif defined(HAVE_GETTIMEOFDAY)
struct timeval tp; struct timeval tp;
if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 ) if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 )
@@ -244,7 +244,7 @@ wxLongLong wxGetLocalTimeMillis()
val *= tp.time; val *= tp.time;
return (val + tp.millitm); return (val + tp.millitm);
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
static UInt64 gMilliAtStart = 0; static UInt64 gMilliAtStart = 0;
Nanoseconds upTime = AbsoluteToNanoseconds( UpTime() ); Nanoseconds upTime = AbsoluteToNanoseconds( UpTime() );

View File

@@ -1121,7 +1121,7 @@ size_t wxMBConv_iconv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
#ifdef wxHAVE_WIN32_MB2WC #ifdef wxHAVE_WIN32_MB2WC
// from utils.cpp // from utils.cpp
#if wxUSE_FONTMAP #if wxUSE_FONTMAP
extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const wxChar *charset); extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const wxChar *charset);
extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding); extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
#endif #endif
@@ -1177,7 +1177,7 @@ public:
quality approximations such as turning "1/2" symbol (U+00BD) into quality approximations such as turning "1/2" symbol (U+00BD) into
"1" for the code pages which don't have it and we, obviously, want "1" for the code pages which don't have it and we, obviously, want
to avoid this at any price to avoid this at any price
the trouble is that this function does it _silently_, i.e. it won't the trouble is that this function does it _silently_, i.e. it won't
even tell us whether it did or not... Win98/2000 and higher provide even tell us whether it did or not... Win98/2000 and higher provide
WC_NO_BEST_FIT_CHARS but it doesn't work for the older systems and WC_NO_BEST_FIT_CHARS but it doesn't work for the older systems and
@@ -1302,127 +1302,127 @@ public:
wxMBConv_mac(const wxChar* name) wxMBConv_mac(const wxChar* name)
{ {
Init( wxMacGetSystemEncFromFontEnc(wxFontMapper::Get()->CharsetToEncoding(name, FALSE) ) ) ; Init( wxMacGetSystemEncFromFontEnc(wxFontMapper::Get()->CharsetToEncoding(name, false) ) ) ;
} }
wxMBConv_mac(wxFontEncoding encoding) wxMBConv_mac(wxFontEncoding encoding)
{ {
Init( wxMacGetSystemEncFromFontEnc(encoding) ); Init( wxMacGetSystemEncFromFontEnc(encoding) );
}
~wxMBConv_mac()
{
OSStatus status = noErr ;
status = TECDisposeConverter(m_MB2WC_converter);
status = TECDisposeConverter(m_WC2MB_converter);
}
void Init( TextEncodingBase encoding)
{
OSStatus status = noErr ;
m_char_encoding = encoding ;
m_unicode_encoding = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
status = TECCreateConverter(&m_MB2WC_converter,
m_char_encoding,
m_unicode_encoding);
status = TECCreateConverter(&m_WC2MB_converter,
m_unicode_encoding,
m_char_encoding);
} }
~wxMBConv_mac()
{
OSStatus status = noErr ;
status = TECDisposeConverter(m_MB2WC_converter);
status = TECDisposeConverter(m_WC2MB_converter);
}
void Init( TextEncodingBase encoding)
{
OSStatus status = noErr ;
m_char_encoding = encoding ;
m_unicode_encoding = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
status = TECCreateConverter(&m_MB2WC_converter,
m_char_encoding,
m_unicode_encoding);
status = TECCreateConverter(&m_WC2MB_converter,
m_unicode_encoding,
m_char_encoding);
}
size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const
{ {
OSStatus status = noErr ; OSStatus status = noErr ;
ByteCount byteOutLen ; ByteCount byteOutLen ;
ByteCount byteInLen = strlen(psz) ; ByteCount byteInLen = strlen(psz) ;
wchar_t *tbuf = NULL ; wchar_t *tbuf = NULL ;
UniChar* ubuf = NULL ; UniChar* ubuf = NULL ;
size_t res = 0 ; size_t res = 0 ;
if (buf == NULL) if (buf == NULL)
{ {
n = byteInLen ; n = byteInLen ;
tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T) ; tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T) ;
} }
ByteCount byteBufferLen = n * sizeof( UniChar ) ; ByteCount byteBufferLen = n * sizeof( UniChar ) ;
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ; ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ;
#else #else
ubuf = (UniChar*) (buf ? buf : tbuf) ; ubuf = (UniChar*) (buf ? buf : tbuf) ;
#endif #endif
status = TECConvertText(m_MB2WC_converter, (ConstTextPtr) psz , byteInLen, &byteInLen, status = TECConvertText(m_MB2WC_converter, (ConstTextPtr) psz , byteInLen, &byteInLen,
(TextPtr) ubuf , byteBufferLen, &byteOutLen); (TextPtr) ubuf , byteBufferLen, &byteOutLen);
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar // we have to terminate here, because n might be larger for the trailing zero, and if UniChar
// is not properly terminated we get random characters at the end // is not properly terminated we get random characters at the end
ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ; ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ;
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
res = converter.MB2WC( (buf ? buf : tbuf) , (const char*)ubuf , n ) ; res = converter.MB2WC( (buf ? buf : tbuf) , (const char*)ubuf , n ) ;
free( ubuf ) ; free( ubuf ) ;
#else #else
res = byteOutLen / sizeof( UniChar ) ; res = byteOutLen / sizeof( UniChar ) ;
#endif #endif
if ( buf == NULL ) if ( buf == NULL )
free(tbuf) ; free(tbuf) ;
if ( buf && res < n) if ( buf && res < n)
buf[res] = 0; buf[res] = 0;
return res ; return res ;
} }
size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const
{ {
OSStatus status = noErr ; OSStatus status = noErr ;
ByteCount byteOutLen ; ByteCount byteOutLen ;
ByteCount byteInLen = wxWcslen(psz) * SIZEOF_WCHAR_T ; ByteCount byteInLen = wxWcslen(psz) * SIZEOF_WCHAR_T ;
char *tbuf = NULL ; char *tbuf = NULL ;
if (buf == NULL)
{
// worst case
n = byteInLen * 2 ;
tbuf = (char*) malloc( n ) ;
}
ByteCount byteBufferLen = n ; if (buf == NULL)
UniChar* ubuf = NULL ; {
// worst case
n = byteInLen * 2 ;
tbuf = (char*) malloc( n ) ;
}
ByteCount byteBufferLen = n ;
UniChar* ubuf = NULL ;
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
size_t unicharlen = converter.WC2MB( NULL , psz , 0 ) ; size_t unicharlen = converter.WC2MB( NULL , psz , 0 ) ;
byteInLen = unicharlen ; byteInLen = unicharlen ;
ubuf = (UniChar*) malloc( byteInLen + 2 ) ; ubuf = (UniChar*) malloc( byteInLen + 2 ) ;
converter.WC2MB( (char*) ubuf , psz, unicharlen + 2 ) ; converter.WC2MB( (char*) ubuf , psz, unicharlen + 2 ) ;
#else #else
ubuf = (UniChar*) psz ; ubuf = (UniChar*) psz ;
#endif #endif
status = TECConvertText(m_WC2MB_converter, (ConstTextPtr) ubuf , byteInLen, &byteInLen, status = TECConvertText(m_WC2MB_converter, (ConstTextPtr) ubuf , byteInLen, &byteInLen,
(TextPtr) (buf ? buf : tbuf) , byteBufferLen, &byteOutLen); (TextPtr) (buf ? buf : tbuf) , byteBufferLen, &byteOutLen);
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
free( ubuf ) ; free( ubuf ) ;
#endif #endif
if ( buf == NULL ) if ( buf == NULL )
free(tbuf) ; free(tbuf) ;
size_t res = byteOutLen ; size_t res = byteOutLen ;
if ( buf && res < n) if ( buf && res < n)
buf[res] = 0; buf[res] = 0;
return res ; return res ;
} }
bool IsOk() const bool IsOk() const
{ return m_MB2WC_converter != NULL && m_WC2MB_converter != NULL ; } { return m_MB2WC_converter != NULL && m_WC2MB_converter != NULL ; }
private: private:
TECObjectRef m_MB2WC_converter ; TECObjectRef m_MB2WC_converter ;
TECObjectRef m_WC2MB_converter ; TECObjectRef m_WC2MB_converter ;
TextEncodingBase m_char_encoding ; TextEncodingBase m_char_encoding ;
TextEncodingBase m_unicode_encoding ; TextEncodingBase m_unicode_encoding ;
}; };
#endif // defined(__WXMAC__) && defined(TARGET_CARBON) #endif // defined(__WXMAC__) && defined(TARGET_CARBON)
@@ -1626,18 +1626,18 @@ wxMBConv *wxCSConv::DoCreate() const
#endif #endif
} }
#endif // wxHAVE_WIN32_MB2WC #endif // wxHAVE_WIN32_MB2WC
#if defined(__WXMAC__) #if defined(__WXMAC__)
{ {
if ( m_name || ( m_encoding < wxFONTENCODING_UTF16BE ) ) if ( m_name || ( m_encoding < wxFONTENCODING_UTF16BE ) )
{ {
wxMBConv_mac *conv = m_name ? new wxMBConv_mac(m_name)
: new wxMBConv_mac(m_encoding);
if ( conv->IsOk() )
return conv;
delete conv; wxMBConv_mac *conv = m_name ? new wxMBConv_mac(m_name)
} : new wxMBConv_mac(m_encoding);
if ( conv->IsOk() )
return conv;
delete conv;
}
} }
#endif #endif
// step (2) // step (2)

View File

@@ -70,14 +70,14 @@ void wxStreamBuffer::InitBuffer()
m_buffer_size = 0; m_buffer_size = 0;
// if we are going to allocate the buffer, we should free it later as well // if we are going to allocate the buffer, we should free it later as well
m_destroybuf = TRUE; m_destroybuf = true;
} }
void wxStreamBuffer::Init() void wxStreamBuffer::Init()
{ {
InitBuffer(); InitBuffer();
m_fixed = TRUE; m_fixed = true;
} }
wxStreamBuffer::wxStreamBuffer(BufMode mode) wxStreamBuffer::wxStreamBuffer(BufMode mode)
@@ -87,7 +87,7 @@ wxStreamBuffer::wxStreamBuffer(BufMode mode)
m_stream = NULL; m_stream = NULL;
m_mode = mode; m_mode = mode;
m_flushable = FALSE; m_flushable = false;
} }
wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode) wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
@@ -97,7 +97,7 @@ wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
m_stream = &stream; m_stream = &stream;
m_mode = mode; m_mode = mode;
m_flushable = TRUE; m_flushable = true;
} }
wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer) wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
@@ -115,7 +115,7 @@ wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
m_flushable = buffer.m_flushable; m_flushable = buffer.m_flushable;
m_stream = buffer.m_stream; m_stream = buffer.m_stream;
m_mode = buffer.m_mode; m_mode = buffer.m_mode;
m_destroybuf = FALSE; m_destroybuf = false;
} }
void wxStreamBuffer::FreeBuffer() void wxStreamBuffer::FreeBuffer()
@@ -172,7 +172,7 @@ void wxStreamBuffer::SetBufferIO(size_t bufsize)
if ( bufsize ) if ( bufsize )
{ {
SetBufferIO(malloc(bufsize), bufsize, TRUE /* take ownership */); SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */);
} }
else // no buffer size => no buffer else // no buffer size => no buffer
{ {
@@ -198,41 +198,41 @@ bool wxStreamBuffer::FillBuffer()
{ {
wxInputStream *inStream = GetInputStream(); wxInputStream *inStream = GetInputStream();
// It's legal to have no stream, so we don't complain about it just return FALSE // It's legal to have no stream, so we don't complain about it just return false
if ( !inStream ) if ( !inStream )
return FALSE; return false;
size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size); size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size);
if ( !count ) if ( !count )
return FALSE; return false;
m_buffer_end = m_buffer_start + count; m_buffer_end = m_buffer_start + count;
m_buffer_pos = m_buffer_start; m_buffer_pos = m_buffer_start;
return TRUE; return true;
} }
// write the buffer contents to the stream (only for write buffers) // write the buffer contents to the stream (only for write buffers)
bool wxStreamBuffer::FlushBuffer() bool wxStreamBuffer::FlushBuffer()
{ {
wxCHECK_MSG( m_flushable, FALSE, _T("can't flush this buffer") ); wxCHECK_MSG( m_flushable, false, _T("can't flush this buffer") );
// FIXME: what is this check for? (VZ) // FIXME: what is this check for? (VZ)
if ( m_buffer_pos == m_buffer_start ) if ( m_buffer_pos == m_buffer_start )
return FALSE; return false;
wxOutputStream *outStream = GetOutputStream(); wxOutputStream *outStream = GetOutputStream();
wxCHECK_MSG( outStream, FALSE, _T("should have a stream in wxStreamBuffer") ); wxCHECK_MSG( outStream, false, _T("should have a stream in wxStreamBuffer") );
size_t current = m_buffer_pos - m_buffer_start; size_t current = m_buffer_pos - m_buffer_start;
size_t count = outStream->OnSysWrite(m_buffer_start, current); size_t count = outStream->OnSysWrite(m_buffer_start, current);
if ( count != current ) if ( count != current )
return FALSE; return false;
m_buffer_pos = m_buffer_start; m_buffer_pos = m_buffer_start;
return TRUE; return true;
} }
size_t wxStreamBuffer::GetDataLeft() size_t wxStreamBuffer::GetDataLeft()
@@ -767,7 +767,7 @@ size_t wxInputStream::Ungetch(const void *buf, size_t bufsize)
if (!ptrback) if (!ptrback)
return 0; return 0;
// Eof() shouldn't return TRUE any longer // Eof() shouldn't return true any longer
if ( m_lasterror == wxSTREAM_EOF ) if ( m_lasterror == wxSTREAM_EOF )
m_lasterror = wxSTREAM_NO_ERROR; m_lasterror = wxSTREAM_NO_ERROR;

View File

@@ -250,7 +250,7 @@ bool wxStringBase::AllocBuffer(size_t nLen)
if ( pData == NULL ) { if ( pData == NULL ) {
// allocation failures are handled by the caller // allocation failures are handled by the caller
return FALSE; return false;
} }
pData->nRefs = 1; pData->nRefs = 1;
@@ -258,7 +258,7 @@ bool wxStringBase::AllocBuffer(size_t nLen)
pData->nAllocLength = nLen + EXTRA_ALLOC; pData->nAllocLength = nLen + EXTRA_ALLOC;
m_pchData = pData->data(); // data starts after wxStringData m_pchData = pData->data(); // data starts after wxStringData
m_pchData[nLen] = wxT('\0'); m_pchData[nLen] = wxT('\0');
return TRUE; return true;
} }
// must be called before changing this string // must be called before changing this string
@@ -271,14 +271,14 @@ bool wxStringBase::CopyBeforeWrite()
size_t nLen = pData->nDataLength; size_t nLen = pData->nDataLength;
if ( !AllocBuffer(nLen) ) { if ( !AllocBuffer(nLen) ) {
// allocation failures are handled by the caller // allocation failures are handled by the caller
return FALSE; return false;
} }
memcpy(m_pchData, pData->data(), nLen*sizeof(wxChar)); memcpy(m_pchData, pData->data(), nLen*sizeof(wxChar));
} }
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
return TRUE; return true;
} }
// must be called before replacing contents of this string // must be called before replacing contents of this string
@@ -293,7 +293,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
pData->Unlock(); pData->Unlock();
if ( !AllocBuffer(nLen) ) { if ( !AllocBuffer(nLen) ) {
// allocation failures are handled by the caller // allocation failures are handled by the caller
return FALSE; return false;
} }
} }
else { else {
@@ -310,7 +310,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
if ( pData == NULL ) { if ( pData == NULL ) {
// allocation failures are handled by the caller // allocation failures are handled by the caller
// keep previous data since reallocation failed // keep previous data since reallocation failed
return FALSE; return false;
} }
pData->nAllocLength = nLen; pData->nAllocLength = nLen;
@@ -323,7 +323,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
return TRUE; return true;
} }
wxStringBase& wxStringBase::append(size_t n, wxChar ch) wxStringBase& wxStringBase::append(size_t n, wxChar ch)
@@ -368,7 +368,7 @@ bool wxStringBase::Alloc(size_t nLen)
if ( pData == NULL ) { if ( pData == NULL ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
pData->nRefs = 1; pData->nRefs = 1;
@@ -382,7 +382,7 @@ bool wxStringBase::Alloc(size_t nLen)
size_t nOldLen = pData->nDataLength; size_t nOldLen = pData->nDataLength;
if ( !AllocBuffer(nLen) ) { if ( !AllocBuffer(nLen) ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
memcpy(m_pchData, pData->data(), nOldLen*sizeof(wxChar)); memcpy(m_pchData, pData->data(), nOldLen*sizeof(wxChar));
} }
@@ -395,7 +395,7 @@ bool wxStringBase::Alloc(size_t nLen)
if ( pData == NULL ) { if ( pData == NULL ) {
// allocation failure handled by caller // allocation failure handled by caller
// keep previous data since reallocation failed // keep previous data since reallocation failed
return FALSE; return false;
} }
// it's not important if the pointer changed or not (the check for this // it's not important if the pointer changed or not (the check for this
@@ -405,9 +405,9 @@ bool wxStringBase::Alloc(size_t nLen)
} }
} }
//else: we've already got enough //else: we've already got enough
return TRUE; return true;
} }
wxStringBase::iterator wxStringBase::begin() wxStringBase::iterator wxStringBase::begin()
{ {
if (length() > 0) if (length() > 0)
@@ -522,7 +522,7 @@ size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const
} }
} while ( cursor-- > c_str() ); } while ( cursor-- > c_str() );
} }
return npos; return npos;
} }
@@ -773,13 +773,13 @@ bool wxStringBase::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData)
else { else {
if ( !AllocBeforeWrite(nSrcLen) ) { if ( !AllocBeforeWrite(nSrcLen) ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxChar)); memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxChar));
GetStringData()->nDataLength = nSrcLen; GetStringData()->nDataLength = nSrcLen;
m_pchData[nSrcLen] = wxT('\0'); m_pchData[nSrcLen] = wxT('\0');
} }
return TRUE; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -808,7 +808,7 @@ bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
wxStringData* pOldData = GetStringData(); wxStringData* pOldData = GetStringData();
if ( !AllocBuffer(nNewLen) ) { if ( !AllocBuffer(nNewLen) ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxChar)); memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxChar));
pOldData->Unlock(); pOldData->Unlock();
@@ -820,7 +820,7 @@ bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
// we have to grow the buffer // we have to grow the buffer
if ( capacity() < nNewLen ) { if ( capacity() < nNewLen ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
} }
else { else {
@@ -839,7 +839,7 @@ bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
GetStringData()->nDataLength = nNewLen; // and fix the length GetStringData()->nDataLength = nNewLen; // and fix the length
} }
//else: the string to append was empty //else: the string to append was empty
return TRUE; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -855,11 +855,11 @@ bool wxStringBase::AllocCopy(wxString& dest, int nCopyLen, int nCopyIndex) const
else { else {
if ( !dest.AllocBuffer(nCopyLen) ) { if ( !dest.AllocBuffer(nCopyLen) ) {
// allocation failure handled by caller // allocation failure handled by caller
return FALSE; return false;
} }
memcpy(dest.m_pchData, m_pchData + nCopyIndex, nCopyLen*sizeof(wxChar)); memcpy(dest.m_pchData, m_pchData + nCopyIndex, nCopyLen*sizeof(wxChar));
} }
return TRUE; return true;
} }
#endif // !wxUSE_STL #endif // !wxUSE_STL
@@ -975,7 +975,7 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength)
inBuf = tmp; inBuf = tmp;
psz = inBuf.data(); psz = inBuf.data();
} }
// first get the size of the buffer we need // first get the size of the buffer we need
size_t nLen; size_t nLen;
if ( psz ) if ( psz )
@@ -1033,7 +1033,7 @@ wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength)
inBuf = tmp; inBuf = tmp;
pwz = inBuf.data(); pwz = inBuf.data();
} }
// first get the size of the buffer we need // first get the size of the buffer we need
size_t nLen; size_t nLen;
if ( pwz ) if ( pwz )
@@ -1092,7 +1092,7 @@ wxChar *wxString::GetWriteBuf(size_t nLen)
} }
wxASSERT( GetStringData()->nRefs == 1 ); wxASSERT( GetStringData()->nRefs == 1 );
GetStringData()->Validate(FALSE); GetStringData()->Validate(false);
return m_pchData; return m_pchData;
} }
@@ -1101,13 +1101,13 @@ wxChar *wxString::GetWriteBuf(size_t nLen)
void wxString::UngetWriteBuf() void wxString::UngetWriteBuf()
{ {
GetStringData()->nDataLength = wxStrlen(m_pchData); GetStringData()->nDataLength = wxStrlen(m_pchData);
GetStringData()->Validate(TRUE); GetStringData()->Validate(true);
} }
void wxString::UngetWriteBuf(size_t nLen) void wxString::UngetWriteBuf(size_t nLen)
{ {
GetStringData()->nDataLength = nLen; GetStringData()->nDataLength = nLen;
GetStringData()->Validate(TRUE); GetStringData()->Validate(true);
} }
#endif #endif
@@ -1312,7 +1312,7 @@ wxString wxString::Mid(size_t nFirst, size_t nCount) const
} }
// check that the string starts with prefix and return the rest of the string // check that the string starts with prefix and return the rest of the string
// in the provided pointer if it is not NULL, otherwise return FALSE // in the provided pointer if it is not NULL, otherwise return false
bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const
{ {
wxASSERT_MSG( prefix, _T("invalid parameter in wxString::StartsWith") ); wxASSERT_MSG( prefix, _T("invalid parameter in wxString::StartsWith") );
@@ -1327,7 +1327,7 @@ bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const
if ( *prefix++ != *p++ ) if ( *prefix++ != *p++ )
{ {
// no match // no match
return FALSE; return false;
} }
} }
@@ -1337,7 +1337,7 @@ bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const
*rest = p; *rest = p;
} }
return TRUE; return true;
} }
// extract nCount last (rightmost) characters // extract nCount last (rightmost) characters
@@ -1358,7 +1358,7 @@ wxString wxString::Right(size_t nCount) const
wxString wxString::AfterLast(wxChar ch) const wxString wxString::AfterLast(wxChar ch) const
{ {
wxString str; wxString str;
int iPos = Find(ch, TRUE); int iPos = Find(ch, true);
if ( iPos == wxNOT_FOUND ) if ( iPos == wxNOT_FOUND )
str = *this; str = *this;
else else
@@ -1394,7 +1394,7 @@ wxString wxString::BeforeFirst(wxChar ch) const
wxString wxString::BeforeLast(wxChar ch) const wxString wxString::BeforeLast(wxChar ch) const
{ {
wxString str; wxString str;
int iPos = Find(ch, TRUE); int iPos = Find(ch, true);
if ( iPos != wxNOT_FOUND && iPos != 0 ) if ( iPos != wxNOT_FOUND && iPos != 0 )
str = wxString(c_str(), iPos); str = wxString(c_str(), iPos);
@@ -1469,20 +1469,20 @@ bool wxString::IsAscii() const
{ {
const wxChar *s = (const wxChar*) *this; const wxChar *s = (const wxChar*) *this;
while(*s){ while(*s){
if(!isascii(*s)) return(FALSE); if(!isascii(*s)) return(false);
s++; s++;
} }
return(TRUE); return(true);
} }
bool wxString::IsWord() const bool wxString::IsWord() const
{ {
const wxChar *s = (const wxChar*) *this; const wxChar *s = (const wxChar*) *this;
while(*s){ while(*s){
if(!wxIsalpha(*s)) return(FALSE); if(!wxIsalpha(*s)) return(false);
s++; s++;
} }
return(TRUE); return(true);
} }
bool wxString::IsNumber() const bool wxString::IsNumber() const
@@ -1491,17 +1491,17 @@ bool wxString::IsNumber() const
if (wxStrlen(s)) if (wxStrlen(s))
if ((s[0] == '-') || (s[0] == '+')) s++; if ((s[0] == '-') || (s[0] == '+')) s++;
while(*s){ while(*s){
if(!wxIsdigit(*s)) return(FALSE); if(!wxIsdigit(*s)) return(false);
s++; s++;
} }
return(TRUE); return(true);
} }
wxString wxString::Strip(stripType w) const wxString wxString::Strip(stripType w) const
{ {
wxString s = *this; wxString s = *this;
if ( w & leading ) s.Trim(FALSE); if ( w & leading ) s.Trim(false);
if ( w & trailing ) s.Trim(TRUE); if ( w & trailing ) s.Trim(true);
return s; return s;
} }
@@ -1529,7 +1529,7 @@ wxString& wxString::MakeLower()
// trimming and padding // trimming and padding
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// some compilers (VC++ 6.0 not to name them) return TRUE for a call to // some compilers (VC++ 6.0 not to name them) return true for a call to
// isspace('<27>') in the C locale which seems to be broken to me, but we have to // isspace('<27>') in the C locale which seems to be broken to me, but we have to
// live with this by checking that the character is a 7 bit one - even if this // live with this by checking that the character is a 7 bit one - even if this
// may fail to detect some spaces (I don't know if Unicode doesn't have // may fail to detect some spaces (I don't know if Unicode doesn't have
@@ -1627,41 +1627,41 @@ int wxString::Find(const wxChar *pszSub) const
bool wxString::ToLong(long *val, int base) const bool wxString::ToLong(long *val, int base) const
{ {
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToLong") ); wxCHECK_MSG( val, false, _T("NULL pointer in wxString::ToLong") );
wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") ); wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") );
const wxChar *start = c_str(); const wxChar *start = c_str();
wxChar *end; wxChar *end;
*val = wxStrtol(start, &end, base); *val = wxStrtol(start, &end, base);
// return TRUE only if scan was stopped by the terminating NUL and if the // return true only if scan was stopped by the terminating NUL and if the
// string was not empty to start with // string was not empty to start with
return !*end && (end != start); return !*end && (end != start);
} }
bool wxString::ToULong(unsigned long *val, int base) const bool wxString::ToULong(unsigned long *val, int base) const
{ {
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToULong") ); wxCHECK_MSG( val, false, _T("NULL pointer in wxString::ToULong") );
wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") ); wxASSERT_MSG( !base || (base > 1 && base <= 36), _T("invalid base") );
const wxChar *start = c_str(); const wxChar *start = c_str();
wxChar *end; wxChar *end;
*val = wxStrtoul(start, &end, base); *val = wxStrtoul(start, &end, base);
// return TRUE only if scan was stopped by the terminating NUL and if the // return true only if scan was stopped by the terminating NUL and if the
// string was not empty to start with // string was not empty to start with
return !*end && (end != start); return !*end && (end != start);
} }
bool wxString::ToDouble(double *val) const bool wxString::ToDouble(double *val) const
{ {
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToDouble") ); wxCHECK_MSG( val, false, _T("NULL pointer in wxString::ToDouble") );
const wxChar *start = c_str(); const wxChar *start = c_str();
wxChar *end; wxChar *end;
*val = wxStrtod(start, &end); *val = wxStrtod(start, &end);
// return TRUE only if scan was stopped by the terminating NUL and if the // return true only if scan was stopped by the terminating NUL and if the
// string was not empty to start with // string was not empty to start with
return !*end && (end != start); return !*end && (end != start);
} }
@@ -1752,7 +1752,7 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
// misc other operations // misc other operations
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// returns TRUE if the string matches the pattern which may contain '*' and // returns true if the string matches the pattern which may contain '*' and
// '?' metacharacters (as usual, '?' matches any character and '*' any number // '?' metacharacters (as usual, '?' matches any character and '*' any number
// of them) // of them)
bool wxString::Matches(const wxChar *pszMask) const bool wxString::Matches(const wxChar *pszMask) const
@@ -1818,7 +1818,7 @@ match:
switch ( *pszMask ) { switch ( *pszMask ) {
case wxT('?'): case wxT('?'):
if ( *pszTxt == wxT('\0') ) if ( *pszTxt == wxT('\0') )
return FALSE; return false;
// pszTxt and pszMask will be incremented in the loop statement // pszTxt and pszMask will be incremented in the loop statement
@@ -1837,7 +1837,7 @@ match:
// if there is nothing more, match // if there is nothing more, match
if ( *pszMask == wxT('\0') ) if ( *pszMask == wxT('\0') )
return TRUE; return true;
// are there any other metacharacters in the mask? // are there any other metacharacters in the mask?
size_t uiLenMask; size_t uiLenMask;
@@ -1855,7 +1855,7 @@ match:
wxString strToMatch(pszMask, uiLenMask); wxString strToMatch(pszMask, uiLenMask);
const wxChar* pMatch = wxStrstr(pszTxt, strToMatch); const wxChar* pMatch = wxStrstr(pszTxt, strToMatch);
if ( pMatch == NULL ) if ( pMatch == NULL )
return FALSE; return false;
// -1 to compensate "++" in the loop // -1 to compensate "++" in the loop
pszTxt = pMatch + uiLenMask - 1; pszTxt = pMatch + uiLenMask - 1;
@@ -1865,14 +1865,14 @@ match:
default: default:
if ( *pszMask != *pszTxt ) if ( *pszMask != *pszTxt )
return FALSE; return false;
break; break;
} }
} }
// match only if nothing left // match only if nothing left
if ( *pszTxt == wxT('\0') ) if ( *pszTxt == wxT('\0') )
return TRUE; return true;
// if we failed to match, backtrack if we can // if we failed to match, backtrack if we can
if ( pszLastStarInText ) { if ( pszLastStarInText ) {
@@ -1886,7 +1886,7 @@ match:
goto match; goto match;
} }
return FALSE; return false;
#endif // wxUSE_REGEX/!wxUSE_REGEX #endif // wxUSE_REGEX/!wxUSE_REGEX
} }
@@ -2245,7 +2245,7 @@ wxArrayString::insert(iterator it, const_iterator first, const_iterator last)
++first; ++first;
} }
} }
// expand the array // expand the array
void wxArrayString::SetCount(size_t count) void wxArrayString::SetCount(size_t count)
@@ -2320,7 +2320,7 @@ static wxArrayString::CompareFunction gs_compareFunction = NULL;
// if we don't use the compare function, this flag tells us if we sort the // if we don't use the compare function, this flag tells us if we sort the
// array in ascending or descending order // array in ascending or descending order
static bool gs_sortAscending = TRUE; static bool gs_sortAscending = true;
// function which is called by quick sort // function which is called by quick sort
extern "C" int wxC_CALLING_CONV // LINKAGEMODE extern "C" int wxC_CALLING_CONV // LINKAGEMODE
@@ -2380,15 +2380,15 @@ void wxArrayString::DoSort()
bool wxArrayString::operator==(const wxArrayString& a) const bool wxArrayString::operator==(const wxArrayString& a) const
{ {
if ( m_nCount != a.m_nCount ) if ( m_nCount != a.m_nCount )
return FALSE; return false;
for ( size_t n = 0; n < m_nCount; n++ ) for ( size_t n = 0; n < m_nCount; n++ )
{ {
if ( Item(n) != a[n] ) if ( Item(n) != a[n] )
return FALSE; return false;
} }
return TRUE; return true;
} }
#endif // !wxUSE_STL #endif // !wxUSE_STL

View File

@@ -6,7 +6,7 @@
// Created: 2001-07-10 // Created: 2001-07-10
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// ============================================================================ // ============================================================================
@@ -74,7 +74,7 @@ wxArrayString wxSystemOptionsModule::sm_optionValues;
bool wxSystemOptionsModule::OnInit() bool wxSystemOptionsModule::OnInit()
{ {
return TRUE; return true;
} }
void wxSystemOptionsModule::OnExit() void wxSystemOptionsModule::OnExit()
@@ -90,7 +90,7 @@ void wxSystemOptionsModule::OnExit()
// Option functions (arbitrary name/value mapping) // Option functions (arbitrary name/value mapping)
void wxSystemOptions::SetOption(const wxString& name, const wxString& value) void wxSystemOptions::SetOption(const wxString& name, const wxString& value)
{ {
int idx = wxSystemOptionsModule::sm_optionNames.Index(name, FALSE); int idx = wxSystemOptionsModule::sm_optionNames.Index(name, false);
if (idx == wxNOT_FOUND) if (idx == wxNOT_FOUND)
{ {
wxSystemOptionsModule::sm_optionNames.Add(name); wxSystemOptionsModule::sm_optionNames.Add(name);
@@ -112,7 +112,7 @@ void wxSystemOptions::SetOption(const wxString& name, int value)
wxString wxSystemOptions::GetOption(const wxString& name) wxString wxSystemOptions::GetOption(const wxString& name)
{ {
int idx = wxSystemOptionsModule::sm_optionNames.Index(name, FALSE); int idx = wxSystemOptionsModule::sm_optionNames.Index(name, false);
if (idx == wxNOT_FOUND) if (idx == wxNOT_FOUND)
return wxEmptyString; return wxEmptyString;
else else
@@ -126,7 +126,7 @@ int wxSystemOptions::GetOptionInt(const wxString& name)
bool wxSystemOptions::HasOption(const wxString& name) bool wxSystemOptions::HasOption(const wxString& name)
{ {
return (wxSystemOptionsModule::sm_optionNames.Index(name, FALSE) != wxNOT_FOUND); return (wxSystemOptionsModule::sm_optionNames.Index(name, false) != wxNOT_FOUND);
} }
#endif #endif