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

@@ -79,8 +79,8 @@ public:
virtual bool Disconnect(void);
// Callbacks to BOTH - override at will
// Default behaviour is to delete connection and return TRUE
virtual bool OnDisconnect(void) { delete this; return TRUE; }
// Default behaviour is to delete connection and return true
virtual bool OnDisconnect(void) { delete this; return true; }
// To enable the compressor (NOTE: not implemented!)
void Compress(bool on);
@@ -116,7 +116,7 @@ public:
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);
// Callbacks to SERVER - override at will

View File

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

View File

@@ -35,7 +35,7 @@ public:
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0,
bool noRefresh = FALSE );
bool noRefresh = false );
// scroll to the given (in logical coords) position
virtual void Scroll(int x, int y);
@@ -51,9 +51,9 @@ public:
virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
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
// 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
// actually scroll a non-constant distance
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
// 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;
// the methods to be called from the window event handlers
@@ -219,7 +219,7 @@ protected:
public:
wxScrolledWindow() { }
wxScrolledWindow(wxWindow *parent,
wxWindowID winid = -1,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxScrolledWindowStyle,

View File

@@ -48,7 +48,7 @@ public:
void SetItemCount(size_t count) { m_count = count; }
// 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
void OnItemAdd(size_t WXUNUSED(item)) { wxFAIL_MSG( _T("TODO") ); }
@@ -59,7 +59,7 @@ public:
// select one item, use SelectRange() insted if possible!
//
// 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
//
@@ -68,7 +68,7 @@ public:
// (meaning that too many items changed state to bother counting them
// individually)
bool SelectRange(size_t itemFrom, size_t itemTo,
bool select = TRUE,
bool select = true,
wxArrayInt *itemsChanged = NULL);
// return true if the given item is selected
@@ -83,12 +83,12 @@ public:
private:
// (re)init
void Init() { m_defaultState = FALSE; }
void Init() { m_defaultState = false; }
// the total number of items we handle
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
// handle selection of all items efficiently
bool m_defaultState;

View File

@@ -44,7 +44,7 @@ public:
// path is optional and is ignored under Win32 and used as the directory to
// 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
bool Create(const wxString& name, const wxString& path = wxEmptyString);

View File

@@ -136,7 +136,7 @@ public:
wxSocketBase& Write(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 WaitForRead(long seconds = -1, long milliseconds = 0);
bool WaitForWrite(long seconds = -1, long milliseconds = 0);
@@ -153,7 +153,7 @@ public:
// event handling
void *GetClientData() const { return m_clientData; }
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 Notify(bool notify);
@@ -236,8 +236,8 @@ class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase
public:
wxSocketServer(wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE);
wxSocketBase* Accept(bool wait = TRUE);
bool AcceptWith(wxSocketBase& socket, bool wait = TRUE);
wxSocketBase* Accept(bool wait = true);
bool AcceptWith(wxSocketBase& socket, bool wait = true);
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
@@ -257,7 +257,7 @@ public:
wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
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);
@@ -321,7 +321,7 @@ public:
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
#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 ), \
(wxObject *) NULL ),

View File

@@ -6,7 +6,7 @@
// Created: 2004/02/01
// RCS-ID: $Id$
// Copyright: (c) 2004, Vaclav Slavik
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SOUND_H_BASE_

View File

@@ -112,11 +112,11 @@ typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
// macros for handling spin events
#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) \
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) \
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

View File

@@ -70,7 +70,7 @@ protected:
#endif // platform
#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_

View File

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

View File

@@ -41,7 +41,7 @@ public:
virtual wxBitmap GetBitmap() const = 0;
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
virtual bool AcceptsFocus() const { return false; }
protected:
virtual wxSize DoGetBestSize() const;

View File

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

View File

@@ -96,7 +96,7 @@ public:
virtual int GetBorderY() const = 0;
// don't want status bars to accept the focus at all
virtual bool AcceptsFocus() const { return FALSE; }
virtual bool AcceptsFocus() const { return false; }
protected:
// set the widths array to NULL

View File

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

View File

