Replace zero-as-null with nullptr

This commit is contained in:
Paul Cornett 2023-12-10 09:35:15 -08:00
parent c3d1618cc8
commit 5ef4c1062a
16 changed files with 30 additions and 30 deletions

View file

@ -1248,7 +1248,7 @@ wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat)
extern wxString
wxGetInfoFromCFLocale(CFLocaleRef cfloc, wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
{
CFStringRef cfstr = 0;
CFStringRef cfstr = nullptr;
switch ( index )
{
case wxLOCALE_THOUSANDS_SEP:

View file

@ -203,11 +203,11 @@ hostent *deepCopyHostent(hostent *h,
/* leave space for pointer list */
char **p = h->h_addr_list, **q;
char **h_addr_list = (char **)(buffer + pos);
while(*(p++) != 0)
while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy addresses and fill new pointer list */
for (p = h->h_addr_list, q = h_addr_list; *p != 0; p++, q++)
for (p = h->h_addr_list, q = h_addr_list; *p != nullptr; p++, q++)
{
if (size < pos + len)
{
@ -218,7 +218,7 @@ hostent *deepCopyHostent(hostent *h,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len;
}
*++q = 0; /* null terminate the pointer list */
*++q = nullptr; /* null terminate the pointer list */
h->h_addr_list = h_addr_list; /* copy pointer to pointers */
/* ensure word alignment of pointers */
@ -229,11 +229,11 @@ hostent *deepCopyHostent(hostent *h,
/* leave space for pointer list */
p = h->h_aliases;
char **h_aliases = (char **)(buffer + pos);
while(*(p++) != 0)
while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy aliases and fill new pointer list */
for (p = h->h_aliases, q = h_aliases; *p != 0; p++, q++)
for (p = h->h_aliases, q = h_aliases; *p != nullptr; p++, q++)
{
len = strlen(*p);
if (size <= pos + len)
@ -246,7 +246,7 @@ hostent *deepCopyHostent(hostent *h,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len + 1;
}
*++q = 0; /* null terminate the pointer list */
*++q = nullptr; /* null terminate the pointer list */
h->h_aliases = h_aliases; /* copy pointer to pointers */
return h;
@ -358,11 +358,11 @@ servent *deepCopyServent(servent *s,
/* leave space for pointer list */
char **p = s->s_aliases, **q;
char **s_aliases = (char **)(buffer + pos);
while(*(p++) != 0)
while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy addresses and fill new pointer list */
for (p = s->s_aliases, q = s_aliases; *p != 0; p++, q++){
for (p = s->s_aliases, q = s_aliases; *p != nullptr; p++, q++){
len = strlen(*p);
if (size <= pos + len)
{
@ -373,7 +373,7 @@ servent *deepCopyServent(servent *s,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len + 1;
}
*++q = 0; /* null terminate the pointer list */
*++q = nullptr; /* null terminate the pointer list */
s->s_aliases = s_aliases; /* copy pointer to pointers */
return s;
}

View file

@ -2016,7 +2016,7 @@ bool wxZipInputStream::OpenDecompressor(bool raw /*=false*/)
}
}
m_crcAccumulator = crc32(0, Z_NULL, 0);
m_crcAccumulator = crc32(0, nullptr, 0);
m_lasterror = m_decomp ? m_decomp->GetLastError() : wxSTREAM_READ_ERROR;
return IsOk();
}
@ -2296,7 +2296,7 @@ bool wxZipOutputStream::DoCreate(wxZipEntry *entry, bool raw /*=false*/)
m_pending->SetOffset(m_headerOffset);
m_crcAccumulator = crc32(0, Z_NULL, 0);
m_crcAccumulator = crc32(0, nullptr, 0);
if (raw)
m_raw = true;

View file

@ -282,7 +282,7 @@ wxBitmap *wxBrush::GetStipple() const
WXHANDLE wxBrush::GetResourceHandle() const
{
wxCHECK_MSG( IsOk(), FALSE, wxT("invalid brush") );
wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") );
return (WXHANDLE)M_BRUSHDATA->GetHBRUSH();
}

View file

@ -129,7 +129,7 @@ void wxCrashReportImpl::Output(const wxChar *format, ...)
wxString s = wxString::FormatV(format, argptr);
wxCharBuffer buf(s.mb_str(wxConvUTF8));
::WriteFile(m_hFile, buf.data(), strlen(buf.data()), &cbWritten, 0);
::WriteFile(m_hFile, buf.data(), strlen(buf.data()), &cbWritten, nullptr);
va_end(argptr);
}

View file

@ -105,7 +105,7 @@ static wxString gs_errMsg;
// ----------------------------------------------------------------------------
#define DEFINE_SYM_FUNCTION(func, name) \
wxDbgHelpDLL::func ## _t wxDbgHelpDLL::func = 0
wxDbgHelpDLL::func ## _t wxDbgHelpDLL::func = nullptr
wxDO_FOR_ALL_SYM_FUNCS(DEFINE_SYM_FUNCTION);

View file

@ -815,7 +815,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP,
&rasDialParams,
0, // use callback for notifications
async ? (void *)wxRasDialFunc // cast needed for gcc 3.1
: 0, // no notifications, sync operation
: nullptr, // no notifications, sync operation
&ms_hRasConnection
);

View file

@ -113,7 +113,7 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor)
else
flags = ILC_COLOR32;
bool mask = (image.GetMask() != 0);
bool mask = image.GetMask() != nullptr;
// Curiously, even if the image doesn't have a mask,
// we still have to use ILC_MASK or the image won't show

View file

@ -62,7 +62,7 @@ wxFSWatcherImplMSW::~wxFSWatcherImplMSW()
{
// order the worker thread to finish & wait
m_workerThread.Finish();
if (m_workerThread.Wait() != 0)
if (m_workerThread.Wait())
{
wxLogError(_("Ungraceful worker thread termination"));
}
@ -210,7 +210,7 @@ wxThread::ExitCode wxIOCPThread::Entry()
while ( ReadEvents() );
wxLogTrace(wxTRACE_FSWATCHER, "[iocp] Ended IOCP thread");
return (ExitCode)0;
return nullptr;
}
// wait for events to occur, read them and send to interested parties

View file

@ -2593,7 +2593,7 @@ public:
protected:
void DoAcquireResource() override
{
HRESULT hr = GetContext()->CreateBitmapFromWicBitmap(m_srcBitmap, 0, &m_nativeResource);
HRESULT hr = GetContext()->CreateBitmapFromWicBitmap(m_srcBitmap, nullptr, &m_nativeResource);
wxCHECK_HRESULT_RET(hr);
}

View file

@ -236,14 +236,14 @@ public:
wxDL_VOIDMETHOD_DEFINE(SetMovieBox, (Movie m, Rect* r), (m,r))
wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale, (Movie m, long s), (m,s))
wxDL_METHOD_DEFINE(long, GetMovieDuration, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), nullptr)
wxDL_METHOD_DEFINE(TimeScale, GetMovieTimeScale, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(long, GetMovieTime, (Movie m, void* cruft), (m,cruft), 0)
wxDL_VOIDMETHOD_DEFINE(SetMovieTime, (Movie m, TimeRecord* tr), (m,tr) )
wxDL_METHOD_DEFINE(short, GetMovieVolume, (Movie m), (m), 0)
wxDL_VOIDMETHOD_DEFINE(SetMovieVolume, (Movie m, short sVolume), (m,sVolume) )
wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s))
wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0)
wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), nullptr)
wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci))
wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0)
@ -251,9 +251,9 @@ public:
wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) )
wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0)
wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), nullptr)
wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f))
wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0)
wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), nullptr)
wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0)
wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r))
wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g))

