Eliminate -Wzero-as-null-pointer-constant warnings in the headers
This commit is contained in:
@@ -709,7 +709,7 @@ public:
|
||||
wxDataViewItem GetCurrentItem() const;
|
||||
void SetCurrentItem(const wxDataViewItem& item);
|
||||
|
||||
virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(0); }
|
||||
virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(NULL); }
|
||||
virtual int GetCountPerPage() const { return wxNOT_FOUND; }
|
||||
|
||||
// Currently focused column of the current item or NULL if no column has focus
|
||||
|
@@ -1327,7 +1327,7 @@ public:
|
||||
: m_dc(thdc.m_dc),
|
||||
m_hdc(thdc.m_hdc)
|
||||
{
|
||||
const_cast<TempHDC&>(thdc).m_hdc = 0;
|
||||
const_cast<TempHDC&>(thdc).m_hdc = NULL;
|
||||
}
|
||||
|
||||
~TempHDC()
|
||||
|
@@ -231,9 +231,9 @@ public:
|
||||
// return the platform standard DLL extension (with leading dot)
|
||||
static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY);
|
||||
|
||||
wxDynamicLibrary() : m_handle(0) { }
|
||||
wxDynamicLibrary() : m_handle(NULL) { }
|
||||
wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT)
|
||||
: m_handle(0)
|
||||
: m_handle(NULL)
|
||||
{
|
||||
Load(libname, flags);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
~wxDynamicLibrary() { Unload(); }
|
||||
|
||||
// return true if the library was loaded successfully
|
||||
bool IsLoaded() const { return m_handle != 0; }
|
||||
bool IsLoaded() const { return m_handle != NULL; }
|
||||
|
||||
// load the library with the given name (full or not), return true if ok
|
||||
bool Load(const wxString& libname, int flags = wxDL_DEFAULT);
|
||||
@@ -256,13 +256,13 @@ public:
|
||||
// detach the library object from its handle, i.e. prevent the object from
|
||||
// unloading the library in its dtor -- the caller is now responsible for
|
||||
// doing this
|
||||
wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; }
|
||||
wxDllType Detach() { wxDllType h = m_handle; m_handle = NULL; return h; }
|
||||
|
||||
// unload the given library handle (presumably returned by Detach() before)
|
||||
static void Unload(wxDllType handle);
|
||||
|
||||
// unload the library, also done automatically in dtor
|
||||
void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } }
|
||||
void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = NULL; } }
|
||||
|
||||
// Return the raw handle from dlopen and friends.
|
||||
wxDllType GetLibHandle() const { return m_handle; }
|
||||
@@ -363,7 +363,7 @@ public:
|
||||
|
||||
protected:
|
||||
// common part of GetSymbol() and HasSymbol()
|
||||
void *DoGetSymbol(const wxString& name, bool *success = 0) const;
|
||||
void* DoGetSymbol(const wxString& name, bool* success = NULL) const;
|
||||
|
||||
#ifdef wxHAVE_DYNLIB_ERROR
|
||||
// log the error after a dlxxx() function failure
|
||||
|
@@ -123,7 +123,7 @@ public:
|
||||
void Unload();
|
||||
|
||||
bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); }
|
||||
void *GetSymbol(const wxString &symbol, bool *success = 0)
|
||||
void* GetSymbol(const wxString& symbol, bool* success = NULL)
|
||||
{
|
||||
return m_entry->GetSymbol( symbol, success );
|
||||
}
|
||||
|
@@ -91,7 +91,7 @@ typedef int wxEventType;
|
||||
wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj)
|
||||
|
||||
#define wxDECLARE_EVENT_TABLE_TERMINATOR() \
|
||||
wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0)
|
||||
wxEventTableEntry(wxEVT_NULL, 0, 0, NULL, NULL)
|
||||
|
||||
// generate a new unique event type
|
||||
extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
virtual bool IsFree() const { return false; }
|
||||
|
||||
// Returns handle.
|
||||
virtual WXHANDLE GetResourceHandle() const { return 0; }
|
||||
virtual WXHANDLE GetResourceHandle() const { return NULL; }
|
||||
#endif // defined(__WXMSW__)
|
||||
|
||||
protected:
|
||||
|
@@ -257,7 +257,7 @@ public:
|
||||
// pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants.
|
||||
// You can set different header/footer for odd and even pages
|
||||
|
||||
void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = 0);
|
||||
void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int* sizes = NULL);
|
||||
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used)
|
||||
|
||||
// Sets font sizes to be relative to the given size or the system
|
||||
|
@@ -73,11 +73,11 @@ public:
|
||||
// create a bitmap compatible with the given HDC (or screen by default) and
|
||||
// return its handle, the caller is responsible for freeing it (using
|
||||
// DeleteObject())
|
||||
HBITMAP CreateDDB(HDC hdc = 0) const;
|
||||
HBITMAP CreateDDB(HDC hdc = NULL) const;
|
||||
|
||||
// get the handle from the DIB and reset it, i.e. this object won't destroy
|
||||
// the DIB after this (but the caller should do it)
|
||||
HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; }
|
||||
HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = NULL; return hbmp; }
|
||||
|
||||
#if defined(__WXMSW__) && wxUSE_PALETTE
|
||||
// create a palette for this DIB (always a trivial/default one for 24bpp)
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
// ---------
|
||||
|
||||
// return true if DIB was successfully created, false otherwise
|
||||
bool IsOk() const { return m_handle != 0; }
|
||||
bool IsOk() const { return m_handle != NULL; }
|
||||
|
||||
// get the bitmap size
|
||||
wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); }
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
// a plain DIB or a DIB section (in which case the last parameter must be
|
||||
// non NULL)
|
||||
static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi,
|
||||
HDC hdc = 0,
|
||||
HDC hdc = NULL,
|
||||
const void *bits = NULL);
|
||||
|
||||
// create a plain DIB (not a DIB section) from a DDB, the caller is
|
||||
@@ -242,7 +242,7 @@ private:
|
||||
inline
|
||||
void wxDIB::Init()
|
||||
{
|
||||
m_handle = 0;
|
||||
m_handle = NULL;
|
||||
m_ownsHandle = true;
|
||||
|
||||
m_data = NULL;
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
bool Play(wxDC *dc, wxRect *rectBound = NULL);
|
||||
|
||||
// accessors
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_hMF != 0; }
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_hMF != NULL; }
|
||||
|
||||
wxSize GetSize() const;
|
||||
int GetWidth() const { return GetSize().x; }
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
// Detach the HENHMETAFILE from this object, i.e. don't delete the handle
|
||||
// in the dtor -- the caller is now responsible for doing this, e.g. using
|
||||
// Free() method below.
|
||||
WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = 0; return h; }
|
||||
WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = NULL; return h; }
|
||||
|
||||
// Destroy the given HENHMETAFILE object.
|
||||
static void Free(WXHANDLE handle);
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
underlined, face, encoding);
|
||||
}
|
||||
|
||||
wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
|
||||
wxFont(const wxNativeFontInfo& info, WXHFONT hFont = NULL)
|
||||
{
|
||||
Create(info, hFont);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
encoding));
|
||||
}
|
||||
|
||||
bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
|
||||
bool Create(const wxNativeFontInfo& info, WXHFONT hFont = NULL);
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
{
|
||||
m_width = m_height = m_depth = 0;
|
||||
|
||||
m_handle = 0;
|
||||
m_handle = NULL;
|
||||
}
|
||||
|
||||
wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData()
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
// accessors
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_handle != 0; }
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_handle != NULL; }
|
||||
|
||||
void SetSize(int w, int h) { m_width = w; m_height = h; }
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
// accessors
|
||||
WXHANDLE GetHandle() const
|
||||
{ return IsNull() ? 0 : GetGDIImageData()->m_handle; }
|
||||
{ return IsNull() ? NULL : GetGDIImageData()->m_handle; }
|
||||
void SetHandle(WXHANDLE handle)
|
||||
{ AllocExclusive(); GetGDIImageData()->m_handle = handle; }
|
||||
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
// Low-level invocation function. Pass either an array of variants,
|
||||
// or an array of pointers to variants.
|
||||
bool Invoke(const wxString& member, int action,
|
||||
wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const;
|
||||
wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = NULL) const;
|
||||
|
||||
// Invoke a member function
|
||||
wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]);
|
||||
|
@@ -162,7 +162,8 @@ protected:
|
||||
// implicitly convertible to HANDLE, which is a pointer.
|
||||
static HANDLE InvalidHandle()
|
||||
{
|
||||
return reinterpret_cast<HANDLE>(INVALID_VALUE);
|
||||
wxUIntPtr h = INVALID_VALUE;
|
||||
return reinterpret_cast<HANDLE>(h);
|
||||
}
|
||||
|
||||
void DoClose()
|
||||
@@ -449,7 +450,7 @@ private:
|
||||
class MemoryHDC
|
||||
{
|
||||
public:
|
||||
MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); }
|
||||
MemoryHDC(HDC hdc = NULL) { m_hdc = ::CreateCompatibleDC(hdc); }
|
||||
~MemoryHDC() { ::DeleteDC(m_hdc); }
|
||||
|
||||
operator HDC() const { return m_hdc; }
|
||||
@@ -483,7 +484,7 @@ public:
|
||||
~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); }
|
||||
|
||||
// return true if the object was successfully selected
|
||||
operator bool() const { return m_hgdiobj != 0; }
|
||||
operator bool() const { return m_hgdiobj != NULL; }
|
||||
|
||||
private:
|
||||
HDC m_hdc;
|
||||
@@ -578,7 +579,7 @@ class MonoBitmap : public AutoHBITMAP
|
||||
{
|
||||
public:
|
||||
MonoBitmap(int w, int h)
|
||||
: AutoHBITMAP(::CreateBitmap(w, h, 1, 1, 0))
|
||||
: AutoHBITMAP(::CreateBitmap(w, h, 1, 1, NULL))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@@ -136,7 +136,7 @@ public:
|
||||
size_t *pnValues, // number of values
|
||||
size_t *pnMaxValueLen) const;
|
||||
// return true if the key is opened
|
||||
bool IsOpened() const { return m_hKey != 0; }
|
||||
bool IsOpened() const { return m_hKey != NULL; }
|
||||
// for "if ( !key ) wxLogError(...)" kind of expressions
|
||||
operator bool() const { return m_dwLastError == 0; }
|
||||
|
||||
|
@@ -453,7 +453,7 @@ public:
|
||||
// The brush returned from here must remain valid at least until the next
|
||||
// event loop iteration. Returning 0, as is done by default, indicates
|
||||
// there is no custom background brush.
|
||||
virtual WXHBRUSH MSWGetCustomBgBrush() { return 0; }
|
||||
virtual WXHBRUSH MSWGetCustomBgBrush() { return NULL; }
|
||||
|
||||
// this function should return the brush to paint the children controls
|
||||
// background or 0 if this window doesn't impose any particular background
|
||||
|
@@ -150,7 +150,7 @@ name##PluginSentinel m_pluginsentinel
|
||||
// The 'this' pointer is always true, so use this version
|
||||
// to cast the this pointer and avoid compiler warnings.
|
||||
#define wxDynamicCastThis(className) \
|
||||
(IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
|
||||
(IsKindOf(&className::ms_classInfo) ? (className*)this : NULL)
|
||||
|
||||
template <class T>
|
||||
inline T *wxCheckCast(const void *ptr)
|
||||
|
@@ -52,13 +52,13 @@ public:
|
||||
// If you pass a palette pointer, you must free the palette yourself.
|
||||
|
||||
static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236,
|
||||
unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
|
||||
unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
|
||||
|
||||
// This version sets a palette in the destination image so you don't
|
||||
// have to manage it yourself.
|
||||
|
||||
static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236,
|
||||
unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
|
||||
unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA);
|
||||
|
||||
//// Helpers
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
~wxClassInfo();
|
||||
|
||||
wxObject *CreateObject() const
|
||||
{ return m_objectConstructor ? (*m_objectConstructor)() : 0; }
|
||||
{ return m_objectConstructor ? (*m_objectConstructor)() : NULL; }
|
||||
bool IsDynamic() const { return (NULL != m_objectConstructor); }
|
||||
|
||||
const wxChar *GetClassName() const { return m_className; }
|
||||
|
@@ -598,7 +598,7 @@ public:
|
||||
|
||||
protected:
|
||||
// exits from the current thread - can be called only from this thread
|
||||
void Exit(ExitCode exitcode = 0);
|
||||
void Exit(ExitCode exitcode = NULL);
|
||||
|
||||
// entry point for the thread - called by Run() and executes in the context
|
||||
// of this thread.
|
||||
|
@@ -247,7 +247,7 @@ protected:
|
||||
virtual wxString GetResourceType() const { return "MOFILE"; }
|
||||
|
||||
// returns module to load resources from
|
||||
virtual WXHINSTANCE GetModule() const { return 0; }
|
||||
virtual WXHINSTANCE GetModule() const { return NULL; }
|
||||
};
|
||||
#endif // __WINDOWS__
|
||||
|
||||
|
@@ -840,7 +840,7 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
|
||||
size_t *outLen,
|
||||
const wxString& resourceName,
|
||||
const wxChar* resourceType = wxUserResourceStr,
|
||||
WXHINSTANCE module = 0);
|
||||
WXHINSTANCE module = NULL);
|
||||
|
||||
// This function allocates a new buffer and makes a copy of the resource
|
||||
// data, remember to delete[] the buffer. And avoid using it entirely if
|
||||
@@ -851,7 +851,7 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
|
||||
wxLoadUserResource(const wxString& resourceName,
|
||||
const wxChar* resourceType = wxUserResourceStr,
|
||||
int* pLen = NULL,
|
||||
WXHINSTANCE module = 0);
|
||||
WXHINSTANCE module = NULL);
|
||||
#endif // __WINDOWS__
|
||||
|
||||
#endif
|
||||
|
@@ -858,21 +858,20 @@ template<> struct wxStrtoxCharType<std::nullptr_t>
|
||||
template<typename T>
|
||||
inline double wxStrtod(const wxString& nptr, T endptr)
|
||||
{
|
||||
// Explicit comparison with 0 required when using T=nullptr with MSVS 2012.
|
||||
if (endptr != 0)
|
||||
if (!endptr)
|
||||
{
|
||||
// when we don't care about endptr, use the string representation that
|
||||
// doesn't require any conversion (it doesn't matter for this function
|
||||
// even if its UTF-8):
|
||||
wxStringCharType** p = NULL;
|
||||
return wxStrtod(nptr.wx_str(), p);
|
||||
}
|
||||
// note that it is important to use c_str() here and not mb_str() or
|
||||
// wc_str(), because we store the pointer into (possibly converted)
|
||||
// buffer in endptr and so it must be valid even when wxStrtod() returns
|
||||
typedef typename wxStrtoxCharType<T>::Type CharType;
|
||||
return wxStrtod((CharType)nptr.c_str(),
|
||||
wxStrtoxCharType<T>::AsPointer(endptr));
|
||||
}
|
||||
// when we don't care about endptr, use the string representation that
|
||||
// doesn't require any conversion (it doesn't matter for this function
|
||||
// even if its UTF-8):
|
||||
wxStringCharType** p = NULL;
|
||||
return wxStrtod(nptr.wx_str(), p);
|
||||
}
|
||||
template<typename T>
|
||||
inline double wxStrtod(const wxCStrData& nptr, T endptr)
|
||||
@@ -891,16 +890,16 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr)
|
||||
template<typename T> \
|
||||
inline rettype name(const wxString& nptr, T endptr, int base) \
|
||||
{ \
|
||||
if (endptr) \
|
||||
if (!endptr) \
|
||||
{ \
|
||||
wxStringCharType** p = NULL; \
|
||||
return name(nptr.wx_str(), p, base); \
|
||||
} \
|
||||
typedef typename wxStrtoxCharType<T>::Type CharType; \
|
||||
return name((CharType)nptr.c_str(), \
|
||||
wxStrtoxCharType<T>::AsPointer(endptr), \
|
||||
base); \
|
||||
} \
|
||||
wxStringCharType** p = NULL; \
|
||||
return name(nptr.wx_str(), p, base); \
|
||||
} \
|
||||
template<typename T> \
|
||||
inline rettype name(const wxCStrData& nptr, T endptr, int base) \
|
||||
{ return name(nptr.AsString(), endptr, base); }
|
||||
|
Reference in New Issue
Block a user