@@ -159,7 +159,7 @@ public:
// all the requested data or not
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
virtual bool CanRead() const;
@@ -181,7 +181,7 @@ public:
// 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);
@@ -284,7 +284,7 @@ public:
wxCountingOutputStream();
size_t GetSize() const;
bool Ok() const { return TRUE; }
bool Ok() const { return true; }
protected:
virtual size_t OnSysWrite(const void *buffer, size_t size);
@@ -375,9 +375,9 @@ public:
void ResetBuffer();
// NB: the buffer must always be allocated with malloc() if takeOwn is
// TRUE as it will be deallocated by free()
void SetBufferIO(void *start, void *end, bool takeOwnership = FALSE);
void SetBufferIO(void *start, size_t len, bool takeOwnership = FALSE);
// true as it will be deallocated by free()
void SetBufferIO(void *start, void *end, bool takeOwnership = false);
void SetBufferIO(void *start, size_t len, bool takeOwnership = false);
void SetBufferIO(size_t bufsize);
void *GetBufferStart() const { return m_buffer_start; }
void *GetBufferEnd() const { return m_buffer_end; }

View File

@@ -698,7 +698,7 @@ public:
size_t Len() const { return length(); }
// string contains any characters?
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(); }
// truncate the string to given length
wxString& Truncate(size_t uiLen);
@@ -978,10 +978,10 @@ public:
int CmpNoCase(const wxChar *psz) const { return wxStricmp(c_str(), psz); }
// test for the string equality, either considering case or not
// (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; }
// comparison with a signle character: returns TRUE if equal
bool IsSameAs(wxChar c, bool compareWithCase = TRUE) const
// comparison with a signle character: returns true if equal
bool IsSameAs(wxChar c, bool compareWithCase = true) const
{
return (length() == 1) && (compareWithCase ? GetChar(0u) == c
: wxToupper(GetChar(0u)) == wxToupper(c));
@@ -998,7 +998,7 @@ public:
// 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
// false
bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const;
// get first nCount characters
@@ -1035,25 +1035,25 @@ public:
// trimming/padding whitespace (either side) and truncating
// 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)
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 (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)
int Find(const wxChar *pszSub) const; // like strstr
// replace first (or all of bReplaceAll) occurences of substring with
// another string, returns the number of replacements made
size_t Replace(const wxChar *szOld,
const wxChar *szNew,
bool bReplaceAll = TRUE);
bool bReplaceAll = true);
// check if the string contents matches a mask containing '*' and '?'
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
// 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
@@ -1136,8 +1136,8 @@ public:
int First( const wxChar ch ) const { return Find(ch); }
int First( const wxChar* psz ) const { return Find(psz); }
int First( const wxString &str ) const { return Find(str); }
int Last( const wxChar ch ) const { return Find(ch, TRUE); }
bool Contains(const wxString& str) const { return Find(str) != -1; }
int Last( const wxChar ch ) const { return Find(ch, true); }
bool Contains(const wxString& str) const { return Find(str) != wxNOT_FOUND; }
// use IsEmpty()
bool IsNull() const { return IsEmpty(); }

View File

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

View File

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

View File

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

View File

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

View File

@@ -595,9 +595,9 @@ wxSize wxSizer::FitSize( wxWindow *window )
// 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;
if ( size.y > sizeMax.y && sizeMax.y != -1 )
if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y;
return size;
@@ -631,9 +631,9 @@ wxSize wxSizer::VirtualFitSize( wxWindow *window )
// 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;
if ( size.y > sizeMax.y && sizeMax.y != -1 )
if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y;
return size;

View File

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

View File