View file

@ -153,7 +153,7 @@ void wxStackFrame::OnGetParam()
(
::GetCurrentProcess(),
&imagehlpStackFrame,
0 // unused
nullptr // unused
) )
{
// for symbols from kernel DLL we might not have access to their

View file

@ -1340,7 +1340,7 @@ bool wxThreadModule::OnInit()
// main thread doesn't have associated wxThread object, so store 0 in the
// TLS instead
if ( !::TlsSetValue(gs_tlsThisThread, (LPVOID)0) )
if ( !::TlsSetValue(gs_tlsThisThread, nullptr) )
{
::TlsFree(gs_tlsThisThread);
gs_tlsThisThread = TLS_OUT_OF_INDEXES;

View file

@ -571,7 +571,7 @@ bool wxToolTip::AdjustMaxWidth()
// use TTM_SETMAXTIPWIDTH to make tooltip multiline using the
// extent of its first line as max value
HFONT hfont = (HFONT)
SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, 0);
SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, nullptr);
if ( !hfont )
{
@ -631,7 +631,7 @@ bool wxToolTip::AdjustMaxWidth()
// one would result in breaking the longer lines unnecessarily as
// all our tooltips share the same maximal width
if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(),
TTM_GETMAXTIPWIDTH, 0) )
TTM_GETMAXTIPWIDTH, nullptr) )
{
SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
wxUIntToPtr(maxWidth));

View file

@ -4503,7 +4503,7 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam)
(
(HDROP)hFilesInfo,
(UINT)-1,
(LPTSTR)0,
nullptr,
(UINT)0
);

View file

@ -222,7 +222,7 @@ static void realize_callback(GtkWidget* widget, wxGStreamerMediaBackend* be)
#endif // wxGTK
wxGStreamerMediaBackend::wxGStreamerMediaBackend()
: m_player(0), m_video_renderer(0), m_videoSize(0, 0), m_last_state(wxMEDIASTATE_STOPPED), m_loaded(false)
: m_player(nullptr), m_video_renderer(nullptr), m_videoSize(0, 0), m_last_state(wxMEDIASTATE_STOPPED), m_loaded(false)
{
}