mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[c23,channels] replace NULL with nullptr
This commit is contained in:
@@ -59,7 +59,7 @@ static UINT echo_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
/* echo back what we have received. ECHO does not have any message IDs. */
|
||||
return callback->channel->Write(callback->channel, (ULONG)cbSize, pBuffer, NULL);
|
||||
return callback->channel->Write(callback->channel, (ULONG)cbSize, pBuffer, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,8 +76,9 @@ static UINT echo_on_close(IWTSVirtualChannelCallback* pChannelCallback)
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static const IWTSVirtualChannelCallback echo_callbacks = { echo_on_data_received, NULL, /* Open */
|
||||
echo_on_close, NULL };
|
||||
static const IWTSVirtualChannelCallback echo_callbacks = { echo_on_data_received,
|
||||
nullptr, /* Open */
|
||||
echo_on_close, nullptr };
|
||||
|
||||
/**
|
||||
* Function description
|
||||
@@ -88,5 +89,5 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE echo_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pE
|
||||
{
|
||||
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, ECHO_DVC_CHANNEL_NAME,
|
||||
sizeof(ECHO_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),
|
||||
&echo_callbacks, NULL, NULL);
|
||||
&echo_callbacks, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ typedef struct
|
||||
static UINT echo_server_open_channel(echo_server* echo)
|
||||
{
|
||||
DWORD Error = 0;
|
||||
HANDLE hEvent = NULL;
|
||||
HANDLE hEvent = nullptr;
|
||||
DWORD StartTick = 0;
|
||||
DWORD BytesReturned = 0;
|
||||
PULONG pSessionId = NULL;
|
||||
PULONG pSessionId = nullptr;
|
||||
|
||||
if (WTSQuerySessionInformationA(echo->context.vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
||||
(LPSTR*)&pSessionId, &BytesReturned) == FALSE)
|
||||
@@ -79,7 +79,7 @@ static UINT echo_server_open_channel(echo_server* echo)
|
||||
hEvent = WTSVirtualChannelManagerGetEventHandle(echo->context.vcm);
|
||||
StartTick = GetTickCount();
|
||||
|
||||
while (echo->echo_channel == NULL)
|
||||
while (echo->echo_channel == nullptr)
|
||||
{
|
||||
if (WaitForSingleObject(hEvent, 1000) == WAIT_FAILED)
|
||||
{
|
||||
@@ -122,12 +122,12 @@ static UINT echo_server_open_channel(echo_server* echo)
|
||||
|
||||
static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
{
|
||||
wStream* s = NULL;
|
||||
void* buffer = NULL;
|
||||
wStream* s = nullptr;
|
||||
void* buffer = nullptr;
|
||||
DWORD nCount = 0;
|
||||
HANDLE events[8];
|
||||
BOOL ready = FALSE;
|
||||
HANDLE ChannelEvent = NULL;
|
||||
HANDLE ChannelEvent = nullptr;
|
||||
DWORD BytesReturned = 0;
|
||||
echo_server* echo = (echo_server*)arg;
|
||||
UINT error = 0;
|
||||
@@ -147,9 +147,9 @@ static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
buffer = NULL;
|
||||
buffer = nullptr;
|
||||
BytesReturned = 0;
|
||||
ChannelEvent = NULL;
|
||||
ChannelEvent = nullptr;
|
||||
|
||||
if (WTSVirtualChannelQuery(echo->echo_channel, WTSVirtualEventHandle, &buffer,
|
||||
&BytesReturned) == TRUE)
|
||||
@@ -214,7 +214,7 @@ static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
}
|
||||
}
|
||||
|
||||
s = Stream_New(NULL, 4096);
|
||||
s = Stream_New(nullptr, 4096);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
break;
|
||||
|
||||
Stream_SetPosition(s, 0);
|
||||
if (!WTSVirtualChannelRead(echo->echo_channel, 0, NULL, 0, &BytesReturned))
|
||||
if (!WTSVirtualChannelRead(echo->echo_channel, 0, nullptr, 0, &BytesReturned))
|
||||
{
|
||||
WLog_ERR(TAG, "WTSVirtualChannelRead failed!");
|
||||
error = ERROR_INTERNAL_ERROR;
|
||||
@@ -275,7 +275,7 @@ static DWORD WINAPI echo_server_thread_func(LPVOID arg)
|
||||
|
||||
Stream_Free(s, TRUE);
|
||||
(void)WTSVirtualChannelClose(echo->echo_channel);
|
||||
echo->echo_channel = NULL;
|
||||
echo->echo_channel = nullptr;
|
||||
out:
|
||||
|
||||
if (error && echo->context.rdpcontext)
|
||||
@@ -295,19 +295,20 @@ static UINT echo_server_open(echo_server_context* context)
|
||||
{
|
||||
echo_server* echo = (echo_server*)context;
|
||||
|
||||
if (echo->thread == NULL)
|
||||
if (echo->thread == nullptr)
|
||||
{
|
||||
if (!(echo->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
||||
if (!(echo->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateEvent failed!");
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
if (!(echo->thread = CreateThread(NULL, 0, echo_server_thread_func, (void*)echo, 0, NULL)))
|
||||
if (!(echo->thread =
|
||||
CreateThread(nullptr, 0, echo_server_thread_func, (void*)echo, 0, nullptr)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateEvent failed!");
|
||||
(void)CloseHandle(echo->stopEvent);
|
||||
echo->stopEvent = NULL;
|
||||
echo->stopEvent = nullptr;
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -338,8 +339,8 @@ static UINT echo_server_close(echo_server_context* context)
|
||||
|
||||
(void)CloseHandle(echo->thread);
|
||||
(void)CloseHandle(echo->stopEvent);
|
||||
echo->thread = NULL;
|
||||
echo->stopEvent = NULL;
|
||||
echo->thread = nullptr;
|
||||
echo->stopEvent = nullptr;
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -356,12 +357,12 @@ static BOOL echo_server_request(echo_server_context* context, const BYTE* buffer
|
||||
echo_server* echo = (echo_server*)context;
|
||||
WINPR_ASSERT(echo);
|
||||
|
||||
return WTSVirtualChannelWrite(echo->echo_channel, cnv.pv, length, NULL);
|
||||
return WTSVirtualChannelWrite(echo->echo_channel, cnv.pv, length, nullptr);
|
||||
}
|
||||
|
||||
echo_server_context* echo_server_context_new(HANDLE vcm)
|
||||
{
|
||||
echo_server* echo = NULL;
|
||||
echo_server* echo = nullptr;
|
||||
echo = (echo_server*)calloc(1, sizeof(echo_server));
|
||||
|
||||
if (echo)
|
||||
|
||||
Reference in New Issue
Block a user