@@ -1302,127 +1302,127 @@ public:
wxMBConv_mac(const wxChar* name)
{
Init( wxMacGetSystemEncFromFontEnc(wxFontMapper::Get()->CharsetToEncoding(name, FALSE) ) ) ;
Init( wxMacGetSystemEncFromFontEnc(wxFontMapper::Get()->CharsetToEncoding(name, false) ) ) ;
}
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);
}
~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) ;
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);
}
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
{
OSStatus status = noErr ;
ByteCount byteOutLen ;
ByteCount byteInLen = strlen(psz) ;
wchar_t *tbuf = NULL ;
UniChar* ubuf = NULL ;
size_t res = 0 ;
OSStatus status = noErr ;
ByteCount byteOutLen ;
ByteCount byteInLen = strlen(psz) ;
wchar_t *tbuf = NULL ;
UniChar* ubuf = NULL ;
size_t res = 0 ;
if (buf == NULL)
{
n = byteInLen ;
tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T) ;
}
ByteCount byteBufferLen = n * sizeof( UniChar ) ;
if (buf == NULL)
{
n = byteInLen ;
tbuf = (wchar_t*) malloc( n * SIZEOF_WCHAR_T) ;
}
ByteCount byteBufferLen = n * sizeof( UniChar ) ;
#if SIZEOF_WCHAR_T == 4
ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ;
ubuf = (UniChar*) malloc( byteBufferLen + 2 ) ;
#else
ubuf = (UniChar*) (buf ? buf : tbuf) ;
ubuf = (UniChar*) (buf ? buf : tbuf) ;
#endif
status = TECConvertText(m_MB2WC_converter, (ConstTextPtr) psz , byteInLen, &byteInLen,
(TextPtr) ubuf , byteBufferLen, &byteOutLen);
status = TECConvertText(m_MB2WC_converter, (ConstTextPtr) psz , byteInLen, &byteInLen,
(TextPtr) ubuf , byteBufferLen, &byteOutLen);
#if SIZEOF_WCHAR_T == 4
// 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
ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ;
wxMBConvUTF16BE converter ;
res = converter.MB2WC( (buf ? buf : tbuf) , (const char*)ubuf , n ) ;
free( ubuf ) ;
wxMBConvUTF16BE converter ;
res = converter.MB2WC( (buf ? buf : tbuf) , (const char*)ubuf , n ) ;
free( ubuf ) ;
#else
res = byteOutLen / sizeof( UniChar ) ;
res = byteOutLen / sizeof( UniChar ) ;
#endif
if ( buf == NULL )
free(tbuf) ;
if ( buf == NULL )
free(tbuf) ;
if ( buf && res < n)
buf[res] = 0;
return res ;
return res ;
}
size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const
{
OSStatus status = noErr ;
ByteCount byteOutLen ;
ByteCount byteInLen = wxWcslen(psz) * SIZEOF_WCHAR_T ;
OSStatus status = noErr ;
ByteCount byteOutLen ;
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 ) ;
}
if (buf == NULL)
{
// worst case
n = byteInLen * 2 ;
tbuf = (char*) malloc( n ) ;
}
ByteCount byteBufferLen = n ;
UniChar* ubuf = NULL ;
ByteCount byteBufferLen = n ;
UniChar* ubuf = NULL ;
#if SIZEOF_WCHAR_T == 4
wxMBConvUTF16BE converter ;
size_t unicharlen = converter.WC2MB( NULL , psz , 0 ) ;
byteInLen = unicharlen ;
ubuf = (UniChar*) malloc( byteInLen + 2 ) ;
converter.WC2MB( (char*) ubuf , psz, unicharlen + 2 ) ;
wxMBConvUTF16BE converter ;
size_t unicharlen = converter.WC2MB( NULL , psz , 0 ) ;
byteInLen = unicharlen ;
ubuf = (UniChar*) malloc( byteInLen + 2 ) ;
converter.WC2MB( (char*) ubuf , psz, unicharlen + 2 ) ;
#else
ubuf = (UniChar*) psz ;
ubuf = (UniChar*) psz ;
#endif
status = TECConvertText(m_WC2MB_converter, (ConstTextPtr) ubuf , byteInLen, &byteInLen,
(TextPtr) (buf ? buf : tbuf) , byteBufferLen, &byteOutLen);
status = TECConvertText(m_WC2MB_converter, (ConstTextPtr) ubuf , byteInLen, &byteInLen,
(TextPtr) (buf ? buf : tbuf) , byteBufferLen, &byteOutLen);
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
free( ubuf ) ;
#endif
if ( buf == NULL )
free(tbuf) ;
if ( buf == NULL )
free(tbuf) ;
size_t res = byteOutLen ;
size_t res = byteOutLen ;
if ( buf && res < n)
buf[res] = 0;
return res ;
return res ;
}
bool IsOk() const
{ return m_MB2WC_converter != NULL && m_WC2MB_converter != NULL ; }
private:
TECObjectRef m_MB2WC_converter ;
TECObjectRef m_WC2MB_converter ;
TECObjectRef m_MB2WC_converter ;
TECObjectRef m_WC2MB_converter ;
TextEncodingBase m_char_encoding ;
TextEncodingBase m_unicode_encoding ;
TextEncodingBase m_char_encoding ;
TextEncodingBase m_unicode_encoding ;
};
#endif // defined(__WXMAC__) && defined(TARGET_CARBON)
@@ -1628,16 +1628,16 @@ wxMBConv *wxCSConv::DoCreate() const
#endif // wxHAVE_WIN32_MB2WC
#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;
wxMBConv_mac *conv = m_name ? new wxMBConv_mac(m_name)
: new wxMBConv_mac(m_encoding);
if ( conv->IsOk() )
return conv;
delete conv;
}
delete conv;
}
}
#endif
// step (2)

