[c23,server] replace NULL with nullptr

This commit is contained in:
Armin Novak
2026-02-26 14:34:11 +01:00
parent 4ebe580c57
commit e5816d65ce
58 changed files with 919 additions and 906 deletions

View File

@@ -30,7 +30,7 @@
#define TAG SERVER_TAG("shadow.mac")
static macShadowSubsystem* g_Subsystem = NULL;
static macShadowSubsystem* g_Subsystem = nullptr;
static BOOL mac_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem,
rdpShadowClient* client, UINT32 flags)
@@ -394,7 +394,7 @@ static void (^mac_capture_stream_handler)(
y = extents->top;
width = extents->right - extents->left;
height = extents->bottom - extents->top;
IOSurfaceLock(frameSurface, kIOSurfaceLockReadOnly, NULL);
IOSurfaceLock(frameSurface, kIOSurfaceLockReadOnly, nullptr);
pSrcData = (BYTE*)IOSurfaceGetBaseAddress(frameSurface);
nSrcStep = (int)IOSurfaceGetBytesPerRow(frameSurface);
@@ -407,11 +407,11 @@ static void (^mac_capture_stream_handler)(
{
freerdp_image_copy_no_overlap(surface->data, surface->format, surface->scanline, x, y,
width, height, pSrcData, PIXEL_FORMAT_BGRX32, nSrcStep, x,
y, NULL, FREERDP_FLIP_NONE);
y, nullptr, FREERDP_FLIP_NONE);
}
LeaveCriticalSection(&(surface->lock));
IOSurfaceUnlock(frameSurface, kIOSurfaceLockReadOnly, NULL);
IOSurfaceUnlock(frameSurface, kIOSurfaceLockReadOnly, nullptr);
ArrayList_Lock(server->clients);
count = ArrayList_Count(server->clients);
shadow_subsystem_frame_update(&subsystem->common);
@@ -470,11 +470,11 @@ static int mac_shadow_capture_init(macShadowSubsystem* subsystem)
CFDictionaryRef opts;
CGDirectDisplayID displayId;
displayId = CGMainDisplayID();
subsystem->captureQueue = dispatch_queue_create("mac.shadow.capture", NULL);
subsystem->captureQueue = dispatch_queue_create("mac.shadow.capture", nullptr);
keys[0] = (void*)kCGDisplayStreamShowCursor;
values[0] = (void*)kCFBooleanFalse;
opts = CFDictionaryCreate(kCFAllocatorDefault, (const void**)keys, (const void**)values, 1,
NULL, NULL);
nullptr, nullptr);
subsystem->stream = CGDisplayStreamCreateWithDispatchQueue(
displayId, subsystem->pixelWidth, subsystem->pixelHeight, 'BGRA', opts,
subsystem->captureQueue, mac_capture_stream_handler);
@@ -601,7 +601,7 @@ static int mac_shadow_subsystem_uninit(rdpShadowSubsystem* rdpsubsystem)
if (subsystem->lastUpdate)
{
CFRelease(subsystem->lastUpdate);
subsystem->lastUpdate = NULL;
subsystem->lastUpdate = nullptr;
}
return 1;
@@ -617,7 +617,8 @@ static int mac_shadow_subsystem_start(rdpShadowSubsystem* rdpsubsystem)
mac_shadow_capture_start(subsystem);
if (!(thread = CreateThread(NULL, 0, mac_shadow_subsystem_thread, (void*)subsystem, 0, NULL)))
if (!(thread =
CreateThread(nullptr, 0, mac_shadow_subsystem_thread, (void*)subsystem, 0, nullptr)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;
@@ -648,7 +649,7 @@ static rdpShadowSubsystem* mac_shadow_subsystem_new(void)
macShadowSubsystem* subsystem = calloc(1, sizeof(macShadowSubsystem));
if (!subsystem)
return NULL;
return nullptr;
subsystem->common.SynchronizeEvent = mac_shadow_input_synchronize_event;
subsystem->common.KeyboardEvent = mac_shadow_input_keyboard_event;

View File

@@ -161,7 +161,7 @@ static rdpShadowSubsystem* sample_shadow_subsystem_new(void)
(sampleShadowSubsystem*)calloc(1, sizeof(sampleShadowSubsystem));
if (!subsystem)
return NULL;
return nullptr;
subsystem->base.SynchronizeEvent = sample_shadow_input_synchronize_event;
subsystem->base.KeyboardEvent = sample_shadow_input_keyboard_event;

View File

@@ -42,7 +42,7 @@ static D3D_FEATURE_LEVEL FeatureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE
static UINT NumFeatureLevels = ARRAYSIZE(FeatureLevels);
static HMODULE d3d11_module = NULL;
static HMODULE d3d11_module = nullptr;
typedef HRESULT(WINAPI* fnD3D11CreateDevice)(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType,
HMODULE Software, UINT Flags,
@@ -52,7 +52,7 @@ typedef HRESULT(WINAPI* fnD3D11CreateDevice)(IDXGIAdapter* pAdapter, D3D_DRIVER_
D3D_FEATURE_LEVEL* pFeatureLevel,
ID3D11DeviceContext** ppImmediateContext);
static fnD3D11CreateDevice pfnD3D11CreateDevice = NULL;
static fnD3D11CreateDevice pfnD3D11CreateDevice = nullptr;
#undef DEFINE_GUID
#define INITGUID
@@ -300,10 +300,10 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
DXGI_OUTPUT_DESC outputDesc = WINPR_C_ARRAY_INIT;
DXGI_OUTPUT_DESC* pOutputDesc;
D3D11_TEXTURE2D_DESC textureDesc;
IDXGIDevice* dxgiDevice = NULL;
IDXGIAdapter* dxgiAdapter = NULL;
IDXGIOutput* dxgiOutput = NULL;
IDXGIOutput1* dxgiOutput1 = NULL;
IDXGIDevice* dxgiDevice = nullptr;
IDXGIAdapter* dxgiAdapter = nullptr;
IDXGIOutput* dxgiOutput = nullptr;
IDXGIOutput1* dxgiOutput1 = nullptr;
hr = subsystem->dxgiDevice->lpVtbl->QueryInterface(subsystem->dxgiDevice, &IID_IDXGIDevice,
(void**)&dxgiDevice);
@@ -320,7 +320,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (dxgiDevice)
{
dxgiDevice->lpVtbl->Release(dxgiDevice);
dxgiDevice = NULL;
dxgiDevice = nullptr;
}
if (FAILED(hr))
@@ -330,7 +330,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
return -1;
}
pOutput = NULL;
pOutput = nullptr;
while (dxgiAdapter->lpVtbl->EnumOutputs(dxgiAdapter, i, &pOutput) != DXGI_ERROR_NOT_FOUND)
{
@@ -358,7 +358,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (dxgiAdapter)
{
dxgiAdapter->lpVtbl->Release(dxgiAdapter);
dxgiAdapter = NULL;
dxgiAdapter = nullptr;
}
if (FAILED(hr))
@@ -373,7 +373,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (dxgiOutput)
{
dxgiOutput->lpVtbl->Release(dxgiOutput);
dxgiOutput = NULL;
dxgiOutput = nullptr;
}
if (FAILED(hr))
@@ -389,7 +389,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (dxgiOutput1)
{
dxgiOutput1->lpVtbl->Release(dxgiOutput1);
dxgiOutput1 = NULL;
dxgiOutput1 = nullptr;
}
if (FAILED(hr))
@@ -411,8 +411,8 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
textureDesc.MiscFlags = 0;
hr = subsystem->dxgiDevice->lpVtbl->CreateTexture2D(subsystem->dxgiDevice, &textureDesc, NULL,
&(subsystem->dxgiStage));
hr = subsystem->dxgiDevice->lpVtbl->CreateTexture2D(subsystem->dxgiDevice, &textureDesc,
nullptr, &(subsystem->dxgiStage));
if (FAILED(hr))
{
@@ -430,10 +430,10 @@ int win_shadow_dxgi_init(winShadowSubsystem* subsystem)
HRESULT hr;
int status;
UINT DriverTypeIndex;
IDXGIDevice* DxgiDevice = NULL;
IDXGIAdapter* DxgiAdapter = NULL;
IDXGIOutput* DxgiOutput = NULL;
IDXGIOutput1* DxgiOutput1 = NULL;
IDXGIDevice* DxgiDevice = nullptr;
IDXGIAdapter* DxgiAdapter = nullptr;
IDXGIOutput* DxgiOutput = nullptr;
IDXGIOutput1* DxgiOutput1 = nullptr;
win_shadow_d3d11_module_init();
@@ -442,7 +442,7 @@ int win_shadow_dxgi_init(winShadowSubsystem* subsystem)
for (DriverTypeIndex = 0; DriverTypeIndex < NumDriverTypes; ++DriverTypeIndex)
{
hr = pfnD3D11CreateDevice(NULL, DriverTypes[DriverTypeIndex], NULL, 0, FeatureLevels,
hr = pfnD3D11CreateDevice(nullptr, DriverTypes[DriverTypeIndex], nullptr, 0, FeatureLevels,
NumFeatureLevels, D3D11_SDK_VERSION, &(subsystem->dxgiDevice),
&(subsystem->featureLevel), &(subsystem->dxgiDeviceContext));
@@ -466,31 +466,31 @@ int win_shadow_dxgi_uninit(winShadowSubsystem* subsystem)
if (subsystem->dxgiStage)
{
subsystem->dxgiStage->lpVtbl->Release(subsystem->dxgiStage);
subsystem->dxgiStage = NULL;
subsystem->dxgiStage = nullptr;
}
if (subsystem->dxgiDesktopImage)
{
subsystem->dxgiDesktopImage->lpVtbl->Release(subsystem->dxgiDesktopImage);
subsystem->dxgiDesktopImage = NULL;
subsystem->dxgiDesktopImage = nullptr;
}
if (subsystem->dxgiOutputDuplication)
{
subsystem->dxgiOutputDuplication->lpVtbl->Release(subsystem->dxgiOutputDuplication);
subsystem->dxgiOutputDuplication = NULL;
subsystem->dxgiOutputDuplication = nullptr;
}
if (subsystem->dxgiDeviceContext)
{
subsystem->dxgiDeviceContext->lpVtbl->Release(subsystem->dxgiDeviceContext);
subsystem->dxgiDeviceContext = NULL;
subsystem->dxgiDeviceContext = nullptr;
}
if (subsystem->dxgiDevice)
{
subsystem->dxgiDevice->lpVtbl->Release(subsystem->dxgiDevice);
subsystem->dxgiDevice = NULL;
subsystem->dxgiDevice = nullptr;
}
return 1;
@@ -568,7 +568,7 @@ int win_shadow_dxgi_release_frame_data(winShadowSubsystem* subsystem)
}
subsystem->dxgiSurface->lpVtbl->Release(subsystem->dxgiSurface);
subsystem->dxgiSurface = NULL;
subsystem->dxgiSurface = nullptr;
}
if (subsystem->dxgiOutputDuplication)
@@ -593,7 +593,7 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
HRESULT hr = 0;
UINT timeout = 15;
UINT DataBufferSize = 0;
BYTE* DataBuffer = NULL;
BYTE* DataBuffer = nullptr;
if (subsystem->dxgiFrameAcquired)
{
@@ -603,7 +603,7 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
if (subsystem->dxgiDesktopImage)
{
subsystem->dxgiDesktopImage->lpVtbl->Release(subsystem->dxgiDesktopImage);
subsystem->dxgiDesktopImage = NULL;
subsystem->dxgiDesktopImage = nullptr;
}
hr = subsystem->dxgiOutputDuplication->lpVtbl->AcquireNextFrame(
@@ -631,13 +631,13 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
if (subsystem->dxgiDesktopImage)
{
subsystem->dxgiDesktopImage->lpVtbl->Release(subsystem->dxgiDesktopImage);
subsystem->dxgiDesktopImage = NULL;
subsystem->dxgiDesktopImage = nullptr;
}
if (subsystem->dxgiOutputDuplication)
{
subsystem->dxgiOutputDuplication->lpVtbl->Release(subsystem->dxgiOutputDuplication);
subsystem->dxgiOutputDuplication = NULL;
subsystem->dxgiOutputDuplication = nullptr;
}
status = win_shadow_dxgi_init_duplication(subsystem);
@@ -668,7 +668,7 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
if (subsystem->dxgiResource)
{
subsystem->dxgiResource->lpVtbl->Release(subsystem->dxgiResource);
subsystem->dxgiResource = NULL;
subsystem->dxgiResource = nullptr;
}
if (FAILED(hr))

View File

@@ -249,7 +249,7 @@ static int shw_freerdp_client_start(rdpContext* context)
freerdp* instance = context->instance;
shw = (shwContext*)context;
if (!(shw->common.thread = CreateThread(NULL, 0, shw_client_thread, instance, 0, NULL)))
if (!(shw->common.thread = CreateThread(nullptr, 0, shw_client_thread, instance, 0, nullptr)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;
@@ -276,7 +276,7 @@ static BOOL shw_freerdp_client_new(freerdp* instance, rdpContext* context)
shw = (shwContext*)instance->context;
WINPR_ASSERT(shw);
if (!(shw->StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(shw->StopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
return FALSE;
instance->LoadChannels = freerdp_client_load_channels;
@@ -374,7 +374,7 @@ int shw_RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
{
pEntryPoints->Version = 1;
pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1);
pEntryPoints->settings = NULL;
pEntryPoints->settings = nullptr;
pEntryPoints->ContextSize = sizeof(shwContext);
pEntryPoints->GlobalInit = shw_freerdp_client_global_init;
pEntryPoints->GlobalUninit = shw_freerdp_client_global_uninit;
@@ -394,10 +394,10 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem)
clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;
shw_RdpClientEntry(&clientEntryPoints);
if (!(subsystem->RdpUpdateEnterEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(subsystem->RdpUpdateEnterEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
goto fail_enter_event;
if (!(subsystem->RdpUpdateLeaveEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(subsystem->RdpUpdateLeaveEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
goto fail_leave_event;
if (!(context = freerdp_client_context_new(&clientEntryPoints)))

View File

@@ -247,7 +247,7 @@ static int win_shadow_surface_copy(winShadowSubsystem* subsystem)
int status = 1;
int nDstStep = 0;
DWORD DstFormat;
BYTE* pDstData = NULL;
BYTE* pDstData = nullptr;
rdpShadowServer* server;
rdpShadowSurface* surface;
RECTANGLE_16 surfaceRect;
@@ -315,7 +315,7 @@ static int win_shadow_surface_copy(winShadowSubsystem* subsystem)
return status;
if (!freerdp_image_copy_no_overlap(surface->data, surface->format, surface->scanline, x, y,
width, height, pDstData, DstFormat, nDstStep, x, y, NULL,
width, height, pDstData, DstFormat, nDstStep, x, y, nullptr,
FREERDP_FLIP_NONE))
return ERROR_INTERNAL_ERROR;
@@ -430,9 +430,9 @@ static UINT32 win_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors
displayDevice.cb = sizeof(DISPLAY_DEVICE);
if (EnumDisplayDevices(NULL, iDevNum, &displayDevice, 0))
if (EnumDisplayDevices(nullptr, iDevNum, &displayDevice, 0))
{
hdc = CreateDC(displayDevice.DeviceName, NULL, NULL, NULL);
hdc = CreateDC(displayDevice.DeviceName, nullptr, nullptr, nullptr);
desktopWidth = GetDeviceCaps(hdc, HORZRES);
desktopHeight = GetDeviceCaps(hdc, VERTRES);
index = 0;
@@ -493,7 +493,8 @@ static int win_shadow_subsystem_start(rdpShadowSubsystem* arg)
if (!subsystem)
return -1;
if (!(thread = CreateThread(NULL, 0, win_shadow_subsystem_thread, (void*)subsystem, 0, NULL)))
if (!(thread =
CreateThread(nullptr, 0, win_shadow_subsystem_thread, (void*)subsystem, 0, nullptr)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;
@@ -529,7 +530,7 @@ static rdpShadowSubsystem* win_shadow_subsystem_new(void)
subsystem = (winShadowSubsystem*)calloc(1, sizeof(winShadowSubsystem));
if (!subsystem)
return NULL;
return nullptr;
subsystem->base.SynchronizeEvent = win_shadow_input_synchronize_event;
subsystem->base.KeyboardEvent = win_shadow_input_keyboard_event;

View File

@@ -186,7 +186,7 @@ Shadow_IRDPSessionEvents_QueryInterface(__RPC__in _IRDPSessionEvents* This,
/* [annotation][iid_is][out] */
_COM_Outptr_ void** ppvObject)
{
*ppvObject = NULL;
*ppvObject = nullptr;
if (IsEqualIID(riid, &DIID__IRDPSessionEvents) || IsEqualIID(riid, &IID_IDispatch) ||
IsEqualIID(riid, &IID_IUnknown))
@@ -278,7 +278,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(_IRDPSessionEve
IDispatch* pDispatch;
IRDPSRAPIAttendee* pAttendee;
vr.vt = VT_DISPATCH;
vr.pdispVal = NULL;
vr.pdispVal = nullptr;
hr = DispGetParam(pDispParams, 0, VT_DISPATCH, &vr, &uArgErr);
if (FAILED(hr))
@@ -341,7 +341,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(_IRDPSessionEve
IDispatch* pDispatch;
IRDPSRAPIAttendee* pAttendee;
vr.vt = VT_INT;
vr.pdispVal = NULL;
vr.pdispVal = nullptr;
hr = DispGetParam(pDispParams, 1, VT_INT, &vr, &uArgErr);
if (FAILED(hr))
@@ -353,7 +353,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(_IRDPSessionEve
level = vr.intVal;
vr.vt = VT_DISPATCH;
vr.pdispVal = NULL;
vr.pdispVal = nullptr;
hr = DispGetParam(pDispParams, 0, VT_DISPATCH, &vr, &uArgErr);
if (FAILED(hr))
@@ -479,7 +479,7 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
HMODULE hModule;
HINSTANCE hInstance;
WNDCLASSEX wndClassEx = WINPR_C_ARRAY_INIT;
hModule = GetModuleHandle(NULL);
hModule = GetModuleHandle(nullptr);
wndClassEx.cbSize = sizeof(WNDCLASSEX);
wndClassEx.style = 0;
@@ -487,12 +487,12 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
wndClassEx.cbClsExtra = 0;
wndClassEx.cbWndExtra = 0;
wndClassEx.hInstance = hModule;
wndClassEx.hIcon = NULL;
wndClassEx.hCursor = NULL;
wndClassEx.hbrBackground = NULL;
wndClassEx.hIcon = nullptr;
wndClassEx.hCursor = nullptr;
wndClassEx.hbrBackground = nullptr;
wndClassEx.lpszMenuName = _T("ShadowWndMenu");
wndClassEx.lpszClassName = _T("ShadowWndClass");
wndClassEx.hIconSm = NULL;
wndClassEx.hIconSm = nullptr;
if (!RegisterClassEx(&wndClassEx))
{
@@ -502,7 +502,7 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
hInstance = wndClassEx.hInstance;
subsystem->hWnd = CreateWindowEx(0, wndClassEx.lpszClassName, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0,
hInstance, NULL);
hInstance, nullptr);
if (!subsystem->hWnd)
{
@@ -521,17 +521,17 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
long top = 0;
long right = 0;
long bottom = 0;
BSTR bstrAuthString = NULL;
BSTR bstrGroupName = NULL;
BSTR bstrPassword = NULL;
BSTR bstrPropertyName = NULL;
BSTR bstrAuthString = nullptr;
BSTR bstrGroupName = nullptr;
BSTR bstrPassword = nullptr;
BSTR bstrPropertyName = nullptr;
VARIANT varPropertyValue;
rdpAssistanceFile* file = NULL;
IConnectionPoint* pCP = NULL;
IConnectionPointContainer* pCPC = NULL;
rdpAssistanceFile* file = nullptr;
IConnectionPoint* pCP = nullptr;
IConnectionPointContainer* pCPC = nullptr;
win_shadow_wds_wnd_init(subsystem);
HRESULT hr = OleInitialize(NULL);
HRESULT hr = OleInitialize(nullptr);
if (FAILED(hr))
{
@@ -539,7 +539,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
return -1;
}
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (FAILED(hr))
{
@@ -547,7 +547,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
return -1;
}
hr = CoCreateInstance(&CLSID_RDPSession, NULL, CLSCTX_ALL, &IID_IRDPSRAPISharingSession,
hr = CoCreateInstance(&CLSID_RDPSession, nullptr, CLSCTX_ALL, &IID_IRDPSRAPISharingSession,
(void**)&(subsystem->pSharingSession));
if (FAILED(hr))
@@ -743,7 +743,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
return -1;
}
ConnectionString2 = ConvertWCharToUtf8Alloc(bstrConnectionString, NULL);
ConnectionString2 = ConvertWCharToUtf8Alloc(bstrConnectionString, nullptr);
SysFreeString(bstrConnectionString);
status2 = freerdp_assistance_set_connection_string2(file, ConnectionString2, "Shadow123!");
free(ConnectionString2);
@@ -794,61 +794,61 @@ int win_shadow_wds_uninit(winShadowSubsystem* subsystem)
{
subsystem->pSharingSession->lpVtbl->Close(subsystem->pSharingSession);
subsystem->pSharingSession->lpVtbl->Release(subsystem->pSharingSession);
subsystem->pSharingSession = NULL;
subsystem->pSharingSession = nullptr;
}
if (subsystem->pVirtualChannelMgr)
{
subsystem->pVirtualChannelMgr->lpVtbl->Release(subsystem->pVirtualChannelMgr);
subsystem->pVirtualChannelMgr = NULL;
subsystem->pVirtualChannelMgr = nullptr;
}
if (subsystem->pApplicationFilter)
{
subsystem->pApplicationFilter->lpVtbl->Release(subsystem->pApplicationFilter);
subsystem->pApplicationFilter = NULL;
subsystem->pApplicationFilter = nullptr;
}
if (subsystem->pAttendeeMgr)
{
subsystem->pAttendeeMgr->lpVtbl->Release(subsystem->pAttendeeMgr);
subsystem->pAttendeeMgr = NULL;
subsystem->pAttendeeMgr = nullptr;
}
if (subsystem->pSessionProperties)
{
subsystem->pSessionProperties->lpVtbl->Release(subsystem->pSessionProperties);
subsystem->pSessionProperties = NULL;
subsystem->pSessionProperties = nullptr;
}
if (subsystem->pInvitationMgr)
{
subsystem->pInvitationMgr->lpVtbl->Release(subsystem->pInvitationMgr);
subsystem->pInvitationMgr = NULL;
subsystem->pInvitationMgr = nullptr;
}
if (subsystem->pInvitation)
{
subsystem->pInvitation->lpVtbl->Release(subsystem->pInvitation);
subsystem->pInvitation = NULL;
subsystem->pInvitation = nullptr;
}
if (subsystem->pAssistanceFile)
{
freerdp_assistance_file_free(subsystem->pAssistanceFile);
subsystem->pAssistanceFile = NULL;
subsystem->pAssistanceFile = nullptr;
}
if (subsystem->hWnd)
{
DestroyWindow(subsystem->hWnd);
subsystem->hWnd = NULL;
subsystem->hWnd = nullptr;
}
if (subsystem->shw)
{
win_shadow_rdp_uninit(subsystem);
subsystem->shw = NULL;
subsystem->shw = nullptr;
}
return 1;

View File

@@ -76,8 +76,8 @@ static int x11_shadow_pam_conv(int num_msg, const struct pam_message** msg,
struct pam_response** resp, void* appdata_ptr)
{
int pam_status = PAM_CONV_ERR;
SHADOW_PAM_AUTH_DATA* appdata = NULL;
struct pam_response* response = NULL;
SHADOW_PAM_AUTH_DATA* appdata = nullptr;
struct pam_response* response = nullptr;
WINPR_ASSERT(num_msg >= 0);
appdata = (SHADOW_PAM_AUTH_DATA*)appdata_ptr;
WINPR_ASSERT(appdata);
@@ -128,7 +128,7 @@ out_fail:
memset(response, 0, sizeof(struct pam_response) * (size_t)num_msg);
free(response);
*resp = NULL;
*resp = nullptr;
return pam_status;
}
@@ -148,7 +148,7 @@ static BOOL x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
{
info->service_name = _strdup(hint);
return info->service_name != NULL;
return info->service_name != nullptr;
}
}
WLog_WARN(TAG, "Could not determine PAM service name");
@@ -172,7 +172,7 @@ static int x11_shadow_pam_authenticate(rdpShadowSubsystem* subsystem, rdpShadowC
info.appdata.password = password;
info.pamc.conv = &x11_shadow_pam_conv;
info.pamc.appdata_ptr = &info.appdata;
pam_status = pam_start(info.service_name, 0, &info.pamc, &info.handle);
pam_status = pam_start(info.service_name, nullptr, &info.pamc, &info.handle);
if (pam_status != PAM_SUCCESS)
{
@@ -278,8 +278,8 @@ static BOOL x11_shadow_input_mouse_event(rdpShadowSubsystem* subsystem, rdpShado
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
unsigned int button = 0;
BOOL down = FALSE;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
rdpShadowServer* server = nullptr;
rdpShadowSurface* surface = nullptr;
if (!subsystem || !client)
return FALSE;
@@ -417,8 +417,8 @@ static BOOL x11_shadow_input_extended_mouse_event(rdpShadowSubsystem* subsystem,
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
UINT button = 0;
BOOL down = FALSE;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
rdpShadowServer* server = nullptr;
rdpShadowSurface* surface = nullptr;
if (!subsystem || !client)
return FALSE;
@@ -485,7 +485,7 @@ WINPR_ATTR_NODISCARD
static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
{
UINT32 msgId = SHADOW_MSG_OUT_POINTER_POSITION_UPDATE_ID;
rdpShadowServer* server = NULL;
rdpShadowServer* server = nullptr;
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE templateMsg = WINPR_C_ARRAY_INIT;
int count = 0;
@@ -500,7 +500,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
for (size_t index = 0; index < ArrayList_Count(server->clients); index++)
{
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE* msg = NULL;
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE* msg = nullptr;
rdpShadowClient* client = (rdpShadowClient*)ArrayList_GetItem(server->clients, index);
/* Skip the client which send us the latest mouse event */
@@ -517,7 +517,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
memcpy(msg, &templateMsg, sizeof(templateMsg));
if (shadow_client_post_msg(client, NULL, msgId, (SHADOW_MSG_OUT*)msg, NULL))
if (shadow_client_post_msg(client, nullptr, msgId, (SHADOW_MSG_OUT*)msg, nullptr))
count++;
}
@@ -548,8 +548,8 @@ static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
}
msg->common.Free = x11_shadow_message_free;
const int count = shadow_client_boardcast_msg(subsystem->common.server, NULL, msgId,
(SHADOW_MSG_OUT*)msg, NULL);
const int count = shadow_client_boardcast_msg(subsystem->common.server, nullptr, msgId,
(SHADOW_MSG_OUT*)msg, nullptr);
if (count < 0)
return -1;
return 1;
@@ -561,16 +561,16 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
int x = 0;
int y = 0;
int n = 0;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
rdpShadowServer* server = nullptr;
rdpShadowSurface* surface = nullptr;
server = subsystem->common.server;
surface = server->surface;
if (getImage)
{
#ifdef WITH_XFIXES
UINT32* pDstPixel = NULL;
XFixesCursorImage* ci = NULL;
UINT32* pDstPixel = nullptr;
XFixesCursorImage* ci = nullptr;
XLockDisplay(subsystem->display);
ci = XFixesGetCursorImage(subsystem->display);
XUnlockDisplay(subsystem->display);
@@ -904,7 +904,7 @@ static BOOL x11_shadow_surface_update_contents(rdpShadowSurface* surface, UINT32
WINPR_ASSERTING_INT_CAST(uint32_t, y), WINPR_ASSERTING_INT_CAST(uint32_t, width),
WINPR_ASSERTING_INT_CAST(uint32_t, height), (BYTE*)image->data, format,
WINPR_ASSERTING_INT_CAST(uint32_t, image->bytes_per_line),
WINPR_ASSERTING_INT_CAST(UINT32, x), WINPR_ASSERTING_INT_CAST(UINT32, y), NULL,
WINPR_ASSERTING_INT_CAST(UINT32, x), WINPR_ASSERTING_INT_CAST(UINT32, y), nullptr,
FREERDP_FLIP_NONE);
LeaveCriticalSection(&surface->lock);
return success;
@@ -936,7 +936,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
LeaveCriticalSection(&surface->lock);
}
XImage* image = NULL;
XImage* image = nullptr;
RECTANGLE_16 invalidRect = WINPR_C_ARRAY_INIT;
int status = -1;
{
@@ -952,7 +952,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
goto fail_capture;
/* Restore the default error handler */
XSetErrorHandler(NULL);
XSetErrorHandler(nullptr);
XSync(subsystem->display, False);
XUnlockDisplay(subsystem->display);
}
@@ -977,7 +977,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
if (count == 1)
{
rdpShadowClient* client = NULL;
rdpShadowClient* client = nullptr;
client = (rdpShadowClient*)ArrayList_GetItem(server->clients, 0);
if (client)
@@ -1032,7 +1032,7 @@ static DWORD WINAPI x11_shadow_subsystem_thread(LPVOID arg)
UINT64 frameTime = 0;
HANDLE events[32];
wMessage message;
wMessagePipe* MsgPipe = NULL;
wMessagePipe* MsgPipe = nullptr;
MsgPipe = subsystem->common.MsgPipe;
nCount = 0;
events[nCount++] = subsystem->common.event;
@@ -1113,11 +1113,11 @@ static int x11_shadow_subsystem_base_init(x11ShadowSubsystem* subsystem)
if (!XInitThreads())
return -1;
subsystem->display = XOpenDisplay(NULL);
subsystem->display = XOpenDisplay(nullptr);
if (!subsystem->display)
{
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(nullptr));
return -1;
}
@@ -1214,7 +1214,7 @@ static int x11_shadow_xdamage_init(x11ShadowSubsystem* subsystem)
return -1;
#ifdef WITH_XFIXES
subsystem->xdamage_region = XFixesCreateRegion(subsystem->display, NULL, 0);
subsystem->xdamage_region = XFixesCreateRegion(subsystem->display, nullptr, 0);
if (!subsystem->xdamage_region)
return -1;
@@ -1247,7 +1247,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
subsystem->fb_shm_info.shmaddr = (char*)-1;
subsystem->fb_shm_info.readOnly = False;
subsystem->fb_image =
XShmCreateImage(subsystem->display, subsystem->visual, subsystem->depth, ZPixmap, NULL,
XShmCreateImage(subsystem->display, subsystem->visual, subsystem->depth, ZPixmap, nullptr,
&(subsystem->fb_shm_info), subsystem->width, subsystem->height);
if (!subsystem->fb_image)
@@ -1268,7 +1268,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
return -1;
}
subsystem->fb_shm_info.shmaddr = shmat(subsystem->fb_shm_info.shmid, 0, 0);
subsystem->fb_shm_info.shmaddr = shmat(subsystem->fb_shm_info.shmid, nullptr, 0);
subsystem->fb_image->data = subsystem->fb_shm_info.shmaddr;
if (subsystem->fb_shm_info.shmaddr == ((char*)-1))
@@ -1281,7 +1281,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
return -1;
XSync(subsystem->display, False);
shmctl(subsystem->fb_shm_info.shmid, IPC_RMID, 0);
shmctl(subsystem->fb_shm_info.shmid, IPC_RMID, nullptr);
subsystem->fb_pixmap = XShmCreatePixmap(
subsystem->display, subsystem->root_window, subsystem->fb_image->data,
&(subsystem->fb_shm_info), WINPR_ASSERTING_INT_CAST(uint32_t, subsystem->fb_image->width),
@@ -1305,7 +1305,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
{
Display* display = NULL;
Display* display = nullptr;
int displayWidth = 0;
int displayHeight = 0;
int numMonitors = 0;
@@ -1317,11 +1317,11 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
setenv("DISPLAY", ":0", 1);
}
display = XOpenDisplay(NULL);
display = XOpenDisplay(nullptr);
if (!display)
{
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(nullptr));
return 0;
}
@@ -1335,7 +1335,7 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
#endif
int xinerama_event = 0;
int xinerama_error = 0;
XineramaScreenInfo* screens = NULL;
XineramaScreenInfo* screens = nullptr;
const Bool xinerama = XineramaQueryExtension(display, &xinerama_event, &xinerama_error);
const Bool damage =
@@ -1396,7 +1396,7 @@ static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
int vi_count = 0;
int nextensions = 0;
XVisualInfo xtemplate = WINPR_C_ARRAY_INIT;
XPixmapFormatValues* pf = NULL;
XPixmapFormatValues* pf = nullptr;
x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
@@ -1524,7 +1524,7 @@ static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
}
if (!(subsystem->common.event =
CreateFileDescriptorEvent(NULL, FALSE, FALSE, subsystem->xfds, WINPR_FD_READ)))
CreateFileDescriptorEvent(nullptr, FALSE, FALSE, subsystem->xfds, WINPR_FD_READ)))
return -1;
{
@@ -1556,19 +1556,19 @@ static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub)
if (subsystem->display)
{
XCloseDisplay(subsystem->display);
subsystem->display = NULL;
subsystem->display = nullptr;
}
if (subsystem->common.event)
{
(void)CloseHandle(subsystem->common.event);
subsystem->common.event = NULL;
subsystem->common.event = nullptr;
}
if (subsystem->cursorPixels)
{
winpr_aligned_free(subsystem->cursorPixels);
subsystem->cursorPixels = NULL;
subsystem->cursorPixels = nullptr;
}
return 1;
@@ -1583,7 +1583,7 @@ static int x11_shadow_subsystem_start(rdpShadowSubsystem* sub)
return -1;
if (!(subsystem->thread =
CreateThread(NULL, 0, x11_shadow_subsystem_thread, (void*)subsystem, 0, NULL)))
CreateThread(nullptr, 0, x11_shadow_subsystem_thread, (void*)subsystem, 0, nullptr)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;
@@ -1606,7 +1606,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
(void)WaitForSingleObject(subsystem->thread, INFINITE);
(void)CloseHandle(subsystem->thread);
subsystem->thread = NULL;
subsystem->thread = nullptr;
}
return 1;
@@ -1618,7 +1618,7 @@ static rdpShadowSubsystem* x11_shadow_subsystem_new(void)
x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)calloc(1, sizeof(x11ShadowSubsystem));
if (!subsystem)
return NULL;
return nullptr;
#ifdef WITH_PAM
subsystem->common.Authenticate = x11_shadow_pam_authenticate;

View File

@@ -37,84 +37,86 @@ int main(int argc, char** argv)
int status = 0;
DWORD dwExitCode = 0;
COMMAND_LINE_ARGUMENT_A shadow_args[] = {
{ "log-filters", COMMAND_LINE_VALUE_REQUIRED, "<tag>:<level>[,<tag>:<level>[,...]]", NULL,
NULL, -1, NULL, "Set logger filters, see wLog(7) for details" },
{ "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL,
NULL, -1, NULL, "Set the default log level, see wLog(7) for details" },
{ "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" },
{ "ipc-socket", COMMAND_LINE_VALUE_REQUIRED, "<ipc-socket>", NULL, NULL, -1, NULL,
{ "log-filters", COMMAND_LINE_VALUE_REQUIRED, "<tag>:<level>[,<tag>:<level>[,...]]",
nullptr, nullptr, -1, nullptr, "Set logger filters, see wLog(7) for details" },
{ "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]",
nullptr, nullptr, -1, nullptr, "Set the default log level, see wLog(7) for details" },
{ "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", nullptr, nullptr, -1, nullptr,
"Server port" },
{ "ipc-socket", COMMAND_LINE_VALUE_REQUIRED, "<ipc-socket>", nullptr, nullptr, -1, nullptr,
"Server IPC socket" },
{ "bind-address", COMMAND_LINE_VALUE_REQUIRED, "<bind-address>[,<another address>, ...]",
NULL, NULL, -1, NULL,
nullptr, nullptr, -1, nullptr,
"An address to bind to. Use '[<ipv6>]' for IPv6 addresses, e.g. '[::1]' for "
"localhost" },
{ "server-side-cursor", COMMAND_LINE_VALUE_BOOL, NULL, NULL, NULL, -1, NULL,
{ "server-side-cursor", COMMAND_LINE_VALUE_BOOL, nullptr, nullptr, nullptr, -1, nullptr,
"hide mouse cursor in RDP client." },
{ "monitors", COMMAND_LINE_VALUE_OPTIONAL, "<0,1,2...>", NULL, NULL, -1, NULL,
{ "monitors", COMMAND_LINE_VALUE_OPTIONAL, "<0,1,2...>", nullptr, nullptr, -1, nullptr,
"Select or list monitors" },
{ "max-connections", COMMAND_LINE_VALUE_REQUIRED, "<number>", 0, NULL, -1, NULL,
{ "max-connections", COMMAND_LINE_VALUE_REQUIRED, "<number>", nullptr, nullptr, -1, nullptr,
"maximum connections allowed to server, 0 to deactivate" },
{ "mouse-relative", COMMAND_LINE_VALUE_BOOL, NULL, NULL, NULL, -1, NULL,
{ "mouse-relative", COMMAND_LINE_VALUE_BOOL, nullptr, nullptr, nullptr, -1, nullptr,
"enable support for relative mouse events" },
{ "rect", COMMAND_LINE_VALUE_REQUIRED, "<x,y,w,h>", NULL, NULL, -1, NULL,
{ "rect", COMMAND_LINE_VALUE_REQUIRED, "<x,y,w,h>", nullptr, nullptr, -1, nullptr,
"Select rectangle within monitor to share" },
{ "auth", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "auth", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Clients must authenticate" },
{ "remote-guard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
{ "remote-guard", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr,
"Remote credential guard" },
{ "restricted-admin", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "restricted-admin", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Restricted Admin" },
{ "vmconnect", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse,
NULL, -1, NULL, "Hyper-V console server (bind on vsock://1)" },
{ "may-view", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "vmconnect", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse,
nullptr, -1, nullptr, "Hyper-V console server (bind on vsock://1)" },
{ "may-view", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Clients may view without prompt" },
{ "may-interact", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "may-interact", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Clients may interact without prompt" },
{ "sec", COMMAND_LINE_VALUE_REQUIRED, "<rdp|tls|nla|ext>", NULL, NULL, -1, NULL,
{ "sec", COMMAND_LINE_VALUE_REQUIRED, "<rdp|tls|nla|ext>", nullptr, nullptr, -1, nullptr,
"force specific protocol security" },
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"rdp protocol security" },
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"tls protocol security" },
{ "sec-nla", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "sec-nla", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"nla protocol security" },
{ "sec-ext", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
{ "sec-ext", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr,
"nla extended protocol security" },
{ "sam-file", COMMAND_LINE_VALUE_REQUIRED, "<file>", NULL, NULL, -1, NULL,
{ "sam-file", COMMAND_LINE_VALUE_REQUIRED, "<file>", nullptr, nullptr, -1, nullptr,
"NTLM SAM file for NLA authentication" },
{ "keytab", COMMAND_LINE_VALUE_REQUIRED, "<file>", NULL, NULL, -1, NULL,
{ "keytab", COMMAND_LINE_VALUE_REQUIRED, "<file>", nullptr, nullptr, -1, nullptr,
"Kerberos keytab file for NLA authentication" },
{ "ccache", COMMAND_LINE_VALUE_REQUIRED, "<file>", NULL, NULL, -1, NULL,
{ "ccache", COMMAND_LINE_VALUE_REQUIRED, "<file>", nullptr, nullptr, -1, nullptr,
"Kerberos host ccache file for NLA authentication" },
{ "tls-secrets-file", COMMAND_LINE_VALUE_REQUIRED, "<file>", NULL, NULL, -1, NULL,
{ "tls-secrets-file", COMMAND_LINE_VALUE_REQUIRED, "<file>", nullptr, nullptr, -1, nullptr,
"file where tls secrets shall be stored" },
{ "nsc", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Allow NSC codec" },
{ "rfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "nsc", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow NSC codec" },
{ "rfx", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow RFX surface bits" },
{ "gfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX pipeline" },
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX progressive codec" },
{ "gfx-rfx", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx-rfx", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX RFX codec" },
{ "gfx-planar", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx-planar", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX planar codec" },
{ "gfx-avc420", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx-avc420", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX AVC420 codec" },
{ "gfx-avc444", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
{ "gfx-avc444", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr,
"Allow GFX AVC444 codec" },
{ "bitmap-compat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
{ "bitmap-compat", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr,
"Limit BitmapUpdate to 1 rectangle (fixes broken windows 11 24H2 clients)" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1,
NULL, "Print version" },
{ "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL,
-1, NULL, "Print the build configuration" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?",
"Print help" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, nullptr, nullptr,
nullptr, -1, nullptr, "Print version" },
{ "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, nullptr, nullptr,
nullptr, -1, nullptr, "Print the build configuration" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, nullptr, nullptr, nullptr, -1,
"?", "Print help" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
shadow_subsystem_set_entry_builtin(NULL);
shadow_subsystem_set_entry_builtin(nullptr);
rdpShadowServer* server = shadow_server_new();

View File

@@ -34,8 +34,8 @@
WINPR_ATTR_NODISCARD
static UINT AudinServerData(audin_server_context* audin, const SNDIN_DATA* data)
{
rdpShadowClient* client = NULL;
rdpShadowSubsystem* subsystem = NULL;
rdpShadowClient* client = nullptr;
rdpShadowSubsystem* subsystem = nullptr;
WINPR_ASSERT(audin);
WINPR_ASSERT(data);
@@ -83,14 +83,14 @@ BOOL shadow_client_audin_init(rdpShadowClient* client)
}
else
{
if (!audin_server_set_formats(client->audin, -1, NULL))
if (!audin_server_set_formats(client->audin, -1, nullptr))
goto fail;
}
return TRUE;
fail:
audin_server_context_free(audin);
client->audin = NULL;
client->audin = nullptr;
#endif
return FALSE;
}
@@ -101,6 +101,6 @@ void shadow_client_audin_uninit(rdpShadowClient* client)
#if defined(CHANNEL_AUDIN_SERVER)
audin_server_context_free(client->audin);
client->audin = NULL;
client->audin = nullptr;
#endif
}

View File

@@ -97,8 +97,8 @@ static BOOL color_equal(UINT32 colorA, UINT32 formatA, UINT32 colorB, UINT32 for
BYTE bg = 0;
BYTE bb = 0;
BYTE ba = 0;
FreeRDPSplitColor(colorA, formatA, &ar, &ag, &ab, &aa, NULL);
FreeRDPSplitColor(colorB, formatB, &br, &bg, &bb, &ba, NULL);
FreeRDPSplitColor(colorA, formatA, &ar, &ag, &ab, &aa, nullptr);
FreeRDPSplitColor(colorB, formatB, &br, &bg, &bb, &ba, nullptr);
if (ar != br)
return FALSE;
@@ -138,8 +138,8 @@ static BOOL color_equal_no_alpha(UINT32 colorA, UINT32 formatA, UINT32 colorB, U
BYTE br = 0;
BYTE bg = 0;
BYTE bb = 0;
FreeRDPSplitColor(colorA, formatA, &ar, &ag, &ab, NULL, NULL);
FreeRDPSplitColor(colorB, formatB, &br, &bg, &bb, NULL, NULL);
FreeRDPSplitColor(colorA, formatA, &ar, &ag, &ab, nullptr, nullptr);
FreeRDPSplitColor(colorB, formatB, &br, &bg, &bb, nullptr, nullptr);
if (ar != br)
return FALSE;
@@ -323,7 +323,7 @@ rdpShadowCapture* shadow_capture_new(rdpShadowServer* server)
rdpShadowCapture* capture = (rdpShadowCapture*)calloc(1, sizeof(rdpShadowCapture));
if (!capture)
return NULL;
return nullptr;
capture->server = server;
@@ -333,7 +333,7 @@ rdpShadowCapture* shadow_capture_new(rdpShadowServer* server)
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
shadow_capture_free(capture);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
return capture;

View File

@@ -115,8 +115,8 @@ static inline BOOL shadow_client_rdpgfx_new_surface(rdpShadowClient* client)
UINT error = CHANNEL_RC_OK;
RDPGFX_CREATE_SURFACE_PDU createSurface;
RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU surfaceToOutput;
RdpgfxServerContext* context = NULL;
rdpSettings* settings = NULL;
RdpgfxServerContext* context = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(client);
context = client->rdpgfx;
@@ -158,7 +158,7 @@ static inline BOOL shadow_client_rdpgfx_release_surface(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_DELETE_SURFACE_PDU pdu;
RdpgfxServerContext* context = NULL;
RdpgfxServerContext* context = nullptr;
WINPR_ASSERT(client);
@@ -182,8 +182,8 @@ static inline BOOL shadow_client_rdpgfx_reset_graphic(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_RESET_GRAPHICS_PDU pdu = WINPR_C_ARRAY_INIT;
RdpgfxServerContext* context = NULL;
rdpSettings* settings = NULL;
RdpgfxServerContext* context = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(client);
WINPR_ASSERT(client->rdpgfx);
@@ -218,14 +218,14 @@ static inline void shadow_client_free_queued_message(void* obj)
if (message->Free)
{
message->Free(message);
message->Free = NULL;
message->Free = nullptr;
}
}
static void shadow_client_context_free(freerdp_peer* peer, rdpContext* context)
{
rdpShadowClient* client = (rdpShadowClient*)context;
rdpShadowServer* server = NULL;
rdpShadowServer* server = nullptr;
WINPR_UNUSED(peer);
if (!client)
@@ -243,9 +243,9 @@ static void shadow_client_context_free(freerdp_peer* peer, rdpContext* context)
region16_uninit(&(client->invalidRegion));
DeleteCriticalSection(&(client->lock));
client->MsgQueue = NULL;
client->encoder = NULL;
client->vcm = NULL;
client->MsgQueue = nullptr;
client->encoder = nullptr;
client->vcm = nullptr;
}
WINPR_ATTR_NODISCARD
@@ -254,10 +254,10 @@ static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
BOOL NSCodec = 0;
const char bind_address[] = "bind-address,";
rdpShadowClient* client = (rdpShadowClient*)context;
rdpSettings* settings = NULL;
const rdpSettings* srvSettings = NULL;
rdpShadowServer* server = NULL;
const wObject cb = { NULL, NULL, NULL, shadow_client_free_queued_message, NULL };
rdpSettings* settings = nullptr;
const rdpSettings* srvSettings = nullptr;
rdpShadowServer* server = nullptr;
const wObject cb = { nullptr, nullptr, nullptr, shadow_client_free_queued_message, nullptr };
WINPR_ASSERT(client);
WINPR_ASSERT(peer);
@@ -396,8 +396,8 @@ static inline BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
{
INT32 width = 0;
INT32 height = 0;
rdpShadowServer* server = NULL;
rdpSettings* settings = NULL;
rdpShadowServer* server = nullptr;
rdpSettings* settings = nullptr;
RECTANGLE_16 viewport = WINPR_C_ARRAY_INIT;
WINPR_ASSERT(client);
@@ -433,8 +433,8 @@ static inline BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
WINPR_ATTR_NODISCARD
static BOOL shadow_client_capabilities(freerdp_peer* peer)
{
rdpShadowSubsystem* subsystem = NULL;
rdpShadowClient* client = NULL;
rdpShadowSubsystem* subsystem = nullptr;
rdpShadowClient* client = nullptr;
BOOL ret = TRUE;
WINPR_ASSERT(peer);
@@ -464,9 +464,9 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_send_desktop_resize(rdpShadowClient* client)
{
BOOL rc = 0;
rdpUpdate* update = NULL;
rdpSettings* settings = NULL;
const freerdp_peer* peer = NULL;
rdpUpdate* update = nullptr;
rdpSettings* settings = nullptr;
const freerdp_peer* peer = nullptr;
WINPR_ASSERT(client);
@@ -518,10 +518,10 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_client_post_connect(freerdp_peer* peer)
{
int authStatus = 0;
rdpSettings* settings = NULL;
rdpShadowClient* client = NULL;
rdpShadowServer* server = NULL;
rdpShadowSubsystem* subsystem = NULL;
rdpSettings* settings = nullptr;
rdpShadowClient* client = nullptr;
rdpShadowServer* server = nullptr;
rdpShadowSubsystem* subsystem = nullptr;
WINPR_ASSERT(peer);
@@ -562,7 +562,7 @@ static BOOL shadow_client_post_connect(freerdp_peer* peer)
if (shadow_client_channels_post_connect(client) != CHANNEL_RC_OK)
return FALSE;
shadow_client_mark_invalid(client, 0, NULL);
shadow_client_mark_invalid(client, 0, nullptr);
authStatus = -1;
const char* Username = freerdp_settings_get_string(settings, FreeRDP_Username);
@@ -635,7 +635,7 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_client_refresh_request(rdpShadowClient* client)
{
wMessage message = WINPR_C_ARRAY_INIT;
wMessagePipe* MsgPipe = NULL;
wMessagePipe* MsgPipe = nullptr;
WINPR_ASSERT(client);
WINPR_ASSERT(client->subsystem);
@@ -644,10 +644,10 @@ static BOOL shadow_client_refresh_request(rdpShadowClient* client)
WINPR_ASSERT(MsgPipe);
message.id = SHADOW_MSG_IN_REFRESH_REQUEST_ID;
message.wParam = NULL;
message.lParam = NULL;
message.wParam = nullptr;
message.lParam = nullptr;
message.context = (void*)client;
message.Free = NULL;
message.Free = nullptr;
return MessageQueue_Dispatch(MsgPipe->In, &message);
}
@@ -655,7 +655,7 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
rdpShadowClient* client = (rdpShadowClient*)context;
RECTANGLE_16* rects = NULL;
RECTANGLE_16* rects = nullptr;
/* It is invalid if we have area count but no actual area */
if (count && !areas)
@@ -676,7 +676,7 @@ static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RE
}
else
{
shadow_client_mark_invalid(client, 0, NULL);
shadow_client_mark_invalid(client, 0, nullptr);
}
return shadow_client_refresh_request(client);
@@ -701,7 +701,7 @@ static BOOL shadow_client_suppress_output(rdpContext* context, BYTE allow, const
}
else
{
shadow_client_mark_invalid(client, 0, NULL);
shadow_client_mark_invalid(client, 0, nullptr);
}
}
@@ -731,7 +731,7 @@ static BOOL shadow_client_activate(freerdp_peer* peer)
}
/* Update full screen in next update */
return shadow_client_refresh_rect(&client->context, 0, NULL);
return shadow_client_refresh_rect(&client->context, 0, nullptr);
}
WINPR_ATTR_NODISCARD
@@ -739,10 +739,10 @@ static BOOL shadow_client_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTIT
BOOL automatic)
{
BOOL rc = FALSE;
char* user = NULL;
char* domain = NULL;
char* password = NULL;
rdpSettings* settings = NULL;
char* user = nullptr;
char* domain = nullptr;
char* password = nullptr;
rdpSettings* settings = nullptr;
WINPR_UNUSED(automatic);
@@ -757,13 +757,14 @@ static BOOL shadow_client_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTIT
if (identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
{
if (identity->User)
user = ConvertWCharNToUtf8Alloc(identity->User, identity->UserLength, NULL);
user = ConvertWCharNToUtf8Alloc(identity->User, identity->UserLength, nullptr);
if (identity->Domain)
domain = ConvertWCharNToUtf8Alloc(identity->Domain, identity->DomainLength, NULL);
domain = ConvertWCharNToUtf8Alloc(identity->Domain, identity->DomainLength, nullptr);
if (identity->Password)
password = ConvertWCharNToUtf8Alloc(identity->Password, identity->PasswordLength, NULL);
password =
ConvertWCharNToUtf8Alloc(identity->Password, identity->PasswordLength, nullptr);
}
else
{
@@ -839,7 +840,7 @@ static UINT
shadow_client_rdpgfx_frame_acknowledge(RdpgfxServerContext* context,
const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge)
{
rdpShadowClient* client = NULL;
rdpShadowClient* client = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(frameAcknowledge);
@@ -894,8 +895,8 @@ static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpSha
BOOL h264, const RDPGFX_CAPSET* capsSets,
UINT32 capsSetCount, UINT32 capsVersion, UINT* rc)
{
const rdpSettings* srvSettings = NULL;
rdpSettings* clientSettings = NULL;
const rdpSettings* srvSettings = nullptr;
rdpSettings* clientSettings = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(client);
@@ -985,8 +986,8 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
{
UINT rc = ERROR_INTERNAL_ERROR;
const rdpSettings* srvSettings = NULL;
rdpSettings* clientSettings = NULL;
const rdpSettings* srvSettings = nullptr;
rdpSettings* clientSettings = nullptr;
BOOL h264 = FALSE;
UINT32 flags = 0;
@@ -1017,7 +1018,7 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
#endif
/* Request full screen update for new gfx channel */
if (!shadow_client_refresh_rect(&client->context, 0, NULL))
if (!shadow_client_refresh_rect(&client->context, 0, nullptr))
return rc;
if (shadow_client_caps_test_version(context, client, h264, capsAdvertise->capsSets,
@@ -1166,8 +1167,8 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
UINT32 id = 0;
UINT error = CHANNEL_RC_OK;
const rdpContext* context = (const rdpContext*)client;
const rdpSettings* settings = NULL;
rdpShadowEncoder* encoder = NULL;
const rdpSettings* settings = nullptr;
rdpShadowEncoder* encoder = nullptr;
RDPGFX_SURFACE_COMMAND cmd = WINPR_C_ARRAY_INIT;
RDPGFX_START_FRAME_PDU cmdstart = WINPR_C_ARRAY_INIT;
RDPGFX_END_FRAME_PDU cmdend = WINPR_C_ARRAY_INIT;
@@ -1311,7 +1312,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
if (freerdp_settings_get_bool(settings, FreeRDP_RemoteFxCodec) && (id != 0))
{
BOOL rc = 0;
wStream* s = NULL;
wStream* s = nullptr;
RFX_RECT rect;
if (shadow_encoder_prepare(encoder, FREERDP_CODEC_REMOTEFX) < 0)
@@ -1320,7 +1321,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
return FALSE;
}
s = Stream_New(NULL, 1024);
s = Stream_New(nullptr, 1024);
WINPR_ASSERT(s);
WINPR_ASSERT(cmd.left <= UINT16_MAX);
@@ -1431,7 +1432,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
freerdp_planar_topdown_image(encoder->planar, TRUE);
cmd.data = freerdp_bitmap_compress_planar(encoder->planar, src, SrcFormat, w, h, nSrcStep,
NULL, &cmd.length);
nullptr, &cmd.length);
WINPR_ASSERT(cmd.data || (cmd.length == 0));
cmd.codecId = RDPGFX_CODECID_PLANAR;
@@ -1456,7 +1457,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
return FALSE;
BOOL rc = freerdp_image_copy_no_overlap(data, PIXEL_FORMAT_BGRA32, 0, 0, 0, w, h, pSrcData,
SrcFormat, nSrcStep, cmd.left, cmd.top, NULL, 0);
SrcFormat, nSrcStep, cmd.left, cmd.top, nullptr, 0);
if (!rc)
{
free(data);
@@ -1528,13 +1529,13 @@ static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcD
BOOL ret = TRUE;
BOOL first = 0;
BOOL last = 0;
wStream* s = NULL;
wStream* s = nullptr;
size_t numMessages = 0;
UINT32 frameId = 0;
rdpUpdate* update = NULL;
rdpUpdate* update = nullptr;
rdpContext* context = (rdpContext*)client;
rdpSettings* settings = NULL;
rdpShadowEncoder* encoder = NULL;
rdpSettings* settings = nullptr;
rdpShadowEncoder* encoder = nullptr;
SURFACE_BITS_COMMAND cmd = WINPR_C_ARRAY_INIT;
if (!context || !pSrcData)
@@ -1687,8 +1688,8 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
UINT16 nWidth, UINT16 nHeight)
{
BOOL ret = TRUE;
BYTE* data = NULL;
BYTE* buffer = NULL;
BYTE* data = nullptr;
BYTE* buffer = nullptr;
UINT32 k = 0;
UINT32 yIdx = 0;
UINT32 xIdx = 0;
@@ -1696,11 +1697,11 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
UINT32 cols = 0;
UINT32 DstSize = 0;
UINT32 SrcFormat = 0;
BITMAP_DATA* bitmap = NULL;
BITMAP_DATA* bitmap = nullptr;
rdpContext* context = (rdpContext*)client;
UINT32 totalBitmapSize = 0;
UINT32 updateSizeEstimate = 0;
BITMAP_DATA* bitmapData = NULL;
BITMAP_DATA* bitmapData = nullptr;
BITMAP_UPDATE bitmapUpdate = WINPR_C_ARRAY_INIT;
if (!context || !pSrcData)
@@ -1797,9 +1798,9 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
DstSize = 64 * 64 * 4;
buffer = encoder->grid[k];
ret = interleaved_compress(encoder->interleaved, buffer, &DstSize, bitmap->width,
bitmap->height, pSrcData, SrcFormat, nSrcStep,
bitmap->destLeft, bitmap->destTop, NULL, bitsPerPixel);
ret = interleaved_compress(
encoder->interleaved, buffer, &DstSize, bitmap->width, bitmap->height, pSrcData,
SrcFormat, nSrcStep, bitmap->destLeft, bitmap->destTop, nullptr, bitsPerPixel);
if (!ret)
goto out;
bitmap->bitmapDataStream = buffer;
@@ -1840,7 +1841,7 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
UINT32 j = 0;
UINT32 updateSize = 0;
UINT32 newUpdateSize = 0;
BITMAP_DATA* fragBitmapData = NULL;
BITMAP_DATA* fragBitmapData = nullptr;
if (k > 0)
fragBitmapData = (BITMAP_DATA*)calloc(k, sizeof(BITMAP_DATA));
@@ -1905,17 +1906,17 @@ static BOOL shadow_client_send_surface_update(rdpShadowClient* client, SHADOW_GF
INT64 nWidth = 0;
INT64 nHeight = 0;
rdpContext* context = (rdpContext*)client;
rdpSettings* settings = NULL;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
rdpSettings* settings = nullptr;
rdpShadowServer* server = nullptr;
rdpShadowSurface* surface = nullptr;
REGION16 invalidRegion;
RECTANGLE_16 surfaceRect;
const RECTANGLE_16* extents = NULL;
BYTE* pSrcData = NULL;
const RECTANGLE_16* extents = nullptr;
BYTE* pSrcData = nullptr;
UINT32 nSrcStep = 0;
UINT32 SrcFormat = 0;
UINT32 numRects = 0;
const RECTANGLE_16* rects = NULL;
const RECTANGLE_16* rects = nullptr;
if (!context || !pStatus)
return FALSE;
@@ -2078,8 +2079,8 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_resize(rdpShadowClient* client, SHADOW_GFX_STATUS* pStatus)
{
rdpContext* context = (rdpContext*)client;
rdpSettings* settings = NULL;
freerdp_peer* peer = NULL;
rdpSettings* settings = nullptr;
freerdp_peer* peer = nullptr;
if (!context || !pStatus)
return FALSE;
@@ -2128,7 +2129,7 @@ WINPR_ATTR_NODISCARD
static BOOL shadow_client_surface_update(rdpShadowClient* client, REGION16* region)
{
UINT32 numRects = 0;
const RECTANGLE_16* rects = NULL;
const RECTANGLE_16* rects = nullptr;
rects = region16_rects(region, &numRects);
shadow_client_mark_invalid(client, numRects, rects);
return TRUE;
@@ -2144,8 +2145,8 @@ WINPR_ATTR_NODISCARD
static inline BOOL shadow_client_no_surface_update(rdpShadowClient* client,
SHADOW_GFX_STATUS* pStatus)
{
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
rdpShadowServer* server = nullptr;
rdpShadowSurface* surface = nullptr;
WINPR_UNUSED(pStatus);
WINPR_ASSERT(client);
server = client->server;
@@ -2304,18 +2305,18 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
wMessage pointerPositionMsg = WINPR_C_ARRAY_INIT;
wMessage pointerAlphaMsg = WINPR_C_ARRAY_INIT;
wMessage audioVolumeMsg = WINPR_C_ARRAY_INIT;
HANDLE ChannelEvent = 0;
void* UpdateSubscriber = NULL;
HANDLE UpdateEvent = 0;
freerdp_peer* peer = NULL;
rdpContext* context = NULL;
rdpSettings* settings = NULL;
rdpShadowServer* server = NULL;
rdpShadowSubsystem* subsystem = NULL;
wMessageQueue* MsgQueue = NULL;
HANDLE ChannelEvent = nullptr;
void* UpdateSubscriber = nullptr;
HANDLE UpdateEvent = nullptr;
freerdp_peer* peer = nullptr;
rdpContext* context = nullptr;
rdpSettings* settings = nullptr;
rdpShadowServer* server = nullptr;
rdpShadowSubsystem* subsystem = nullptr;
wMessageQueue* MsgQueue = nullptr;
/* This should only be visited in client thread */
SHADOW_GFX_STATUS gfxstatus = WINPR_C_ARRAY_INIT;
rdpUpdate* update = NULL;
rdpUpdate* update = nullptr;
WINPR_ASSERT(client);
@@ -2542,11 +2543,11 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
{
/* Drain messages. Pointer update could be accumulated. */
pointerPositionMsg.id = 0;
pointerPositionMsg.Free = NULL;
pointerPositionMsg.Free = nullptr;
pointerAlphaMsg.id = 0;
pointerAlphaMsg.Free = NULL;
pointerAlphaMsg.Free = nullptr;
audioVolumeMsg.id = 0;
audioVolumeMsg.Free = NULL;
audioVolumeMsg.Free = nullptr;
while (MessageQueue_Peek(MsgQueue, &message, TRUE))
{
@@ -2646,7 +2647,7 @@ fail:
if (UpdateSubscriber)
{
shadow_multiclient_release_subscriber(UpdateSubscriber);
UpdateSubscriber = NULL;
UpdateSubscriber = nullptr;
}
if (peer->connected && subsystem->ClientDisconnect)
@@ -2665,8 +2666,8 @@ out:
BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
{
rdpShadowClient* client = NULL;
rdpShadowServer* server = NULL;
rdpShadowClient* client = nullptr;
rdpShadowServer* server = nullptr;
if (!listener || !peer)
return FALSE;
@@ -2685,7 +2686,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
client = (rdpShadowClient*)peer->context;
WINPR_ASSERT(client);
if (!(client->thread = CreateThread(NULL, 0, shadow_client_thread, client, 0, NULL)))
if (!(client->thread = CreateThread(nullptr, 0, shadow_client_thread, client, 0, nullptr)))
{
freerdp_peer_context_free(peer);
return FALSE;
@@ -2694,7 +2695,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
{
/* Close the thread handle to make it detached. */
(void)CloseHandle(client->thread);
client->thread = NULL;
client->thread = nullptr;
}
return TRUE;
@@ -2702,7 +2703,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
static void shadow_msg_out_addref(wMessage* message)
{
SHADOW_MSG_OUT* msg = NULL;
SHADOW_MSG_OUT* msg = nullptr;
WINPR_ASSERT(message);
msg = (SHADOW_MSG_OUT*)message->wParam;
@@ -2713,7 +2714,7 @@ static void shadow_msg_out_addref(wMessage* message)
static void shadow_msg_out_release(wMessage* message)
{
SHADOW_MSG_OUT* msg = NULL;
SHADOW_MSG_OUT* msg = nullptr;
WINPR_ASSERT(message);
msg = (SHADOW_MSG_OUT*)message->wParam;
@@ -2796,7 +2797,7 @@ int shadow_client_boardcast_msg(rdpShadowServer* server, void* context, UINT32 t
int shadow_client_boardcast_quit(rdpShadowServer* server, int nExitCode)
{
wMessageQueue* queue = NULL;
wMessageQueue* queue = nullptr;
int count = 0;
WINPR_ASSERT(server);

View File

@@ -115,13 +115,13 @@ static int shadow_encoder_uninit_grid(rdpShadowEncoder* encoder)
if (encoder->gridBuffer)
{
free(encoder->gridBuffer);
encoder->gridBuffer = NULL;
encoder->gridBuffer = nullptr;
}
if (encoder->grid)
{
free((void*)encoder->grid);
encoder->grid = NULL;
encoder->grid = nullptr;
}
encoder->gridWidth = 0;
@@ -305,7 +305,7 @@ static int shadow_encoder_init(rdpShadowEncoder* encoder)
return -1;
if (!encoder->bs)
encoder->bs = Stream_New(NULL, 4ULL * encoder->maxTileWidth * encoder->maxTileHeight);
encoder->bs = Stream_New(nullptr, 4ULL * encoder->maxTileWidth * encoder->maxTileHeight);
if (!encoder->bs)
return -1;
@@ -318,7 +318,7 @@ static int shadow_encoder_uninit_rfx(rdpShadowEncoder* encoder)
if (encoder->rfx)
{
rfx_context_free(encoder->rfx);
encoder->rfx = NULL;
encoder->rfx = nullptr;
}
encoder->codecs &= (UINT32)~FREERDP_CODEC_REMOTEFX;
@@ -330,7 +330,7 @@ static int shadow_encoder_uninit_nsc(rdpShadowEncoder* encoder)
if (encoder->nsc)
{
nsc_context_free(encoder->nsc);
encoder->nsc = NULL;
encoder->nsc = nullptr;
}
encoder->codecs &= (UINT32)~FREERDP_CODEC_NSCODEC;
@@ -342,7 +342,7 @@ static int shadow_encoder_uninit_planar(rdpShadowEncoder* encoder)
if (encoder->planar)
{
freerdp_bitmap_planar_context_free(encoder->planar);
encoder->planar = NULL;
encoder->planar = nullptr;
}
encoder->codecs &= (UINT32)~FREERDP_CODEC_PLANAR;
@@ -354,7 +354,7 @@ static int shadow_encoder_uninit_interleaved(rdpShadowEncoder* encoder)
if (encoder->interleaved)
{
bitmap_interleaved_context_free(encoder->interleaved);
encoder->interleaved = NULL;
encoder->interleaved = nullptr;
}
encoder->codecs &= (UINT32)~FREERDP_CODEC_INTERLEAVED;
@@ -366,7 +366,7 @@ static int shadow_encoder_uninit_h264(rdpShadowEncoder* encoder)
if (encoder->h264)
{
h264_context_free(encoder->h264);
encoder->h264 = NULL;
encoder->h264 = nullptr;
}
encoder->codecs &= (UINT32) ~(FREERDP_CODEC_AVC420 | FREERDP_CODEC_AVC444);
@@ -379,7 +379,7 @@ static int shadow_encoder_uninit_progressive(rdpShadowEncoder* encoder)
if (encoder->progressive)
{
progressive_context_free(encoder->progressive);
encoder->progressive = NULL;
encoder->progressive = nullptr;
}
encoder->codecs &= (UINT32)~FREERDP_CODEC_PROGRESSIVE;
@@ -393,7 +393,7 @@ static int shadow_encoder_uninit(rdpShadowEncoder* encoder)
if (encoder->bs)
{
Stream_Free(encoder->bs, TRUE);
encoder->bs = NULL;
encoder->bs = nullptr;
}
shadow_encoder_uninit_rfx(encoder);
@@ -503,12 +503,12 @@ int shadow_encoder_prepare(rdpShadowEncoder* encoder, UINT32 codecs)
rdpShadowEncoder* shadow_encoder_new(rdpShadowClient* client)
{
rdpShadowEncoder* encoder = NULL;
rdpShadowEncoder* encoder = nullptr;
rdpShadowServer* server = client->server;
encoder = (rdpShadowEncoder*)calloc(1, sizeof(rdpShadowEncoder));
if (!encoder)
return NULL;
return nullptr;
encoder->client = client;
encoder->server = server;
@@ -518,7 +518,7 @@ rdpShadowEncoder* shadow_encoder_new(rdpShadowClient* client)
if (shadow_encoder_init(encoder) < 0)
{
shadow_encoder_free(encoder);
return NULL;
return nullptr;
}
return encoder;

View File

@@ -133,6 +133,6 @@ void shadow_client_encomsp_uninit(rdpShadowClient* client)
{
client->encomsp->Stop(client->encomsp);
encomsp_server_context_free(client->encomsp);
client->encomsp = NULL;
client->encomsp = nullptr;
}
}

View File

@@ -79,10 +79,10 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server)
goto fail;
if (rdtk_label_draw(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height,
NULL, "Welcome", 0, 0) < 0)
nullptr, "Welcome", 0, 0) < 0)
goto fail;
// rdtk_button_draw(surface, 16, 64, 128, 32, NULL, "button");
// rdtk_text_field_draw(surface, 16, 128, 128, 32, NULL, "text field");
// rdtk_button_draw(surface, 16, 64, 128, 32, nullptr, "button");
// rdtk_text_field_draw(surface, 16, 128, 128, 32, nullptr, "text field");
#endif
if (!region16_union_rect(&(lobby->invalidRegion), &(lobby->invalidRegion), &invalidRect))

View File

@@ -51,15 +51,15 @@ rdpShadowMultiClientEvent* shadow_multiclient_new(void)
if (!event)
goto out_error;
event->event = CreateEvent(NULL, TRUE, FALSE, NULL);
event->event = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (!event->event)
goto out_free;
event->barrierEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
event->barrierEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (!event->barrierEvent)
goto out_free_event;
event->doneEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
event->doneEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (!event->doneEvent)
goto out_free_barrierEvent;
@@ -87,7 +87,7 @@ out_free_event:
out_free:
free(event);
out_error:
return (rdpShadowMultiClientEvent*)NULL;
return (rdpShadowMultiClientEvent*)nullptr;
}
void shadow_multiclient_free(rdpShadowMultiClientEvent* event)
@@ -106,8 +106,8 @@ void shadow_multiclient_free(rdpShadowMultiClientEvent* event)
static void Publish(rdpShadowMultiClientEvent* event)
{
wArrayList* subscribers = NULL;
struct rdp_shadow_multiclient_subscriber* subscriber = NULL;
wArrayList* subscribers = nullptr;
struct rdp_shadow_multiclient_subscriber* subscriber = nullptr;
subscribers = event->subscribers;
@@ -240,10 +240,10 @@ static BOOL Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL w
void* shadow_multiclient_get_subscriber(rdpShadowMultiClientEvent* event)
{
struct rdp_shadow_multiclient_subscriber* subscriber = NULL;
struct rdp_shadow_multiclient_subscriber* subscriber = nullptr;
if (!event)
return NULL;
return nullptr;
EnterCriticalSection(&(event->lock));
@@ -272,7 +272,7 @@ out_free:
free(subscriber);
out_error:
LeaveCriticalSection(&(event->lock));
return NULL;
return nullptr;
}
/*
@@ -283,8 +283,8 @@ out_error:
*/
void shadow_multiclient_release_subscriber(void* subscriber)
{
struct rdp_shadow_multiclient_subscriber* s = NULL;
rdpShadowMultiClientEvent* event = NULL;
struct rdp_shadow_multiclient_subscriber* s = nullptr;
rdpShadowMultiClientEvent* event = nullptr;
if (!subscriber)
return;
@@ -309,8 +309,8 @@ void shadow_multiclient_release_subscriber(void* subscriber)
BOOL shadow_multiclient_consume(void* subscriber)
{
struct rdp_shadow_multiclient_subscriber* s = NULL;
rdpShadowMultiClientEvent* event = NULL;
struct rdp_shadow_multiclient_subscriber* s = nullptr;
rdpShadowMultiClientEvent* event = nullptr;
BOOL ret = FALSE;
if (!subscriber)
@@ -335,7 +335,7 @@ BOOL shadow_multiclient_consume(void* subscriber)
HANDLE shadow_multiclient_getevent(void* subscriber)
{
if (!subscriber)
return (HANDLE)NULL;
return (HANDLE) nullptr;
return ((struct rdp_shadow_multiclient_subscriber*)subscriber)->ref->event;
}

View File

@@ -54,6 +54,6 @@ void shadow_client_rdpgfx_uninit(rdpShadowClient* client)
#if defined(CHANNEL_RDPGFX_SERVER)
rdpgfx_server_context_free(client->rdpgfx);
#endif
client->rdpgfx = NULL;
client->rdpgfx = nullptr;
}
}

View File

@@ -92,6 +92,6 @@ void shadow_client_rdpsnd_uninit(rdpShadowClient* client)
{
client->rdpsnd->Stop(client->rdpsnd);
rdpsnd_server_context_free(client->rdpsnd);
client->rdpsnd = NULL;
client->rdpsnd = nullptr;
}
}

View File

@@ -52,6 +52,6 @@ void shadow_client_remdesk_uninit(rdpShadowClient* client)
{
client->remdesk->Stop(client->remdesk);
remdesk_server_context_free(client->remdesk);
client->remdesk = NULL;
client->remdesk = nullptr;
}
}

View File

@@ -95,7 +95,7 @@ fail:
shadow_screen_free(screen);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void shadow_screen_free(rdpShadowScreen* screen)
@@ -110,13 +110,13 @@ void shadow_screen_free(rdpShadowScreen* screen)
if (screen->primary)
{
shadow_surface_free(screen->primary);
screen->primary = NULL;
screen->primary = nullptr;
}
if (screen->lobby)
{
shadow_surface_free(screen->lobby);
screen->lobby = NULL;
screen->lobby = nullptr;
}
free(screen);

View File

@@ -106,7 +106,7 @@ static int shadow_server_print_command_line_help(int argc, char** argv,
size_t nrArgs = 0;
{
const COMMAND_LINE_ARGUMENT_A* arg = largs;
while (arg->Name != NULL)
while (arg->Name != nullptr)
{
nrArgs++;
arg++;
@@ -170,7 +170,7 @@ static int shadow_server_print_command_line_help(int argc, char** argv,
free(str);
}
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
rc = 1;
fail:
@@ -213,7 +213,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
{
int status = 0;
DWORD flags = 0;
const COMMAND_LINE_ARGUMENT_A* arg = NULL;
const COMMAND_LINE_ARGUMENT_A* arg = nullptr;
rdpSettings* settings = server->settings;
if ((argc < 2) || !argv || !cargs)
@@ -222,7 +222,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
CommandLineClearArgumentsA(cargs);
flags = COMMAND_LINE_SEPARATOR_COLON;
flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
status = CommandLineParseArgumentsA(argc, argv, cargs, flags, server, NULL, NULL);
status = CommandLineParseArgumentsA(argc, argv, cargs, flags, server, nullptr, nullptr);
if (status < 0)
return status;
@@ -237,7 +237,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
CommandLineSwitchStart(arg) CommandLineSwitchCase(arg, "port")
{
long val = strtol(arg->Value, NULL, 0);
long val = strtol(arg->Value, nullptr, 0);
if ((errno != 0) || (val <= 0) || (val > UINT16_MAX))
return fail_at(arg, COMMAND_LINE_ERROR);
@@ -272,23 +272,23 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "may-view")
{
server->mayView = arg->Value != NULL;
server->mayView = arg->Value != nullptr;
}
CommandLineSwitchCase(arg, "bitmap-compat")
{
server->SupportMultiRectBitmapUpdates = arg->Value == NULL;
server->SupportMultiRectBitmapUpdates = arg->Value == nullptr;
}
CommandLineSwitchCase(arg, "may-interact")
{
server->mayInteract = arg->Value != NULL;
server->mayInteract = arg->Value != nullptr;
}
CommandLineSwitchCase(arg, "server-side-cursor")
{
server->ShowMouseCursor = arg->Value != NULL;
server->ShowMouseCursor = arg->Value != nullptr;
}
CommandLineSwitchCase(arg, "mouse-relative")
{
const BOOL val = arg->Value != NULL;
const BOOL val = arg->Value != nullptr;
if (!freerdp_settings_set_bool(settings, FreeRDP_MouseUseRelativeMove, val) ||
!freerdp_settings_set_bool(settings, FreeRDP_HasRelativeMouseEvent, val))
return fail_at(arg, COMMAND_LINE_ERROR);
@@ -296,7 +296,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
CommandLineSwitchCase(arg, "max-connections")
{
errno = 0;
unsigned long val = strtoul(arg->Value, NULL, 0);
unsigned long val = strtoul(arg->Value, nullptr, 0);
if ((errno != 0) || (val > UINT32_MAX))
return fail_at(arg, COMMAND_LINE_ERROR);
@@ -304,7 +304,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "rect")
{
char* p = NULL;
char* p = nullptr;
char* tok[4];
long x = -1;
long y = -1;
@@ -346,22 +346,22 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
*p++ = '\0';
tok[3] = p;
x = strtol(tok[0], NULL, 0);
x = strtol(tok[0], nullptr, 0);
if (errno != 0)
goto fail;
y = strtol(tok[1], NULL, 0);
y = strtol(tok[1], nullptr, 0);
if (errno != 0)
goto fail;
w = strtol(tok[2], NULL, 0);
w = strtol(tok[2], nullptr, 0);
if (errno != 0)
goto fail;
h = strtol(tok[3], NULL, 0);
h = strtol(tok[3], nullptr, 0);
if (errno != 0)
goto fail;
@@ -383,23 +383,23 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "auth")
{
server->authentication = arg->Value != NULL;
server->authentication = arg->Value != nullptr;
}
CommandLineSwitchCase(arg, "remote-guard")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteCredentialGuard,
arg->Value != NULL))
arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "restricted-admin")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RestrictedAdminModeSupported,
arg->Value != NULL))
arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "vmconnect")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_VmConnectMode, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_VmConnectMode, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "sec")
@@ -458,22 +458,22 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "sec-rdp")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "sec-tls")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "sec-nla")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "sec-ext")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "sam-file")
@@ -495,45 +495,45 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "nsc")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "rfx")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_SupportGraphicsPipeline,
arg->Value != NULL))
arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx-progressive")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxProgressive, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxProgressive, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx-rfx")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx-planar")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxPlanar, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxPlanar, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx-avc420")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxH264, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxH264, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "gfx-avc444")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444v2, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444v2, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444, arg->Value != NULL))
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444, arg->Value != nullptr))
return fail_at(arg, COMMAND_LINE_ERROR);
}
CommandLineSwitchCase(arg, "keytab")
@@ -555,7 +555,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
{
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
arg = CommandLineFindArgumentA(cargs, "monitors");
@@ -568,7 +568,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{
/* Select monitors */
long val = strtol(arg->Value, NULL, 0);
long val = strtol(arg->Value, nullptr, 0);
if ((val < 0) || (errno != 0) || ((UINT32)val >= numMonitors))
status = COMMAND_LINE_STATUS_PRINT;
@@ -751,12 +751,12 @@ int shadow_server_start(rdpShadowServer* server)
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);
char** ptr = CommandLineParseCommaSeparatedValuesEx(nullptr, server->ipcSocket, &count);
if (!ptr || (count <= 1))
{
if (server->ipcSocket == NULL)
if (server->ipcSocket == nullptr)
{
if (!open_port(server, NULL))
if (!open_port(server, nullptr))
{
CommandLineParserFree(ptr);
return -1;
@@ -793,7 +793,8 @@ int shadow_server_start(rdpShadowServer* server)
}
}
if (!(server->thread = CreateThread(NULL, 0, shadow_server_thread, (void*)server, 0, NULL)))
if (!(server->thread =
CreateThread(nullptr, 0, shadow_server_thread, (void*)server, 0, nullptr)))
{
return -1;
}
@@ -811,7 +812,7 @@ int shadow_server_stop(rdpShadowServer* server)
(void)SetEvent(server->StopEvent);
(void)WaitForSingleObject(server->thread, INFINITE);
(void)CloseHandle(server->thread);
server->thread = NULL;
server->thread = nullptr;
if (server->listener && server->listener->Close)
server->listener->Close(server->listener);
}
@@ -819,13 +820,13 @@ int shadow_server_stop(rdpShadowServer* server)
if (server->screen)
{
shadow_screen_free(server->screen);
server->screen = NULL;
server->screen = nullptr;
}
if (server->capture)
{
shadow_capture_free(server->capture);
server->capture = NULL;
server->capture = nullptr;
}
return 0;
@@ -840,7 +841,7 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
if (configHome)
{
if (!winpr_PathFileExists(configHome) && !winpr_PathMakePath(configHome, 0))
if (!winpr_PathFileExists(configHome) && !winpr_PathMakePath(configHome, nullptr))
{
WLog_ERR(TAG, "Failed to create directory '%s'", configHome);
free(configHome);
@@ -899,12 +900,13 @@ out_fail:
WINPR_ATTR_NODISCARD
static BOOL shadow_server_init_certificate(rdpShadowServer* server)
{
char* filepath = NULL;
char* filepath = nullptr;
BOOL ret = FALSE;
WINPR_ASSERT(server);
if (!winpr_PathFileExists(server->ConfigPath) && !winpr_PathMakePath(server->ConfigPath, 0))
if (!winpr_PathFileExists(server->ConfigPath) &&
!winpr_PathMakePath(server->ConfigPath, nullptr))
{
WLog_ERR(TAG, "Failed to create directory '%s'", server->ConfigPath);
return FALSE;
@@ -913,9 +915,9 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
if (!(filepath = GetCombinedPath(server->ConfigPath, "shadow")))
return FALSE;
if (!winpr_PathFileExists(filepath) && !winpr_PathMakePath(filepath, 0))
if (!winpr_PathFileExists(filepath) && !winpr_PathMakePath(filepath, nullptr))
{
if (!winpr_PathMakePath(filepath, NULL))
if (!winpr_PathMakePath(filepath, nullptr))
{
WLog_ERR(TAG, "Failed to create directory '%s'", filepath);
goto out_fail;
@@ -940,7 +942,7 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
WINPR_ASSERT(settings);
{
rdpPrivateKey* key = freerdp_key_new_from_file_enc(server->PrivateKeyFile, NULL);
rdpPrivateKey* key = freerdp_key_new_from_file_enc(server->PrivateKeyFile, nullptr);
if (!key)
goto out_fail;
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerRsaKey, key, 1))
@@ -1002,7 +1004,7 @@ int shadow_server_init(rdpShadowServer* server)
if (!(server->clients = ArrayList_New(TRUE)))
goto fail;
if (!(server->StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(server->StopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
goto fail;
if (!InitializeCriticalSectionAndSpinCount(&(server->lock), 4000))
@@ -1049,30 +1051,30 @@ int shadow_server_uninit(rdpShadowServer* server)
shadow_server_stop(server);
shadow_subsystem_uninit(server->subsystem);
shadow_subsystem_free(server->subsystem);
server->subsystem = NULL;
server->subsystem = nullptr;
freerdp_listener_free(server->listener);
server->listener = NULL;
server->listener = nullptr;
free(server->CertificateFile);
server->CertificateFile = NULL;
server->CertificateFile = nullptr;
free(server->PrivateKeyFile);
server->PrivateKeyFile = NULL;
server->PrivateKeyFile = nullptr;
free(server->ConfigPath);
server->ConfigPath = NULL;
server->ConfigPath = nullptr;
DeleteCriticalSection(&(server->lock));
(void)CloseHandle(server->StopEvent);
server->StopEvent = NULL;
server->StopEvent = nullptr;
ArrayList_Free(server->clients);
server->clients = NULL;
server->clients = nullptr;
return 1;
}
rdpShadowServer* shadow_server_new(void)
{
rdpShadowServer* server = NULL;
rdpShadowServer* server = nullptr;
server = (rdpShadowServer*)calloc(1, sizeof(rdpShadowServer));
if (!server)
return NULL;
return nullptr;
server->SupportMultiRectBitmapUpdates = TRUE;
server->port = 3389;
@@ -1093,8 +1095,8 @@ void shadow_server_free(rdpShadowServer* server)
return;
free(server->ipcSocket);
server->ipcSocket = NULL;
server->ipcSocket = nullptr;
freerdp_settings_free(server->settings);
server->settings = NULL;
server->settings = nullptr;
free(server);
}

View File

@@ -22,7 +22,7 @@
#include "shadow_subsystem.h"
static pfnShadowSubsystemEntry pSubsystemEntry = NULL;
static pfnShadowSubsystemEntry pSubsystemEntry = nullptr;
void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry)
{
@@ -49,15 +49,15 @@ rdpShadowSubsystem* shadow_subsystem_new(void)
RDP_SHADOW_ENTRY_POINTS ep = WINPR_C_ARRAY_INIT;
if (shadow_subsystem_load_entry_points(&ep) < 0)
return NULL;
return nullptr;
if (!ep.New)
return NULL;
return nullptr;
rdpShadowSubsystem* subsystem = ep.New();
if (!subsystem)
return NULL;
return nullptr;
subsystem->ep = ep;
@@ -94,13 +94,13 @@ fail:
if (subsystem->MsgPipe)
{
MessagePipe_Free(subsystem->MsgPipe);
subsystem->MsgPipe = NULL;
subsystem->MsgPipe = nullptr;
}
if (subsystem->updateEvent)
{
shadow_multiclient_free(subsystem->updateEvent);
subsystem->updateEvent = NULL;
subsystem->updateEvent = nullptr;
}
return status;
@@ -112,7 +112,7 @@ static void shadow_subsystem_free_queued_message(void* obj)
if (message->Free)
{
message->Free(message);
message->Free = NULL;
message->Free = nullptr;
}
}
@@ -126,8 +126,8 @@ void shadow_subsystem_uninit(rdpShadowSubsystem* subsystem)
if (subsystem->MsgPipe)
{
wObject* obj1 = NULL;
wObject* obj2 = NULL;
wObject* obj1 = nullptr;
wObject* obj2 = nullptr;
/* Release resource in messages before free */
obj1 = MessageQueue_Object(subsystem->MsgPipe->In);
@@ -138,13 +138,13 @@ void shadow_subsystem_uninit(rdpShadowSubsystem* subsystem)
obj2->fnObjectFree = shadow_subsystem_free_queued_message;
MessageQueue_Clear(subsystem->MsgPipe->Out);
MessagePipe_Free(subsystem->MsgPipe);
subsystem->MsgPipe = NULL;
subsystem->MsgPipe = nullptr;
}
if (subsystem->updateEvent)
{
shadow_multiclient_free(subsystem->updateEvent);
subsystem->updateEvent = NULL;
subsystem->updateEvent = nullptr;
}
}
@@ -208,7 +208,7 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
UINT32 xorStep = 0;
UINT32 andStep = 0;
UINT32 andBit = 0;
BYTE* andBits = NULL;
BYTE* andBits = nullptr;
UINT32 andPixel = 0;
const size_t bpp = FreeRDPGetBytesPerPixel(format);
@@ -230,7 +230,7 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
if (!pointerColor->andMaskData)
{
free(pointerColor->xorMaskData);
pointerColor->xorMaskData = NULL;
pointerColor->xorMaskData = nullptr;
return -1;
}
@@ -250,7 +250,7 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
BYTE A = 0;
const UINT32 color = FreeRDPReadColor(&pSrc8[x * bpp], format);
FreeRDPSplitColor(color, format, &R, &G, &B, &A, NULL);
FreeRDPSplitColor(color, format, &R, &G, &B, &A, nullptr);
andPixel = 0;

View File

@@ -49,7 +49,7 @@ static pfnShadowSubsystemEntry shadow_subsystem_load_static_entry(const char* na
return cur->entry;
}
return NULL;
return nullptr;
}
for (size_t index = 0; index < g_SubsystemCount; index++)
@@ -62,7 +62,7 @@ static pfnShadowSubsystemEntry shadow_subsystem_load_static_entry(const char* na
return cur->entry;
}
return NULL;
return nullptr;
}
void shadow_subsystem_set_entry_builtin(const char* name)

View File

@@ -27,11 +27,11 @@
rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, UINT16 x, UINT16 y, UINT32 width,
UINT32 height)
{
rdpShadowSurface* surface = NULL;
rdpShadowSurface* surface = nullptr;
surface = (rdpShadowSurface*)calloc(1, sizeof(rdpShadowSurface));
if (!surface)
return NULL;
return nullptr;
surface->server = server;
surface->x = x;
@@ -45,14 +45,14 @@ rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, UINT16 x, UINT16 y
if (!surface->data)
{
free(surface);
return NULL;
return nullptr;
}
if (!InitializeCriticalSectionAndSpinCount(&(surface->lock), 4000))
{
free(surface->data);
free(surface);
return NULL;
return nullptr;
}
region16_init(&(surface->invalidRegion));
@@ -73,7 +73,7 @@ void shadow_surface_free(rdpShadowSurface* surface)
BOOL shadow_surface_resize(rdpShadowSurface* surface, UINT16 x, UINT16 y, UINT32 width,
UINT32 height)
{
BYTE* buffer = NULL;
BYTE* buffer = nullptr;
UINT32 scanline = ALIGN_SCREEN_SIZE(width, 4) * 4;
if (!surface)