Skip to content

Commit

Permalink
Avoid using NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Apr 20, 2023
1 parent b217979 commit 4815119
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ HRESULT STDMETHODCALLTYPE Buffer::QueryInterface(REFIID riid, void** ppvObject)
DEBUG(PREFIX "QueryInterface (%p)->(%s, %p)\n", voidp{this}, GuidPrinter{riid}.c_str(),
voidp{ppvObject});

*ppvObject = NULL;
*ppvObject = nullptr;
if(riid == IID_IUnknown)
{
mUnknownIface.AddRef();
Expand Down Expand Up @@ -880,9 +880,9 @@ HRESULT STDMETHODCALLTYPE Buffer::Lock(DWORD offset, DWORD bytes, void **audioPt
return DSERR_INVALIDPARAM;
}

*audioPtr1 = NULL;
*audioPtr1 = nullptr;
*audioBytes1 = 0;
if(audioPtr2) *audioPtr2 = NULL;
if(audioPtr2) *audioPtr2 = nullptr;
if(audioBytes2) *audioBytes2 = 0;

if((flags&DSBLOCK_FROMWRITECURSOR))
Expand Down Expand Up @@ -1830,7 +1830,7 @@ HRESULT STDMETHODCALLTYPE Buffer::Prop::Get(REFGUID guidPropSet, ULONG dwPropID,

if(cbPropData > 0 && !pPropData)
{
WARN(PREFIX "Get pPropData is NULL with cbPropData > 0\n");
WARN(PREFIX "Get pPropData is null with cbPropData > 0\n");
return E_POINTER;
}

Expand Down Expand Up @@ -1924,7 +1924,7 @@ HRESULT STDMETHODCALLTYPE Buffer::Prop::Set(REFGUID guidPropSet, ULONG dwPropID,

if(cbPropData > 0 && !pPropData)
{
WARN(PREFIX "Set pPropData is NULL with cbPropData > 0\n");
WARN(PREFIX "Set pPropData is null with cbPropData > 0\n");
return E_POINTER;
}

Expand Down
2 changes: 1 addition & 1 deletion src/capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ HRESULT STDMETHODCALLTYPE DSCapture::QueryInterface(REFIID riid, void **ppvObjec
DEBUG(PREFIX "QueryInterface (%p)->(%s, %p)\n", voidp{this}, GuidPrinter{riid}.c_str(),
voidp{ppvObject});

*ppvObject = NULL;
*ppvObject = nullptr;
if(riid == IID_IUnknown)
{
mUnknownIface.AddRef();
Expand Down
8 changes: 4 additions & 4 deletions src/dsoal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ HRESULT WINAPI DSOAL_DirectSoundCreate(const GUID *deviceId, IDirectSound **ds,
WARN("DirectSoundCreate invalid parameter: ppDS == NULL\n");
return DSERR_INVALIDPARAM;
}
*ds = NULL;
*ds = nullptr;

if(outer)
{
Expand Down Expand Up @@ -396,7 +396,7 @@ HRESULT WINAPI DSOAL_DirectSoundCreate8(const GUID *deviceId, IDirectSound8 **ds
WARN("DirectSoundCreate8 invalid parameter: ppDS == NULL\n");
return DSERR_INVALIDPARAM;
}
*ds = NULL;
*ds = nullptr;

if(outer)
{
Expand Down Expand Up @@ -433,7 +433,7 @@ HRESULT WINAPI DSOAL_DirectSoundCaptureCreate(const GUID *deviceId, IDirectSound
WARN("DirectSoundCaptureCreate invalid parameter: ppDS == NULL\n");
return DSERR_INVALIDPARAM;
}
*ds = NULL;
*ds = nullptr;

if(outer)
{
Expand Down Expand Up @@ -470,7 +470,7 @@ HRESULT WINAPI DSOAL_DirectSoundCaptureCreate8(const GUID *deviceId, IDirectSoun
WARN("DirectSoundCaptureCreate8 invalid parameter: ppDS == NULL\n");
return DSERR_INVALIDPARAM;
}
*ds = NULL;
*ds = nullptr;

if(outer)
{
Expand Down
4 changes: 2 additions & 2 deletions src/dsoundoal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ds::expected<std::unique_ptr<SharedDevice>,HRESULT> CreateDeviceShare(const GUID
ERR("CreateDeviceShare Failed to convert GUID to string\n");
return ds::unexpected(hr);
}
WideCharToMultiByte(CP_UTF8, 0, guid_str, -1, drv_name, sizeof(drv_name), NULL, NULL);
WideCharToMultiByte(CP_UTF8, 0, guid_str, -1, drv_name, sizeof(drv_name), nullptr, nullptr);
drv_name[sizeof(drv_name)-1] = 0;
CoTaskMemFree(guid_str);
guid_str = nullptr;
Expand Down Expand Up @@ -459,7 +459,7 @@ HRESULT STDMETHODCALLTYPE DSound8OAL::QueryInterface(REFIID riid, void** ppvObje
{
DEBUG(PREFIX "(%p)->(%s, %p)\n", voidp{this}, GuidPrinter{riid}.c_str(), voidp{ppvObject});

*ppvObject = NULL;
*ppvObject = nullptr;
if(riid == IID_IUnknown)
{
mUnknownIface.AddRef();
Expand Down
2 changes: 1 addition & 1 deletion src/primarybuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ HRESULT STDMETHODCALLTYPE PrimaryBuffer::QueryInterface(REFIID riid, void** ppvO
DEBUG(PREFIX "QueryInterface (%p)->(%s, %p)\n", voidp{this}, GuidPrinter{riid}.c_str(),
voidp{ppvObject});

*ppvObject = NULL;
*ppvObject = nullptr;
if(riid == IID_IUnknown)
{
AddRef();
Expand Down

0 comments on commit 4815119

Please sign in to comment.