View File

@@ -70,14 +70,14 @@ void wxStreamBuffer::InitBuffer()
m_buffer_size = 0;
// if we are going to allocate the buffer, we should free it later as well
m_destroybuf = TRUE;
m_destroybuf = true;
}
void wxStreamBuffer::Init()
{
InitBuffer();
m_fixed = TRUE;
m_fixed = true;
}
wxStreamBuffer::wxStreamBuffer(BufMode mode)
@@ -87,7 +87,7 @@ wxStreamBuffer::wxStreamBuffer(BufMode mode)
m_stream = NULL;
m_mode = mode;
m_flushable = FALSE;
m_flushable = false;
}
wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
@@ -97,7 +97,7 @@ wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
m_stream = &stream;
m_mode = mode;
m_flushable = TRUE;
m_flushable = true;
}
wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
@@ -115,7 +115,7 @@ wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
m_flushable = buffer.m_flushable;
m_stream = buffer.m_stream;
m_mode = buffer.m_mode;
m_destroybuf = FALSE;
m_destroybuf = false;
}
void wxStreamBuffer::FreeBuffer()
@@ -172,7 +172,7 @@ void wxStreamBuffer::SetBufferIO(size_t bufsize)
if ( bufsize )
{
SetBufferIO(malloc(bufsize), bufsize, TRUE /* take ownership */);
SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */);
}
else // no buffer size => no buffer
{
@@ -198,41 +198,41 @@ bool wxStreamBuffer::FillBuffer()
{
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 )
return FALSE;
return false;
size_t count = inStream->OnSysRead(m_buffer_start, m_buffer_size);
if ( !count )
return FALSE;
return false;
m_buffer_end = m_buffer_start + count;
m_buffer_pos = m_buffer_start;
return TRUE;
return true;
}
// write the buffer contents to the stream (only for write buffers)
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)
if ( m_buffer_pos == m_buffer_start )
return FALSE;
return false;
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 count = outStream->OnSysWrite(m_buffer_start, current);
if ( count != current )
return FALSE;
return false;
m_buffer_pos = m_buffer_start;
return TRUE;
return true;
}
size_t wxStreamBuffer::GetDataLeft()
@@ -767,7 +767,7 @@ size_t wxInputStream::Ungetch(const void *buf, size_t bufsize)
if (!ptrback)
return 0;
// Eof() shouldn't return TRUE any longer
// Eof() shouldn't return true any longer
if ( m_lasterror == wxSTREAM_EOF )
m_lasterror = wxSTREAM_NO_ERROR;

View File

@@ -250,7 +250,7 @@ bool wxStringBase::AllocBuffer(size_t nLen)
if ( pData == NULL ) {
// allocation failures are handled by the caller
return FALSE;
return false;
}
pData->nRefs = 1;
@@ -258,7 +258,7 @@ bool wxStringBase::AllocBuffer(size_t nLen)
pData->nAllocLength = nLen + EXTRA_ALLOC;
m_pchData = pData->data(); // data starts after wxStringData
m_pchData[nLen] = wxT('\0');
return TRUE;
return true;
}
// must be called before changing this string
@@ -271,14 +271,14 @@ bool wxStringBase::CopyBeforeWrite()
size_t nLen = pData->nDataLength;
if ( !AllocBuffer(nLen) ) {
// allocation failures are handled by the caller
return FALSE;
return false;
}
memcpy(m_pchData, pData->data(), nLen*sizeof(wxChar));
}
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
return TRUE;
return true;
}
// must be called before replacing contents of this string
@@ -293,7 +293,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
pData->Unlock();
if ( !AllocBuffer(nLen) ) {
// allocation failures are handled by the caller
return FALSE;
return false;
}
}
else {
@@ -310,7 +310,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
if ( pData == NULL ) {
// allocation failures are handled by the caller
// keep previous data since reallocation failed
return FALSE;
return false;
}
pData->nAllocLength = nLen;
@@ -323,7 +323,7 @@ bool wxStringBase::AllocBeforeWrite(size_t nLen)
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
return TRUE;
return true;
}
wxStringBase& wxStringBase::append(size_t n, wxChar ch)
@@ -368,7 +368,7 @@ bool wxStringBase::Alloc(size_t nLen)
if ( pData == NULL ) {
// allocation failure handled by caller
return FALSE;
return false;
}
pData->nRefs = 1;
@@ -382,7 +382,7 @@ bool wxStringBase::Alloc(size_t nLen)
size_t nOldLen = pData->nDataLength;
if ( !AllocBuffer(nLen) ) {
// allocation failure handled by caller
return FALSE;
return false;
}
memcpy(m_pchData, pData->data(), nOldLen*sizeof(wxChar));
}
@@ -395,7 +395,7 @@ bool wxStringBase::Alloc(size_t nLen)
if ( pData == NULL ) {
// allocation failure handled by caller
// keep previous data since reallocation failed
return FALSE;
return false;
}
// it's not important if the pointer changed or not (the check for this
@@ -405,7 +405,7 @@ bool wxStringBase::Alloc(size_t nLen)
}
}
//else: we've already got enough
return TRUE;
return true;
}
wxStringBase::iterator wxStringBase::begin()
@@ -773,13 +773,13 @@ bool wxStringBase::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData)
else {
if ( !AllocBeforeWrite(nSrcLen) ) {
// allocation failure handled by caller
return FALSE;
return false;
}
memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxChar));
GetStringData()->nDataLength = nSrcLen;
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();
if ( !AllocBuffer(nNewLen) ) {
// allocation failure handled by caller
return FALSE;
return false;
}
memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxChar));
pOldData->Unlock();
@@ -820,7 +820,7 @@ bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
// we have to grow the buffer
if ( capacity() < nNewLen ) {
// allocation failure handled by caller
return FALSE;
return false;
}
}
else {
@@ -839,7 +839,7 @@ bool wxStringBase::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
GetStringData()->nDataLength = nNewLen; // and fix the length
}
//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 {
if ( !dest.AllocBuffer(nCopyLen) ) {
// allocation failure handled by caller
return FALSE;
return false;
}
memcpy(dest.m_pchData, m_pchData + nCopyIndex, nCopyLen*sizeof(wxChar));
}
return TRUE;
return true;
}
#endif // !wxUSE_STL
@@ -1092,7 +1092,7 @@ wxChar *wxString::GetWriteBuf(size_t nLen)
}
wxASSERT( GetStringData()->nRefs == 1 );
GetStringData()->Validate(FALSE);
GetStringData()->Validate(false);
return m_pchData;
}
@@ -1101,13 +1101,13 @@ wxChar *wxString::GetWriteBuf(size_t nLen)
void wxString::UngetWriteBuf()
{
GetStringData()->nDataLength = wxStrlen(m_pchData);
GetStringData()->Validate(TRUE);
GetStringData()->Validate(true);
}
void wxString::UngetWriteBuf(size_t nLen)
{
GetStringData()->nDataLength = nLen;
GetStringData()->Validate(TRUE);
GetStringData()->Validate(true);
}
#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
// 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
{
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++ )
{
// no match
return FALSE;
return false;
}
}
@@ -1337,7 +1337,7 @@ bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const
*rest = p;
}
return TRUE;
return true;
}
// extract nCount last (rightmost) characters
@@ -1358,7 +1358,7 @@ wxString wxString::Right(size_t nCount) const
wxString wxString::AfterLast(wxChar ch) const
{
wxString str;
int iPos = Find(ch, TRUE);
int iPos = Find(ch, true);
if ( iPos == wxNOT_FOUND )
str = *this;
else
@@ -1394,7 +1394,7 @@ wxString wxString::BeforeFirst(wxChar ch) const
wxString wxString::BeforeLast(wxChar ch) const
{
wxString str;
int iPos = Find(ch, TRUE);
int iPos = Find(ch, true);
if ( iPos != wxNOT_FOUND && iPos != 0 )
str = wxString(c_str(), iPos);
@@ -1469,20 +1469,20 @@ bool wxString::IsAscii() const
{
const wxChar *s = (const wxChar*) *this;
while(*s){
if(!isascii(*s)) return(FALSE);
if(!isascii(*s)) return(false);
s++;
}
return(TRUE);
return(true);
}
bool wxString::IsWord() const
{
const wxChar *s = (const wxChar*) *this;
while(*s){
if(!wxIsalpha(*s)) return(FALSE);
if(!wxIsalpha(*s)) return(false);
s++;
}
return(TRUE);
return(true);
}
bool wxString::IsNumber() const
@@ -1491,17 +1491,17 @@ bool wxString::IsNumber() const
if (wxStrlen(s))
if ((s[0] == '-') || (s[0] == '+')) s++;
while(*s){
if(!wxIsdigit(*s)) return(FALSE);
if(!wxIsdigit(*s)) return(false);
s++;
}
return(TRUE);
return(true);
}
wxString wxString::Strip(stripType w) const
{
wxString s = *this;
if ( w & leading ) s.Trim(FALSE);
if ( w & trailing ) s.Trim(TRUE);
if ( w & leading ) s.Trim(false);
if ( w & trailing ) s.Trim(true);
return s;
}
@@ -1529,7 +1529,7 @@ wxString& wxString::MakeLower()
// 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
// 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
@@ -1627,41 +1627,41 @@ int wxString::Find(const wxChar *pszSub) 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") );
const wxChar *start = c_str();
wxChar *end;
*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
return !*end && (end != start);
}
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") );
const wxChar *start = c_str();
wxChar *end;
*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
return !*end && (end != start);
}
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();
wxChar *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
return !*end && (end != start);
}
@@ -1752,7 +1752,7 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
// 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
// of them)
bool wxString::Matches(const wxChar *pszMask) const
@@ -1818,7 +1818,7 @@ match:
switch ( *pszMask ) {
case wxT('?'):
if ( *pszTxt == wxT('\0') )
return FALSE;
return false;
// pszTxt and pszMask will be incremented in the loop statement
@@ -1837,7 +1837,7 @@ match:
// if there is nothing more, match
if ( *pszMask == wxT('\0') )
return TRUE;
return true;
// are there any other metacharacters in the mask?
size_t uiLenMask;
@@ -1855,7 +1855,7 @@ match:
wxString strToMatch(pszMask, uiLenMask);
const wxChar* pMatch = wxStrstr(pszTxt, strToMatch);
if ( pMatch == NULL )
return FALSE;
return false;
// -1 to compensate "++" in the loop
pszTxt = pMatch + uiLenMask - 1;
@@ -1865,14 +1865,14 @@ match:
default:
if ( *pszMask != *pszTxt )
return FALSE;
return false;
break;
}
}
// match only if nothing left
if ( *pszTxt == wxT('\0') )
return TRUE;
return true;
// if we failed to match, backtrack if we can
if ( pszLastStarInText ) {
@@ -1886,7 +1886,7 @@ match:
goto match;
}
return FALSE;
return false;
#endif // wxUSE_REGEX/!wxUSE_REGEX
}
@@ -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
// array in ascending or descending order
static bool gs_sortAscending = TRUE;
static bool gs_sortAscending = true;
// function which is called by quick sort
extern "C" int wxC_CALLING_CONV // LINKAGEMODE
@@ -2380,15 +2380,15 @@ void wxArrayString::DoSort()
bool wxArrayString::operator==(const wxArrayString& a) const
{
if ( m_nCount != a.m_nCount )
return FALSE;
return false;
for ( size_t n = 0; n < m_nCount; n++ )
{
if ( Item(n) != a[n] )
return FALSE;
return false;
}
return TRUE;
return true;
}
#endif // !wxUSE_STL

View File

@@ -6,7 +6,7 @@
// Created: 2001-07-10
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
@@ -74,7 +74,7 @@ wxArrayString wxSystemOptionsModule::sm_optionValues;
bool wxSystemOptionsModule::OnInit()
{
return TRUE;
return true;
}
void wxSystemOptionsModule::OnExit()
@@ -90,7 +90,7 @@ void wxSystemOptionsModule::OnExit()
// Option functions (arbitrary name/value mapping)
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)
{
wxSystemOptionsModule::sm_optionNames.Add(name);
@@ -112,7 +112,7 @@ void wxSystemOptions::SetOption(const wxString& name, int value)
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)
return wxEmptyString;
else
@@ -126,7 +126,7 @@ int wxSystemOptions::GetOptionInt(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