[c23,client] replace NULL with nullptr

This commit is contained in:
Armin Novak
2026-02-26 14:35:00 +01:00
parent 20b4cb6edc
commit 465a6353d5
69 changed files with 1544 additions and 1517 deletions

View File

@@ -56,11 +56,11 @@ int main(int argc, char* argv[])
{
int rc = 1;
int status = 0;
HANDLE thread = NULL;
xfContext* xfc = NULL;
HANDLE thread = nullptr;
xfContext* xfc = nullptr;
DWORD dwExitCode = 0;
rdpContext* context = NULL;
rdpSettings* settings = NULL;
rdpContext* context = nullptr;
rdpSettings* settings = nullptr;
RDP_CLIENT_ENTRY_POINTS clientEntryPoints = WINPR_C_ARRAY_INIT;
clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS);

View File

@@ -88,9 +88,9 @@ static BOOL parse_xkb_rule_names(char* xkb_rule, unsigned long num_bytes, char**
static DWORD kbd_layout_id_from_x_property(wLog* log, Display* display, Window root,
char* property_name)
{
char* layout = NULL;
char* variant = NULL;
char* rule = NULL;
char* layout = nullptr;
char* variant = nullptr;
char* rule = nullptr;
Atom type = None;
int item_size = 0;
unsigned long items = 0;
@@ -124,7 +124,7 @@ static DWORD kbd_layout_id_from_x_property(wLog* log, Display* display, Window r
int xf_detect_keyboard_layout_from_xkb(wLog* log, DWORD* keyboardLayoutId)
{
Display* display = XOpenDisplay(NULL);
Display* display = XOpenDisplay(nullptr);
if (!display)
return 0;

View File

@@ -38,7 +38,7 @@
void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEventArgs* e)
{
xfContext* xfc = (xfContext*)context;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(e);
@@ -86,7 +86,7 @@ void xf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEven
void xf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
{
xfContext* xfc = (xfContext*)context;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(e);

View File

@@ -176,10 +176,10 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
Picture windowPicture = 0;
Picture primaryPicture = 0;
XRenderPictureAttributes pa;
XRenderPictFormat* picFormat = NULL;
XRenderPictFormat* picFormat = nullptr;
int x2 = 0;
int y2 = 0;
const char* filter = NULL;
const char* filter = nullptr;
WINPR_ASSERT(xfc);
rdpSettings* settings = xfc->common.context.settings;
@@ -249,7 +249,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
if (absInverse < MIN_PIXEL_DIFF)
filter = FilterNearest;
}
XRenderSetPictureFilter(xfc->display, primaryPicture, filter, 0, 0);
XRenderSetPictureFilter(xfc->display, primaryPicture, filter, nullptr, 0);
transform.matrix[0][0] = XDoubleToFixed(xScalingFactor);
transform.matrix[0][1] = XDoubleToFixed(0.0);
transform.matrix[0][2] = XDoubleToFixed(0.0);
@@ -281,7 +281,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
BOOL xf_picture_transform_required(xfContext* xfc)
{
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
@@ -300,7 +300,7 @@ void xf_draw_screen_(xfContext* xfc, int x, int y, int w, int h, const char* fkt
{
if (!xfc)
{
WLog_DBG(TAG, "called from [%s] xfc=NULL", fkt);
WLog_DBG(TAG, "called from [%s] xfc=nullptr", fkt);
return;
}
@@ -312,7 +312,7 @@ void xf_draw_screen_(xfContext* xfc, int x, int y, int w, int h, const char* fkt
if (!xfc->window)
{
WLog_WARN(TAG, "invalid xfc->window=NULL");
WLog_WARN(TAG, "invalid xfc->window=nullptr");
return;
}
@@ -507,7 +507,7 @@ static BOOL xf_sw_desktop_resize(rdpContext* context)
if (xfc->image)
{
xfc->image->data = NULL;
xfc->image->data = nullptr;
XDestroyImage(xfc->image);
}
@@ -560,12 +560,12 @@ static BOOL xf_process_x_events(freerdp* instance)
static char* xf_window_get_title(rdpSettings* settings)
{
BOOL port = 0;
char* windowTitle = NULL;
char* windowTitle = nullptr;
size_t size = 0;
const char* prefix = "FreeRDP:";
if (!settings)
return NULL;
return nullptr;
const char* name = freerdp_settings_get_string(settings, FreeRDP_ServerHostname);
const char* title = freerdp_settings_get_string(settings, FreeRDP_WindowTitle);
@@ -579,7 +579,7 @@ static char* xf_window_get_title(rdpSettings* settings)
windowTitle = calloc(size, sizeof(char));
if (!windowTitle)
return NULL;
return nullptr;
if (!port)
(void)sprintf_s(windowTitle, size, "%s %s", prefix, name);
@@ -594,7 +594,7 @@ BOOL xf_create_window(xfContext* xfc)
{
XGCValues gcv = WINPR_C_ARRAY_INIT;
XEvent xevent = WINPR_C_ARRAY_INIT;
char* windowTitle = NULL;
char* windowTitle = nullptr;
WINPR_ASSERT(xfc);
rdpSettings* settings = xfc->common.context.settings;
@@ -764,22 +764,22 @@ void xf_destroy_window(xfContext* xfc)
if (xfc->window)
{
xf_DestroyDesktopWindow(xfc, xfc->window);
xfc->window = NULL;
xfc->window = nullptr;
}
#if defined(CHANNEL_TSMF_CLIENT)
if (xfc->xv_context)
{
xf_tsmf_uninit(xfc, NULL);
xfc->xv_context = NULL;
xf_tsmf_uninit(xfc, nullptr);
xfc->xv_context = nullptr;
}
#endif
if (xfc->image)
{
xfc->image->data = NULL;
xfc->image->data = nullptr;
XDestroyImage(xfc->image);
xfc->image = NULL;
xfc->image = nullptr;
}
if (xfc->bitmap_mono)
@@ -791,7 +791,7 @@ void xf_destroy_window(xfContext* xfc)
if (xfc->gc_mono)
{
LogDynAndXFreeGC(xfc->log, xfc->display, xfc->gc_mono);
xfc->gc_mono = 0;
xfc->gc_mono = nullptr;
}
if (xfc->primary)
@@ -803,7 +803,7 @@ void xf_destroy_window(xfContext* xfc)
if (xfc->gc)
{
LogDynAndXFreeGC(xfc->log, xfc->display, xfc->gc);
xfc->gc = 0;
xfc->gc = nullptr;
}
}
@@ -874,7 +874,7 @@ void xf_unlock_x11_(xfContext* xfc, WINPR_ATTR_UNUSED const char* fkt)
static BOOL xf_get_pixmap_info(xfContext* xfc)
{
int pf_count = 0;
XPixmapFormatValues* pfs = NULL;
XPixmapFormatValues* pfs = nullptr;
WINPR_ASSERT(xfc->display);
pfs = XListPixmapFormats(xfc->display, &pf_count);
@@ -898,7 +898,7 @@ static BOOL xf_get_pixmap_info(xfContext* xfc)
}
XFree(pfs);
return !((xfc->visual == NULL) || (xfc->scanline_pad == 0));
return !((xfc->visual == nullptr) || (xfc->scanline_pad == 0));
}
static int xf_error_handler(Display* d, XErrorEvent* ev)
@@ -974,16 +974,16 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
int opcode = 0;
int event = 0;
int error = 0;
XDevice* ptr_dev = NULL;
XExtensionVersion* version = NULL;
XDeviceInfo* devices1 = NULL;
XIDeviceInfo* devices2 = NULL;
XDevice* ptr_dev = nullptr;
XExtensionVersion* version = nullptr;
XDeviceInfo* devices1 = nullptr;
XIDeviceInfo* devices2 = nullptr;
int num_devices = 0;
if (XQueryExtension(xfc->display, "XInputExtension", &opcode, &event, &error))
{
WLog_DBG(TAG, "Searching for XInput pointer device");
ptr_dev = NULL;
ptr_dev = nullptr;
/* loop through every device, looking for a pointer */
version = XGetExtensionVersion(xfc->display, INAME);
@@ -1458,7 +1458,7 @@ static BOOL xf_post_connect(freerdp* instance)
const char* pipe = freerdp_settings_get_string(settings, FreeRDP_KeyboardPipeName);
if (pipe)
{
xfc->pipethread = CreateThread(NULL, 0, xf_handle_pipe, xfc, 0, NULL);
xfc->pipethread = CreateThread(nullptr, 0, xf_handle_pipe, xfc, 0, nullptr);
if (!xfc->pipethread)
return FALSE;
}
@@ -1474,8 +1474,8 @@ static BOOL xf_post_connect(freerdp* instance)
static void xf_post_disconnect(freerdp* instance)
{
xfContext* xfc = NULL;
rdpContext* context = NULL;
xfContext* xfc = nullptr;
rdpContext* context = nullptr;
if (!instance || !instance->context)
return;
@@ -1492,35 +1492,35 @@ static void xf_post_disconnect(freerdp* instance)
{
(void)WaitForSingleObject(xfc->pipethread, INFINITE);
(void)CloseHandle(xfc->pipethread);
xfc->pipethread = NULL;
xfc->pipethread = nullptr;
}
if (xfc->clipboard)
{
xf_clipboard_free(xfc->clipboard);
xfc->clipboard = NULL;
xfc->clipboard = nullptr;
}
if (xfc->xfDisp)
{
xf_disp_free(xfc->xfDisp);
xfc->xfDisp = NULL;
xfc->xfDisp = nullptr;
}
if ((xfc->window != NULL) && (xfc->drawable == xfc->window->handle))
if ((xfc->window != nullptr) && (xfc->drawable == xfc->window->handle))
xfc->drawable = 0;
else
xf_DestroyDummyWindow(xfc, xfc->drawable);
freerdp_keyboard_remap_free(xfc->remap_table);
xfc->remap_table = NULL;
xfc->remap_table = nullptr;
xf_destroy_window(xfc);
}
static void xf_post_final_disconnect(freerdp* instance)
{
xfContext* xfc = NULL;
rdpContext* context = NULL;
xfContext* xfc = nullptr;
rdpContext* context = nullptr;
if (!instance || !instance->context)
return;
@@ -1569,7 +1569,7 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
{
DWORD exit_code = 0;
DWORD waitStatus = 0;
HANDLE inputEvent = NULL;
HANDLE inputEvent = nullptr;
freerdp* instance = (freerdp*)param;
WINPR_ASSERT(instance);
@@ -1733,7 +1733,7 @@ static void xf_ZoomingChangeEventHandler(void* context, const ZoomingChangeEvent
{
int w = 0;
int h = 0;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
xfContext* xfc = (xfContext*)context;
WINPR_ASSERT(xfc);
@@ -1768,7 +1768,7 @@ static void xf_ZoomingChangeEventHandler(void* context, const ZoomingChangeEvent
static void xf_PanningChangeEventHandler(void* context, const PanningChangeEventArgs* e)
{
xfContext* xfc = (xfContext*)context;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(e);
@@ -1816,7 +1816,8 @@ static int xfreerdp_client_start(rdpContext* context)
return -1;
}
if (!(xfc->common.thread = CreateThread(NULL, 0, xf_client_thread, context->instance, 0, NULL)))
if (!(xfc->common.thread =
CreateThread(nullptr, 0, xf_client_thread, context->instance, 0, nullptr)))
{
WLog_ERR(TAG, "failed to create client thread");
return -1;
@@ -1845,30 +1846,30 @@ void xf_teardown_x11(xfContext* xfc)
if (xfc->display)
{
LogDynAndXCloseDisplay(xfc->log, xfc->display);
xfc->display = NULL;
xfc->display = nullptr;
}
if (xfc->x11event)
{
(void)CloseHandle(xfc->x11event);
xfc->x11event = NULL;
xfc->x11event = nullptr;
}
if (xfc->mutex)
{
(void)CloseHandle(xfc->mutex);
xfc->mutex = NULL;
xfc->mutex = nullptr;
}
if (xfc->vscreen.monitors)
{
free(xfc->vscreen.monitors);
xfc->vscreen.monitors = NULL;
xfc->vscreen.monitors = nullptr;
}
xfc->vscreen.nmonitors = 0;
free(xfc->supportedAtoms);
xfc->supportedAtoms = NULL;
xfc->supportedAtoms = nullptr;
xfc->supportedAtomCount = 0;
}
@@ -1892,11 +1893,11 @@ BOOL xf_setup_x11(xfContext* xfc)
}
}
xfc->display = XOpenDisplay(NULL);
xfc->display = XOpenDisplay(nullptr);
if (!xfc->display)
{
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(nullptr));
WLog_ERR(TAG, "Please check that the $DISPLAY environment variable is properly set.");
goto fail;
}
@@ -1907,7 +1908,7 @@ BOOL xf_setup_x11(xfContext* xfc)
}
def_error_handler = XSetErrorHandler(xf_error_handler_ex);
xfc->mutex = CreateMutex(NULL, FALSE, NULL);
xfc->mutex = CreateMutex(nullptr, FALSE, nullptr);
if (!xfc->mutex)
{
@@ -1931,7 +1932,7 @@ BOOL xf_setup_x11(xfContext* xfc)
int actual_format = 0;
unsigned long nitems = 0;
unsigned long after = 0;
unsigned char* data = NULL;
unsigned char* data = nullptr;
int status = LogDynAndXGetWindowProperty(
xfc->log, xfc->display, RootWindowOfScreen(xfc->screen), xfc->NET_SUPPORTED, 0, 1024,
False, XA_ATOM, &actual_type, &actual_format, &nitems, &after, &data);
@@ -2002,7 +2003,7 @@ BOOL xf_setup_x11(xfContext* xfc)
xfc->WM_PROTOCOLS = Logging_XInternAtom(xfc->log, xfc->display, "WM_PROTOCOLS", False);
xfc->WM_DELETE_WINDOW = Logging_XInternAtom(xfc->log, xfc->display, "WM_DELETE_WINDOW", False);
xfc->WM_STATE = Logging_XInternAtom(xfc->log, xfc->display, "WM_STATE", False);
xfc->x11event = CreateFileDescriptorEvent(NULL, FALSE, FALSE, xfc->xfds, WINPR_FD_READ);
xfc->x11event = CreateFileDescriptorEvent(nullptr, FALSE, FALSE, xfc->xfds, WINPR_FD_READ);
xfc->NET_WM_ALLOWED_ACTIONS =
Logging_XInternAtom(xfc->log, xfc->display, "_NET_WM_ALLOWED_ACTIONS", False);

View File

@@ -168,7 +168,7 @@ static void requested_format_free(RequestedFormat** ppRequestedFormat)
free((*ppRequestedFormat)->formatName);
free(*ppRequestedFormat);
*ppRequestedFormat = NULL;
*ppRequestedFormat = nullptr;
}
static BOOL requested_format_replace(RequestedFormat** ppRequestedFormat, UINT32 remoteFormatId,
@@ -210,11 +210,11 @@ static void xf_cached_data_free(void* ptr)
static xfCachedData* xf_cached_data_new(BYTE* data, size_t data_length)
{
if (data_length > UINT32_MAX)
return NULL;
return nullptr;
xfCachedData* cached_data = calloc(1, sizeof(xfCachedData));
if (!cached_data)
return NULL;
return nullptr;
cached_data->data = data;
cached_data->data_length = (UINT32)data_length;
@@ -224,12 +224,12 @@ static xfCachedData* xf_cached_data_new(BYTE* data, size_t data_length)
static xfCachedData* xf_cached_data_new_copy(const BYTE* data, size_t data_length)
{
BYTE* copy = NULL;
BYTE* copy = nullptr;
if (data_length > 0)
{
copy = calloc(data_length + 1, sizeof(BYTE));
if (!copy)
return NULL;
return nullptr;
memcpy(copy, data, data_length);
}
@@ -251,7 +251,7 @@ static void xf_clipboard_free_server_formats(xfClipboard* clipboard)
}
free(clipboard->serverFormats);
clipboard->serverFormats = NULL;
clipboard->serverFormats = nullptr;
}
}
@@ -281,7 +281,7 @@ static void xf_cliprdr_check_owner(xfClipboard* clipboard)
static BOOL xf_cliprdr_is_self_owned(xfClipboard* clipboard)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -294,7 +294,7 @@ static BOOL xf_cliprdr_is_self_owned(xfClipboard* clipboard)
static void xf_cliprdr_set_raw_transfer_enabled(xfClipboard* clipboard, BOOL enabled)
{
UINT32 data = WINPR_ASSERTING_INT_CAST(uint32_t, enabled);
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -311,10 +311,10 @@ static BOOL xf_cliprdr_is_raw_transfer_available(xfClipboard* clipboard)
int result = 0;
unsigned long length = 0;
unsigned long bytes_left = 0;
UINT32* data = NULL;
UINT32* data = nullptr;
UINT32 is_enabled = 0;
Window owner = None;
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -382,7 +382,7 @@ static const xfCliprdrFormat* xf_cliprdr_get_client_format_by_id(xfClipboard* cl
return format;
}
return NULL;
return nullptr;
}
static const xfCliprdrFormat* xf_cliprdr_get_client_format_by_atom(xfClipboard* clipboard,
@@ -398,7 +398,7 @@ static const xfCliprdrFormat* xf_cliprdr_get_client_format_by_atom(xfClipboard*
return format;
}
return NULL;
return nullptr;
}
static const CLIPRDR_FORMAT* xf_cliprdr_get_server_format_by_atom(xfClipboard* clipboard, Atom atom)
@@ -421,7 +421,7 @@ static const CLIPRDR_FORMAT* xf_cliprdr_get_server_format_by_atom(xfClipboard* c
}
}
return NULL;
return nullptr;
}
/**
@@ -497,12 +497,12 @@ static UINT xf_cliprdr_send_data_response(xfClipboard* clipboard, const xfCliprd
static wStream* xf_cliprdr_serialize_server_format_list(xfClipboard* clipboard)
{
UINT32 formatCount = 0;
wStream* s = NULL;
wStream* s = nullptr;
WINPR_ASSERT(clipboard);
/* Typical MS Word format list is about 80 bytes long. */
if (!(s = Stream_New(NULL, 128)))
if (!(s = Stream_New(nullptr, 128)))
{
WLog_ERR(TAG, "failed to allocate serialized format list");
goto error;
@@ -537,14 +537,14 @@ static wStream* xf_cliprdr_serialize_server_format_list(xfClipboard* clipboard)
return s;
error:
Stream_Free(s, TRUE);
return NULL;
return nullptr;
}
static CLIPRDR_FORMAT* xf_cliprdr_parse_server_format_list(BYTE* data, size_t length,
UINT32* numFormats)
{
wStream* s = NULL;
CLIPRDR_FORMAT* formats = NULL;
wStream* s = nullptr;
CLIPRDR_FORMAT* formats = nullptr;
WINPR_ASSERT(data || (length == 0));
WINPR_ASSERT(numFormats);
@@ -574,7 +574,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_parse_server_format_list(BYTE* data, size_t le
for (UINT32 i = 0; i < *numFormats; i++)
{
const char* formatName = NULL;
const char* formatName = nullptr;
size_t formatNameLength = 0;
if (!Stream_CheckAndLogRequiredLength(TAG, s, sizeof(UINT32)))
@@ -601,7 +601,7 @@ error:
Stream_Free(s, FALSE);
free(formats);
*numFormats = 0;
return NULL;
return nullptr;
}
static void xf_cliprdr_free_formats(CLIPRDR_FORMAT* formats, UINT32 numFormats)
@@ -622,9 +622,9 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_raw_server_formats(xfClipboard* clipboard,
int format = 0;
unsigned long length = 0;
unsigned long remaining = 0;
BYTE* data = NULL;
CLIPRDR_FORMAT* formats = NULL;
xfContext* xfc = NULL;
BYTE* data = nullptr;
CLIPRDR_FORMAT* formats = nullptr;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(numFormats);
@@ -679,11 +679,11 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboar
UINT32* numFormats)
{
Atom atom = None;
BYTE* data = NULL;
BYTE* data = nullptr;
int format_property = 0;
unsigned long proplength = 0;
unsigned long bytes_left = 0;
CLIPRDR_FORMAT* formats = NULL;
CLIPRDR_FORMAT* formats = nullptr;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(numFormats);
@@ -701,7 +701,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboar
unsigned long length = proplength + 1;
if (!data)
{
WLog_ERR(TAG, "XGetWindowProperty set length = %lu but data is NULL", length);
WLog_ERR(TAG, "XGetWindowProperty set length = %lu but data is nullptr", length);
goto out;
}
@@ -747,7 +747,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboar
WINPR_ASSERT(cformat->formatName);
}
else
cformat->formatName = NULL;
cformat->formatName = nullptr;
*numFormats += 1;
}
@@ -773,7 +773,7 @@ out:
static CLIPRDR_FORMAT* xf_cliprdr_get_client_formats(xfClipboard* clipboard, UINT32* numFormats)
{
CLIPRDR_FORMAT* formats = NULL;
CLIPRDR_FORMAT* formats = nullptr;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(numFormats);
@@ -796,8 +796,8 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_client_formats(xfClipboard* clipboard, UIN
static void xf_cliprdr_provide_server_format_list(xfClipboard* clipboard)
{
wStream* formats = NULL;
xfContext* xfc = NULL;
wStream* formats = nullptr;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -874,7 +874,7 @@ static void xf_clipboard_formats_free(xfClipboard* clipboard)
xf_cliprdr_free_formats(clipboard->lastSentFormats, clipboard->lastSentNumFormats);
xf_unlock_x11(clipboard->xfc);
clipboard->lastSentFormats = NULL;
clipboard->lastSentFormats = nullptr;
clipboard->lastSentNumFormats = 0;
}
@@ -932,7 +932,7 @@ static UINT xf_cliprdr_send_format_list(xfClipboard* clipboard, const CLIPRDR_FO
xf_clipboard_copy_formats(clipboard, formats, numFormats);
/* Ensure all pending requests are answered. */
xf_cliprdr_send_data_response(clipboard, NULL, NULL, 0);
xf_cliprdr_send_data_response(clipboard, nullptr, nullptr, 0);
xf_cliprdr_clear_cached_data(clipboard);
@@ -960,8 +960,8 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
UINT32 SrcSize = 0;
UINT32 DstSize = 0;
INT64 srcFormatId = -1;
BYTE* pDstData = NULL;
const xfCliprdrFormat* format = NULL;
BYTE* pDstData = nullptr;
const xfCliprdrFormat* format = nullptr;
WINPR_ASSERT(clipboard);
@@ -976,7 +976,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
if (!hasData || !data || !format)
{
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
return;
}
@@ -999,7 +999,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
if (srcFormatId < 0)
{
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
return;
}
@@ -1017,7 +1017,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
if (!pDstData)
{
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
return;
}
@@ -1036,7 +1036,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
UINT error = NO_ERROR;
FILEDESCRIPTORW* file_array = (FILEDESCRIPTORW*)pDstData;
UINT32 file_count = DstSize / sizeof(FILEDESCRIPTORW);
pDstData = NULL;
pDstData = nullptr;
DstSize = 0;
const UINT32 flags = cliprdr_file_context_remote_get_flags(clipboard->file);
@@ -1112,7 +1112,7 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
if (!format || (format->atom != target))
{
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
return FALSE;
}
@@ -1121,7 +1121,7 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
int format_property = 0;
unsigned long length = 0;
unsigned long total_bytes = 0;
BYTE* property_data = NULL;
BYTE* property_data = nullptr;
const int rc = LogDynAndXGetWindowProperty(
xfc->log, xfc->display, xfc->drawable, clipboard->property_atom, 0, 0, False, target, &type,
&format_property, &length, &total_bytes, &property_data);
@@ -1129,7 +1129,7 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
XFree(property_data);
if (rc != Success)
{
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
return FALSE;
}
@@ -1149,7 +1149,7 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
}
else
{
BYTE* incremental_data = NULL;
BYTE* incremental_data = nullptr;
unsigned long incremental_len = 0;
/* Incremental updates completed, pass data */
@@ -1197,7 +1197,7 @@ static void xf_cliprdr_append_target(xfClipboard* clipboard, Atom target)
static void xf_cliprdr_provide_targets(xfClipboard* clipboard, const XSelectionEvent* respond)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -1215,7 +1215,7 @@ static void xf_cliprdr_provide_targets(xfClipboard* clipboard, const XSelectionE
static void xf_cliprdr_provide_timestamp(xfClipboard* clipboard, const XSelectionEvent* respond)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
@@ -1252,7 +1252,7 @@ static void xf_cliprdr_provide_data_(xfClipboard* clipboard, const XSelectionEve
static void log_selection_event(xfContext* xfc, const XEvent* event)
{
const DWORD level = WLOG_TRACE;
static wLog* _log_cached_ptr = NULL;
static wLog* _log_cached_ptr = nullptr;
if (!_log_cached_ptr)
_log_cached_ptr = WLog_Get(TAG);
if (WLog_IsLevelActive(_log_cached_ptr, level))
@@ -1452,7 +1452,7 @@ static xfCachedData* convert_data_from_existing_raw_data(xfClipboard* clipboard,
srcFormatId, WINPR_CXX_COMPAT_CAST(const void*, cached_raw_data->data),
cached_raw_data->data_length);
ClipboardUnlock(clipboard->system);
return NULL;
return nullptr;
}
BYTE* dst_data = ClipboardGetData(clipboard->system, dstFormatId, &dst_size);
@@ -1460,7 +1460,7 @@ static xfCachedData* convert_data_from_existing_raw_data(xfClipboard* clipboard,
{
WLog_WARN(TAG, "Failed to get converted clipboard data");
ClipboardUnlock(clipboard->system);
return NULL;
return nullptr;
}
ClipboardUnlock(clipboard->system);
@@ -1481,14 +1481,14 @@ static xfCachedData* convert_data_from_existing_raw_data(xfClipboard* clipboard,
{
WLog_WARN(TAG, "Failed to allocate cache entry");
free(dst_data);
return NULL;
return nullptr;
}
if (!HashTable_Insert(clipboard->cachedData, format_to_cache_slot(dstFormatId), cached_data))
{
WLog_WARN(TAG, "Failed to cache clipboard data");
xf_cached_data_free(cached_data);
return NULL;
return nullptr;
}
return cached_data;
@@ -1500,13 +1500,13 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
int fmt = 0;
Atom type = 0;
UINT32 formatId = 0;
XSelectionEvent* respond = NULL;
BYTE* data = NULL;
XSelectionEvent* respond = nullptr;
BYTE* data = nullptr;
BOOL delayRespond = 0;
BOOL rawTransfer = 0;
unsigned long length = 0;
unsigned long bytes_left = 0;
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(xevent);
@@ -1556,7 +1556,7 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
{
formatId = format->formatId;
rawTransfer = FALSE;
xfCachedData* cached_data = NULL;
xfCachedData* cached_data = nullptr;
if (formatId == CF_RAW)
{
@@ -1595,7 +1595,7 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
{
UINT32 srcFormatId = 0;
BOOL nullTerminated = FALSE;
xfCachedData* cached_raw_data = NULL;
xfCachedData* cached_raw_data = nullptr;
get_src_format_info_for_local_request(clipboard, cformat, &srcFormatId,
&nullTerminated);
@@ -1665,7 +1665,7 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
static BOOL xf_cliprdr_process_selection_clear(xfClipboard* clipboard,
const XSelectionClearEvent* xevent)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(xevent);
@@ -1685,8 +1685,8 @@ static BOOL xf_cliprdr_process_selection_clear(xfClipboard* clipboard,
static BOOL xf_cliprdr_process_property_notify(xfClipboard* clipboard, const XPropertyEvent* xevent)
{
const xfCliprdrFormat* format = NULL;
xfContext* xfc = NULL;
const xfCliprdrFormat* format = nullptr;
xfContext* xfc = nullptr;
if (!clipboard)
return TRUE;
@@ -1726,7 +1726,7 @@ static BOOL xf_cliprdr_process_property_notify(xfClipboard* clipboard, const XPr
void xf_cliprdr_handle_xevent(xfContext* xfc, const XEvent* event)
{
xfClipboard* clipboard = NULL;
xfClipboard* clipboard = nullptr;
if (!xfc || !event)
return;
@@ -1990,9 +1990,9 @@ static void xf_cliprdr_set_selection_owner(xfContext* xfc, xfClipboard* clipboar
static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
const CLIPRDR_FORMAT_LIST* formatList)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
UINT ret = 0;
xfClipboard* clipboard = NULL;
xfClipboard* clipboard = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(formatList);
@@ -2007,7 +2007,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
/* Clear the active SelectionRequest, as it is now invalid */
free(clipboard->respond);
clipboard->respond = NULL;
clipboard->respond = nullptr;
xf_clipboard_formats_free(clipboard);
xf_cliprdr_clear_cached_data(clipboard);
@@ -2044,7 +2044,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
clipboard->numServerFormats = 0;
free(clipboard->serverFormats);
clipboard->serverFormats = NULL;
clipboard->serverFormats = nullptr;
ret = CHANNEL_RC_NO_MEMORY;
goto out;
}
@@ -2061,7 +2061,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
{
CLIPRDR_FORMAT* format = &clipboard->serverFormats[formatList->numFormats];
format->formatId = CF_RAW;
format->formatName = NULL;
format->formatName = nullptr;
}
xf_cliprdr_provide_server_format_list(clipboard);
clipboard->numTargets = 2;
@@ -2075,7 +2075,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
const xfCliprdrFormat* clientFormat = &clipboard->clientFormats[j];
if (xf_cliprdr_formats_equal(format, clientFormat))
{
if ((clientFormat->formatName != NULL) &&
if ((clientFormat->formatName != nullptr) &&
(strcmp(type_FileGroupDescriptorW, clientFormat->formatName) == 0))
{
if (!cliprdr_file_context_has_local_support(clipboard->file))
@@ -2122,7 +2122,7 @@ static UINT
xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
const xfCliprdrFormat* format = NULL;
const xfCliprdrFormat* format = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(formatDataRequest);
@@ -2148,7 +2148,7 @@ xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
clipboard->requestedFormatId = rawTransfer ? CF_RAW : formatId;
if (!format)
return xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
return xf_cliprdr_send_data_response(clipboard, format, nullptr, 0);
DEBUG_CLIPRDR("requested format 0x%08" PRIx32 " [%s] {local 0x%08" PRIx32 " [%s]} [%s]",
format->formatToRequest, ClipboardGetFormatIdString(format->formatToRequest),
@@ -2172,13 +2172,13 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
BOOL bSuccess = 0;
BYTE* pDstData = NULL;
BYTE* pDstData = nullptr;
UINT32 DstSize = 0;
UINT32 SrcSize = 0;
UINT32 srcFormatId = 0;
UINT32 dstFormatId = 0;
BOOL nullTerminated = FALSE;
xfCachedData* cached_data = NULL;
xfCachedData* cached_data = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(formatDataResponse);
@@ -2196,7 +2196,7 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
{
WLog_WARN(TAG, "Format Data Response PDU msgFlags is CB_RESPONSE_FAIL");
free(clipboard->respond);
clipboard->respond = NULL;
clipboard->respond = nullptr;
return CHANNEL_RC_OK;
}
@@ -2296,7 +2296,7 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
{
WLog_DBG(TAG, "skipping, empty data detected!");
free(clipboard->respond);
clipboard->respond = NULL;
clipboard->respond = nullptr;
willQuit = TRUE;
}
else
@@ -2383,7 +2383,7 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
LogDynAndXFlush(xfc->log, xfc->display);
}
free(clipboard->respond);
clipboard->respond = NULL;
clipboard->respond = nullptr;
return CHANNEL_RC_OK;
}
@@ -2408,11 +2408,11 @@ static BOOL xf_cliprdr_is_valid_unix_filename(LPCWSTR filename)
xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
{
int n = 0;
rdpChannels* channels = NULL;
xfClipboard* clipboard = NULL;
const char* selectionAtom = NULL;
xfCliprdrFormat* clientFormat = NULL;
wObject* obj = NULL;
rdpChannels* channels = nullptr;
xfClipboard* clipboard = nullptr;
const char* selectionAtom = nullptr;
xfCliprdrFormat* clientFormat = nullptr;
wObject* obj = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(xfc->common.context.settings);
@@ -2420,7 +2420,7 @@ xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
if (!(clipboard = (xfClipboard*)calloc(1, sizeof(xfClipboard))))
{
WLog_ERR(TAG, "failed to allocate xfClipboard data");
return NULL;
return nullptr;
}
clipboard->file = cliprdr_file_context_new(clipboard);
@@ -2651,7 +2651,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
xf_clipboard_free(clipboard);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void xf_clipboard_free(xfClipboard* clipboard)
@@ -2705,13 +2705,13 @@ void xf_cliprdr_uninit(xfContext* xfc, CliprdrClientContext* cliprdr)
WINPR_ASSERT(xfc);
WINPR_ASSERT(cliprdr);
xfc->cliprdr = NULL;
xfc->cliprdr = nullptr;
if (xfc->clipboard)
{
ClipboardLock(xfc->clipboard->system);
cliprdr_file_context_uninit(xfc->clipboard->file, cliprdr);
ClipboardUnlock(xfc->clipboard->system);
xfc->clipboard->context = NULL;
xfc->clipboard->context = nullptr;
}
}

View File

@@ -74,7 +74,7 @@ static UINT xf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monito
static BOOL xf_disp_settings_changed(xfDispContext* xfDisp)
{
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfDisp);
WINPR_ASSERT(xfDisp->xfc);
@@ -108,7 +108,7 @@ static BOOL xf_disp_settings_changed(xfDispContext* xfDisp)
static BOOL xf_update_last_sent(xfDispContext* xfDisp)
{
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfDisp);
WINPR_ASSERT(xfDisp->xfc);
@@ -134,9 +134,9 @@ static uint64_t xf_disp_OnTimer(rdpContext* context, WINPR_ATTR_UNUSED void* use
WINPR_ATTR_UNUSED uint64_t interval)
{
xfContext* xfc = NULL;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfContext* xfc = nullptr;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
if (!xf_disp_check_context(context, &xfc, &xfDisp, &settings))
return interval;
@@ -157,7 +157,7 @@ static BOOL update_timer(xfDispContext* xfDisp, uint64_t intervalNS)
{
rdpContext* context = &xfDisp->xfc->common.context;
xfDisp->timerID = freerdp_timer_add(context, intervalNS, xf_disp_OnTimer, NULL, true);
xfDisp->timerID = freerdp_timer_add(context, intervalNS, xf_disp_OnTimer, nullptr, true);
}
return TRUE;
}
@@ -237,7 +237,7 @@ static BOOL xf_disp_queueResize(xfDispContext* xfDisp, UINT32 width, UINT32 heig
static BOOL xf_disp_set_window_resizable(xfDispContext* xfDisp)
{
XSizeHints* size_hints = NULL;
XSizeHints* size_hints = nullptr;
if (!(size_hints = XAllocSizeHints()))
return FALSE;
@@ -257,7 +257,7 @@ static BOOL xf_disp_set_window_resizable(xfDispContext* xfDisp)
BOOL xf_disp_check_context(void* context, xfContext** ppXfc, xfDispContext** ppXfDisp,
rdpSettings** ppSettings)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!context)
return FALSE;
@@ -278,9 +278,9 @@ BOOL xf_disp_check_context(void* context, xfContext** ppXfc, xfDispContext** ppX
static void xf_disp_OnActivated(void* context, const ActivatedEventArgs* e)
{
xfContext* xfc = NULL;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfContext* xfc = nullptr;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
if (!xf_disp_check_context(context, &xfc, &xfDisp, &settings))
return;
@@ -298,9 +298,9 @@ static void xf_disp_OnActivated(void* context, const ActivatedEventArgs* e)
static void xf_disp_OnGraphicsReset(void* context, const GraphicsResetEventArgs* e)
{
xfContext* xfc = NULL;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfContext* xfc = nullptr;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
WINPR_UNUSED(e);
@@ -316,9 +316,9 @@ static void xf_disp_OnGraphicsReset(void* context, const GraphicsResetEventArgs*
static void xf_disp_OnWindowStateChange(void* context, const WindowStateChangeEventArgs* e)
{
xfContext* xfc = NULL;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfContext* xfc = nullptr;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
WINPR_UNUSED(e);
@@ -333,9 +333,9 @@ static void xf_disp_OnWindowStateChange(void* context, const WindowStateChangeEv
xfDispContext* xf_disp_new(xfContext* xfc)
{
xfDispContext* ret = NULL;
const rdpSettings* settings = NULL;
wPubSub* pubSub = NULL;
xfDispContext* ret = nullptr;
const rdpSettings* settings = nullptr;
wPubSub* pubSub = nullptr;
WINPR_ASSERT(xfc);
@@ -348,7 +348,7 @@ xfDispContext* xf_disp_new(xfContext* xfc)
ret = calloc(1, sizeof(xfDispContext));
if (!ret)
return NULL;
return nullptr;
ret->xfc = xfc;
#ifdef USABLE_XRANDR
@@ -388,9 +388,9 @@ void xf_disp_free(xfDispContext* disp)
UINT xf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, UINT32 nmonitors)
{
UINT ret = CHANNEL_RC_OK;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = NULL;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = nullptr;
WINPR_ASSERT(disp);
WINPR_ASSERT(monitors);
@@ -462,8 +462,8 @@ UINT xf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, UIN
BOOL xf_disp_handle_xevent(xfContext* xfc, const XEvent* event)
{
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
UINT32 maxWidth = 0;
UINT32 maxHeight = 0;
@@ -500,7 +500,7 @@ BOOL xf_disp_handle_xevent(xfContext* xfc, const XEvent* event)
BOOL xf_disp_handle_configureNotify(xfContext* xfc, int width, int height)
{
xfDispContext* xfDisp = NULL;
xfDispContext* xfDisp = nullptr;
if (!xfc)
return FALSE;
@@ -519,8 +519,8 @@ static UINT xf_DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors
UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB)
{
/* we're called only if dynamic resolution update is activated */
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
xfDispContext* xfDisp = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(disp);
@@ -546,7 +546,7 @@ static UINT xf_DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors
BOOL xf_disp_init(xfDispContext* xfDisp, DispClientContext* disp)
{
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
if (!xfDisp || !xfDisp->xfc || !disp)
return FALSE;
@@ -584,6 +584,6 @@ BOOL xf_disp_uninit(xfDispContext* xfDisp, DispClientContext* disp)
return FALSE;
WLog_DBG(TAG, "Channel %s closed", DISP_CHANNEL_NAME);
xfDisp->disp = NULL;
xfDisp->disp = nullptr;
return TRUE;
}

View File

@@ -209,7 +209,7 @@ BOOL xf_event_action_script_init(xfContext* xfc)
obj->fnObjectNew = winpr_ObjectStringClone;
obj->fnObjectFree = winpr_ObjectStringFree;
return run_action_script(xfc, "xevent", NULL, xf_action_script_append, NULL);
return run_action_script(xfc, "xevent", nullptr, xf_action_script_append, nullptr);
}
void xf_event_action_script_free(xfContext* xfc)
@@ -217,7 +217,7 @@ void xf_event_action_script_free(xfContext* xfc)
if (xfc->xevents)
{
ArrayList_Free(xfc->xevents);
xfc->xevents = NULL;
xfc->xevents = nullptr;
}
}
@@ -241,7 +241,7 @@ static BOOL action_script_run(xfContext* xfc, const char* buffer, size_t size, v
if (winpr_PathFileExists(buffer))
{
char* cmd = NULL;
char* cmd = nullptr;
size_t cmdlen = 0;
winpr_asprintf(&cmd, &cmdlen, "%s %s %s", buffer, what, arg);
if (!cmd)
@@ -274,9 +274,9 @@ static BOOL action_script_run(xfContext* xfc, const char* buffer, size_t size, v
static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
{
size_t count = 0;
char* name = NULL;
char* name = nullptr;
BOOL match = FALSE;
const char* xeventName = NULL;
const char* xeventName = nullptr;
if (!xfc->actionScriptExists || !xfc->xevents || !xfc->window)
return FALSE;
@@ -305,7 +305,7 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
char arg[2048] = WINPR_C_ARRAY_INIT;
(void)_snprintf(command, sizeof(command), "xevent %s", xeventName);
(void)_snprintf(arg, sizeof(arg), "%lu", (unsigned long)xfc->window->handle);
return run_action_script(xfc, command, arg, action_script_run, NULL);
return run_action_script(xfc, command, arg, action_script_run, nullptr);
}
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
@@ -369,7 +369,7 @@ static BOOL xf_event_Expose(xfContext* xfc, const XExposeEvent* event, BOOL app)
int y = 0;
int w = 0;
int h = 0;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(event);
@@ -636,7 +636,7 @@ static BOOL xf_event_KeyPress(xfContext* xfc, const XKeyEvent* event, BOOL app)
} cnv;
cnv.cev = event;
WINPR_UNUSED(app);
XLookupString(cnv.ev, str, sizeof(str), &keysym, NULL);
XLookupString(cnv.ev, str, sizeof(str), &keysym, nullptr);
xf_keyboard_key_press(xfc, event, keysym);
return TRUE;
}
@@ -653,7 +653,7 @@ static BOOL xf_event_KeyRelease(xfContext* xfc, const XKeyEvent* event, BOOL app
cnv.cev = event;
WINPR_UNUSED(app);
XLookupString(cnv.ev, str, sizeof(str), &keysym, NULL);
XLookupString(cnv.ev, str, sizeof(str), &keysym, nullptr);
xf_keyboard_key_release(xfc, event, keysym);
return TRUE;
}
@@ -830,7 +830,7 @@ static BOOL xf_event_LeaveNotify(xfContext* xfc, const XLeaveWindowEvent* event,
/* keep track of which window has focus so that we can apply pointer updates */
if (xfc->appWindow == appWindow)
xfc->appWindow = NULL;
xfc->appWindow = nullptr;
xf_rail_return_window(appWindow);
}
return TRUE;
@@ -839,7 +839,7 @@ static BOOL xf_event_LeaveNotify(xfContext* xfc, const XLeaveWindowEvent* event,
static BOOL xf_event_ConfigureNotify(xfContext* xfc, const XConfigureEvent* event, BOOL app)
{
Window childWindow = None;
xfAppWindow* appWindow = NULL;
xfAppWindow* appWindow = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(event);
@@ -1009,8 +1009,8 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
BOOL minimizedChanged = FALSE;
unsigned long nitems = 0;
unsigned long bytes = 0;
unsigned char* prop = NULL;
xfAppWindow* appWindow = NULL;
unsigned char* prop = nullptr;
xfAppWindow* appWindow = nullptr;
if (app)
{
@@ -1364,7 +1364,7 @@ BOOL xf_event_process(freerdp* instance, const XEvent* event)
}
xfWindow* window = xfc->window;
xfFloatbar* floatbar = NULL;
xfFloatbar* floatbar = nullptr;
if (window)
floatbar = window->floatbar;

View File

@@ -100,7 +100,7 @@ static BOOL xf_floatbar_button_onclick_close(xfFloatbar* floatbar)
static BOOL xf_floatbar_button_onclick_minimize(xfFloatbar* floatbar)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!floatbar || !floatbar->xfc)
return FALSE;
@@ -139,7 +139,7 @@ BOOL xf_floatbar_set_root_y(xfFloatbar* floatbar, int y)
BOOL xf_floatbar_hide_and_show(xfFloatbar* floatbar)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!floatbar || !floatbar->xfc)
return FALSE;
@@ -173,7 +173,7 @@ BOOL xf_floatbar_hide_and_show(xfFloatbar* floatbar)
static BOOL create_floatbar(xfFloatbar* floatbar)
{
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
Status status = 0;
XWindowAttributes attr = WINPR_C_ARRAY_INIT;
@@ -199,7 +199,7 @@ static BOOL create_floatbar(xfFloatbar* floatbar)
floatbar->handle = LogDynAndXCreateWindow(
xfc->log, xfc->display, floatbar->root_window, floatbar->x, 0, FLOATBAR_DEFAULT_WIDTH,
FLOATBAR_HEIGHT, 0, CopyFromParent, InputOutput, CopyFromParent, 0, NULL);
FLOATBAR_HEIGHT, 0, CopyFromParent, InputOutput, CopyFromParent, 0, nullptr);
floatbar->width = FLOATBAR_DEFAULT_WIDTH;
floatbar->height = FLOATBAR_HEIGHT;
floatbar->mode = XF_FLOATBAR_MODE_NONE;
@@ -219,7 +219,7 @@ BOOL xf_floatbar_toggle_fullscreen(xfFloatbar* floatbar, bool fullscreen)
{
int size = 0;
bool visible = False;
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!floatbar || !floatbar->xfc)
return FALSE;
@@ -267,7 +267,7 @@ BOOL xf_floatbar_toggle_fullscreen(xfFloatbar* floatbar, bool fullscreen)
xfFloatbarButton* xf_floatbar_new_button(xfFloatbar* floatbar, int type)
{
xfFloatbarButton* button = NULL;
xfFloatbarButton* button = nullptr;
WINPR_ASSERT(floatbar);
WINPR_ASSERT(floatbar->xfc);
@@ -308,7 +308,7 @@ xfFloatbarButton* xf_floatbar_new_button(xfFloatbar* floatbar, int type)
button->handle =
LogDynAndXCreateWindow(floatbar->xfc->log, floatbar->xfc->display, floatbar->handle,
button->x, 0, FLOATBAR_BUTTON_WIDTH, FLOATBAR_BUTTON_WIDTH, 0,
CopyFromParent, InputOutput, CopyFromParent, 0, NULL);
CopyFromParent, InputOutput, CopyFromParent, 0, nullptr);
XSelectInput(floatbar->xfc->display, button->handle,
ExposureMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask |
LeaveWindowMask | EnterWindowMask | StructureNotifyMask);
@@ -323,19 +323,19 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window, const char* title, DW
/* Floatbar not enabled */
if ((flags & 0x0001) == 0)
return NULL;
return nullptr;
if (!xfc)
return NULL;
return nullptr;
/* Force disable with remote app */
if (xfc->remote_app)
return NULL;
return nullptr;
xfFloatbar* floatbar = (xfFloatbar*)calloc(1, sizeof(xfFloatbar));
if (!floatbar)
return NULL;
return nullptr;
floatbar->title = _strdup(title);
@@ -349,13 +349,13 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window, const char* title, DW
xf_floatbar_toggle_fullscreen(floatbar, FALSE);
{
char** missingList = NULL;
char** missingList = nullptr;
int missingCount = 0;
char* defString = NULL;
char* defString = nullptr;
floatbar->fontSet = XCreateFontSet(floatbar->xfc->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
&missingList, &missingCount, &defString);
if (floatbar->fontSet == NULL)
if (floatbar->fontSet == nullptr)
{
WLog_ERR(TAG, "Failed to create fontset");
}
@@ -367,7 +367,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
xf_floatbar_free(floatbar);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
static unsigned long xf_floatbar_get_color(xfFloatbar* floatbar, char* rgb_value)
@@ -388,8 +388,8 @@ static unsigned long xf_floatbar_get_color(xfFloatbar* floatbar, char* rgb_value
static void xf_floatbar_event_expose(xfFloatbar* floatbar)
{
GC gc = NULL;
GC shape_gc = NULL;
GC gc = nullptr;
GC shape_gc = nullptr;
Pixmap pmap = 0;
XPoint shape[5] = WINPR_C_ARRAY_INIT;
XPoint border[5] = WINPR_C_ARRAY_INIT;
@@ -452,7 +452,7 @@ static void xf_floatbar_event_expose(xfFloatbar* floatbar)
WINPR_ASSERT(len <= INT32_MAX / 2);
const int fx = floatbar->width / 2 - (int)len * 2;
if (floatbar->fontSet != NULL)
if (floatbar->fontSet != nullptr)
{
XmbDrawString(display, floatbar->handle, floatbar->fontSet, gc, fx, 15, floatbar->title,
(int)len);
@@ -479,12 +479,12 @@ static xfFloatbarButton* xf_floatbar_get_button(xfFloatbar* floatbar, Window win
}
}
return NULL;
return nullptr;
}
static void xf_floatbar_button_update_positon(xfFloatbar* floatbar)
{
xfFloatbarButton* button = NULL;
xfFloatbarButton* button = nullptr;
WINPR_ASSERT(floatbar);
xfContext* xfc = floatbar->xfc;
const size_t size = ARRAYSIZE(floatbar->buttons);
@@ -525,7 +525,7 @@ static void xf_floatbar_button_event_expose(xfFloatbar* floatbar, Window window)
{
xfFloatbarButton* button = xf_floatbar_get_button(floatbar, window);
static unsigned char* bits;
GC gc = NULL;
GC gc = nullptr;
Pixmap pattern = 0;
xfContext* xfc = floatbar->xfc;
@@ -595,7 +595,7 @@ static void xf_floatbar_button_event_buttonpress(xfFloatbar* floatbar, const XBu
static void xf_floatbar_button_event_buttonrelease(xfFloatbar* floatbar, const XButtonEvent* event)
{
xfFloatbarButton* button = NULL;
xfFloatbarButton* button = nullptr;
WINPR_ASSERT(floatbar);
WINPR_ASSERT(event);
@@ -750,7 +750,7 @@ static void xf_floatbar_event_motionnotify(xfFloatbar* floatbar, const XMotionEv
static void xf_floatbar_button_event_focusin(xfFloatbar* floatbar, const XAnyEvent* event)
{
xfFloatbarButton* button = NULL;
xfFloatbarButton* button = nullptr;
WINPR_ASSERT(floatbar);
WINPR_ASSERT(event);
@@ -766,7 +766,7 @@ static void xf_floatbar_button_event_focusin(xfFloatbar* floatbar, const XAnyEve
static void xf_floatbar_button_event_focusout(xfFloatbar* floatbar, const XAnyEvent* event)
{
xfFloatbarButton* button = NULL;
xfFloatbarButton* button = nullptr;
WINPR_ASSERT(floatbar);
WINPR_ASSERT(event);
@@ -910,7 +910,7 @@ static void xf_floatbar_button_free(xfContext* xfc, xfFloatbarButton* button)
void xf_floatbar_free(xfFloatbar* floatbar)
{
size_t size = 0;
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!floatbar)
return;
@@ -924,7 +924,7 @@ void xf_floatbar_free(xfFloatbar* floatbar)
for (size_t i = 0; i < size; i++)
{
xf_floatbar_button_free(xfc, floatbar->buttons[i]);
floatbar->buttons[i] = NULL;
floatbar->buttons[i] = nullptr;
}
if (floatbar->handle)

View File

@@ -43,7 +43,7 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
UINT32 surfaceY = 0;
RECTANGLE_16 surfaceRect = WINPR_C_ARRAY_INIT;
UINT32 nbRects = 0;
const RECTANGLE_16* rects = NULL;
const RECTANGLE_16* rects = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(surface);
@@ -151,9 +151,9 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
{
UINT16 count = 0;
UINT status = CHANNEL_RC_OK;
UINT16* pSurfaceIds = NULL;
UINT16* pSurfaceIds = nullptr;
rdpGdi* gdi = (rdpGdi*)context->custom;
xfContext* xfc = NULL;
xfContext* xfc = nullptr;
if (!gdi)
return status;
@@ -202,8 +202,8 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y, UINT32 width, UINT32 he
UINT status = ERROR_INTERNAL_ERROR;
RECTANGLE_16 invalidRect = WINPR_C_ARRAY_INIT;
RECTANGLE_16 intersection = WINPR_C_ARRAY_INIT;
UINT16* pSurfaceIds = NULL;
RdpgfxClientContext* context = NULL;
UINT16* pSurfaceIds = nullptr;
RdpgfxClientContext* context = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(xfc->common.context.gdi);
@@ -298,7 +298,7 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
{
UINT ret = CHANNEL_RC_NO_MEMORY;
size_t size = 0;
xfGfxSurface* surface = NULL;
xfGfxSurface* surface = nullptr;
rdpGdi* gdi = (rdpGdi*)context->custom;
xfContext* xfc = (xfContext*)gdi->context;
surface = (xfGfxSurface*)calloc(1, sizeof(xfGfxSurface));
@@ -404,7 +404,7 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
return CHANNEL_RC_OK;
error_set_surface_data:
surface->image->data = NULL;
surface->image->data = nullptr;
XDestroyImage(surface->image);
error_surface_image:
winpr_aligned_free(surface->stage);
@@ -423,7 +423,7 @@ out_free:
static UINT xf_DeleteSurface(RdpgfxClientContext* context,
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
{
rdpCodecs* codecs = NULL;
rdpCodecs* codecs = nullptr;
UINT status = 0;
EnterCriticalSection(&context->mux);
@@ -443,7 +443,7 @@ static UINT xf_DeleteSurface(RdpgfxClientContext* context,
#ifdef WITH_GFX_H264
h264_context_free(surface->gdi.h264);
#endif
surface->image->data = NULL;
surface->image->data = nullptr;
XDestroyImage(surface->image);
winpr_aligned_free(surface->gdi.data);
winpr_aligned_free(surface->stage);
@@ -452,7 +452,7 @@ static UINT xf_DeleteSurface(RdpgfxClientContext* context,
free(surface);
}
status = context->SetSurfaceData(context, deleteSurface->surfaceId, NULL);
status = context->SetSurfaceData(context, deleteSurface->surfaceId, nullptr);
if (codecs && codecs->progressive)
progressive_delete_surface_context(codecs->progressive, deleteSurface->surfaceId);
@@ -503,8 +503,8 @@ static UINT xf_UpdateWindowFromSurface(RdpgfxClientContext* context, gdiGfxSurfa
void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx)
{
rdpGdi* gdi = NULL;
const rdpSettings* settings = NULL;
rdpGdi* gdi = nullptr;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(gfx);
@@ -528,7 +528,7 @@ void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx)
void xf_graphics_pipeline_uninit(xfContext* xfc, RdpgfxClientContext* gfx)
{
rdpGdi* gdi = NULL;
rdpGdi* gdi = nullptr;
WINPR_ASSERT(xfc);

View File

@@ -152,7 +152,7 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
if (xpointer->nCursors == xpointer->mCursors)
{
void* tmp2 = NULL;
void* tmp2 = nullptr;
xpointer->mCursors = (xpointer->mCursors == 0 ? 1 : xpointer->mCursors * 2);
tmp2 = realloc(xpointer->cursorWidths, sizeof(UINT32) * xpointer->mCursors);
@@ -272,7 +272,7 @@ static Window xf_Pointer_get_window(xfContext* xfc)
BOOL xf_pointer_update_scale(xfContext* xfc)
{
xfPointer* pointer = NULL;
xfPointer* pointer = nullptr;
WINPR_ASSERT(xfc);
pointer = xfc->pointer;
@@ -322,7 +322,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
rc = TRUE;
fail:
WLog_DBG(TAG, "%p", WINPR_CXX_COMPAT_CAST(const void*, rc ? pointer : NULL));
WLog_DBG(TAG, "%p", WINPR_CXX_COMPAT_CAST(const void*, rc ? pointer : nullptr));
return rc;
}
@@ -406,7 +406,7 @@ static BOOL xf_Pointer_SetNull(rdpContext* context)
nullcursor = XcursorImageLoadCursor(xfc->display, &ci);
}
xfc->pointer = NULL;
xfc->pointer = nullptr;
if ((handle) && (nullcursor != None))
XDefineCursor(xfc->display, handle, nullcursor);
@@ -424,7 +424,7 @@ static BOOL xf_Pointer_SetDefault(rdpContext* context)
xfContext* xfc = (xfContext*)context;
Window handle = xf_Pointer_get_window(xfc);
xf_lock_x11(xfc);
xfc->pointer = NULL;
xfc->pointer = nullptr;
if (handle)
XUndefineCursor(xfc->display, handle);

View File

@@ -135,12 +135,13 @@ static BOOL register_input_events(xfContext* xfc, Window window)
}
case XIValuatorClass:
{
static wLog* log = NULL;
static wLog* log = nullptr;
if (!log)
log = WLog_Get(TAG);
const XIValuatorClassInfo* t = (const XIValuatorClassInfo*)c_class;
char* name = t->label ? Safe_XGetAtomName(log, xfc->display, t->label) : NULL;
char* name =
t->label ? Safe_XGetAtomName(log, xfc->display, t->label) : nullptr;
WLog_Print(log, WLOG_DEBUG,
"%s device (id: %d) valuator %d label %s range %f - %f", dev->name,
@@ -155,7 +156,7 @@ static BOOL register_input_events(xfContext* xfc, Window window)
strncpy(devName, dev->name, ARRAYSIZE(devName) - 1);
CharLowerBuffA(devName, ARRAYSIZE(devName));
if (strstr(devName, "eraser") != NULL)
if (strstr(devName, "eraser") != nullptr)
{
if (freerdp_client_handle_pen(&xfc->common,
FREERDP_PEN_REGISTER |
@@ -164,8 +165,8 @@ static BOOL register_input_events(xfContext* xfc, Window window)
dev->deviceid, max_pressure))
WLog_DBG(TAG, "registered eraser");
}
else if (strstr(devName, "stylus") != NULL ||
strstr(devName, "pen") != NULL)
else if (strstr(devName, "stylus") != nullptr ||
strstr(devName, "pen") != nullptr)
{
if (freerdp_client_handle_pen(
&xfc->common, FREERDP_PEN_REGISTER | FREERDP_PEN_HAS_PRESSURE,
@@ -199,7 +200,7 @@ static BOOL register_raw_events(xfContext* xfc, Window window)
{
XIEventMask mask;
unsigned char mask_bytes[XIMaskLen(XI_LASTEVENT)] = WINPR_C_ARRAY_INIT;
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
@@ -289,7 +290,7 @@ int xf_input_init(xfContext* xfc, Window window)
static BOOL xf_input_is_duplicate(xfContext* xfc, const XGenericEventCookie* cookie)
{
const XIDeviceEvent* event = NULL;
const XIDeviceEvent* event = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(cookie);
@@ -305,7 +306,7 @@ static BOOL xf_input_is_duplicate(xfContext* xfc, const XGenericEventCookie* coo
static void xf_input_save_last_event(xfContext* xfc, const XGenericEventCookie* cookie)
{
const XIDeviceEvent* event = NULL;
const XIDeviceEvent* event = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(cookie);
@@ -894,7 +895,7 @@ int xf_input_init(xfContext* xfc, Window window)
int xf_input_handle_event(xfContext* xfc, const XEvent* event)
{
#ifdef WITH_XI
const rdpSettings* settings = NULL;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;

View File

@@ -504,7 +504,7 @@ static void xf_keyboard_modifier_map_free(xfContext* xfc)
if (xfc->modifierMap)
{
XFreeModifiermap(xfc->modifierMap);
xfc->modifierMap = NULL;
xfc->modifierMap = nullptr;
}
}
@@ -513,7 +513,7 @@ BOOL xf_keyboard_update_modifier_map(xfContext* xfc)
WINPR_ASSERT(xfc);
xf_keyboard_modifier_map_free(xfc);
xfc->modifierMap = XGetModifierMapping(xfc->display);
return xfc->modifierMap != NULL;
return xfc->modifierMap != nullptr;
}
static void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEvent* ev);
@@ -551,7 +551,7 @@ static void xf_keyboard_action_script_free(xfContext* xfc)
if (xfc->keyCombinations)
{
ArrayList_Free(xfc->keyCombinations);
xfc->keyCombinations = NULL;
xfc->keyCombinations = nullptr;
xfc->actionScriptExists = FALSE;
}
}
@@ -571,7 +571,7 @@ BOOL xf_keyboard_action_script_init(xfContext* xfc)
obj->fnObjectNew = winpr_ObjectStringClone;
obj->fnObjectFree = winpr_ObjectStringFree;
if (!run_action_script(xfc, "key", NULL, xf_action_script_append, NULL))
if (!run_action_script(xfc, "key", nullptr, xf_action_script_append, nullptr))
return FALSE;
return xf_event_action_script_init(xfc);
@@ -655,7 +655,7 @@ static int load_map_from_xkbfile(xfContext* xfc)
XkbDescPtr xkb = XkbGetMap(xfc->display, 0, XkbUseCoreKbd);
if (!xkb)
{
WLog_Print(xfc->log, WLOG_WARN, "XkbGetMap() == NULL");
WLog_Print(xfc->log, WLOG_WARN, "XkbGetMap() == nullptr");
return -3;
}
@@ -799,7 +799,7 @@ static BOOL compareKey(const struct x11_key_scancode_t* a, size_t counta,
BOOL xf_keyboard_init(xfContext* xfc)
{
rdpSettings* settings = NULL;
rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
@@ -1001,7 +1001,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven
break;
default:
{
XIM xim = XOpenIM(xfc->display, 0, 0, 0);
XIM xim = XOpenIM(xfc->display, nullptr, nullptr, nullptr);
if (!xim)
{
WLog_WARN(TAG, "Failed to XOpenIM");
@@ -1009,7 +1009,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven
else
{
XIC xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
NULL);
nullptr);
if (!xic)
{
WLog_WARN(TAG, "XCreateIC failed");
@@ -1261,7 +1261,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
const char* keyStr = XKeysymToString(keysym);
if (keyStr == 0)
if (keyStr == nullptr)
{
return 1;
}
@@ -1300,7 +1300,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
return 1;
(void)sprintf_s(command, sizeof(command), "key %s", combination);
if (!run_action_script(xfc, command, NULL, action_script_run, &status))
if (!run_action_script(xfc, command, nullptr, action_script_run, &status))
return -1;
return status;

View File

@@ -62,7 +62,7 @@ int xf_list_monitors(xfContext* xfc)
int major = 0;
int minor = 0;
int nmonitors = 0;
Display* display = XOpenDisplay(NULL);
Display* display = XOpenDisplay(nullptr);
if (!display)
{
@@ -118,7 +118,7 @@ int xf_list_monitors(xfContext* xfc)
static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
{
const rdpSettings* settings = NULL;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
@@ -149,13 +149,13 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
int _dummy_i = 0;
Window _dummy_w = 0;
UINT32 current_monitor = 0;
Screen* screen = NULL;
Screen* screen = nullptr;
#if defined WITH_XINERAMA || defined WITH_XRANDR
int major = 0;
int minor = 0;
#endif
#if defined(USABLE_XRANDR)
XRRMonitorInfo* rrmonitors = NULL;
XRRMonitorInfo* rrmonitors = nullptr;
BOOL useXRandr = FALSE;
#endif
@@ -412,7 +412,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
}
for (UINT32 i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_ATTRIBUTES* attrs = NULL;
MONITOR_ATTRIBUTES* attrs = nullptr;
if (!xf_is_monitor_id_active(xfc, i))
continue;

View File

@@ -117,7 +117,7 @@ BOOL xf_rail_enable_remoteapp_mode(xfContext* xfc)
xfc->remote_app = TRUE;
xfc->drawable = xf_CreateDummyWindow(xfc);
xf_DestroyDesktopWindow(xfc, xfc->window);
xfc->window = NULL;
xfc->window = nullptr;
gdi->suppressOutput = old;
}
@@ -413,7 +413,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
WCHAR* wc;
BYTE* b;
} cnv;
char* title = NULL;
char* title = nullptr;
cnv.b = windowState->titleInfo.string;
if (windowState->titleInfo.length == 0)
@@ -425,7 +425,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
}
}
else if (!(title = ConvertWCharNToUtf8Alloc(
cnv.wc, windowState->titleInfo.length / sizeof(WCHAR), NULL)))
cnv.wc, windowState->titleInfo.length / sizeof(WCHAR), nullptr)))
{
WLog_ERR(TAG, "failed to convert window title");
/* error handled below */
@@ -505,7 +505,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)
{
char* title = NULL;
char* title = nullptr;
union
{
WCHAR* wc;
@@ -522,7 +522,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
}
}
else if (!(title = ConvertWCharNToUtf8Alloc(
cnv.wc, windowState->titleInfo.length / sizeof(WCHAR), NULL)))
cnv.wc, windowState->titleInfo.length / sizeof(WCHAR), nullptr)))
{
WLog_ERR(TAG, "failed to convert window title");
return FALSE;
@@ -555,7 +555,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
if (appWindow->windowRects)
{
free(appWindow->windowRects);
appWindow->windowRects = NULL;
appWindow->windowRects = nullptr;
}
appWindow->numWindowRects = windowState->numWindowRects;
@@ -584,7 +584,7 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
if (appWindow->visibilityRects)
{
free(appWindow->visibilityRects);
appWindow->visibilityRects = NULL;
appWindow->visibilityRects = nullptr;
}
appWindow->numVisibilityRects = windowState->numVisibilityRects;
@@ -690,7 +690,7 @@ static xfRailIconCache* RailIconCache_New(rdpSettings* settings)
xfRailIconCache* cache = calloc(1, sizeof(xfRailIconCache));
if (!cache)
return NULL;
return nullptr;
cache->numCaches = freerdp_settings_get_uint32(settings, FreeRDP_RemoteAppNumIconCaches);
cache->numCacheEntries =
@@ -702,7 +702,7 @@ static xfRailIconCache* RailIconCache_New(rdpSettings* settings)
WLog_ERR(TAG, "failed to allocate icon cache %" PRIu32 " x %" PRIu32 " entries",
cache->numCaches, cache->numCacheEntries);
free(cache);
return NULL;
return nullptr;
}
return cache;
@@ -740,10 +740,10 @@ static xfRailIcon* RailIconCache_Lookup(xfRailIconCache* cache, UINT8 cacheId, U
return &cache->scratch;
if (cacheId >= cache->numCaches)
return NULL;
return nullptr;
if (cacheEntry >= cache->numCacheEntries)
return NULL;
return nullptr;
return &cache->entries[cache->numCacheEntries * cacheId + cacheEntry];
}
@@ -763,8 +763,8 @@ static BOOL convert_rail_icon(const ICON_INFO* iconInfo, xfRailIcon* railIcon)
WINPR_ASSERT(iconInfo);
WINPR_ASSERT(railIcon);
BYTE* nextPixel = NULL;
long* pixels = NULL;
BYTE* nextPixel = nullptr;
long* pixels = nullptr;
BYTE* argbPixels = calloc(1ull * iconInfo->width * iconInfo->height, 4);
if (!argbPixels)
@@ -1337,20 +1337,20 @@ int xf_rail_uninit(xfContext* xfc, RailClientContext* rail)
if (xfc->rail)
{
xfc->rail->custom = NULL;
xfc->rail = NULL;
xfc->rail->custom = nullptr;
xfc->rail = nullptr;
}
if (xfc->railWindows)
{
HashTable_Free(xfc->railWindows);
xfc->railWindows = NULL;
xfc->railWindows = nullptr;
}
if (xfc->railIconCache)
{
RailIconCache_Free(xfc->railIconCache);
xfc->railIconCache = NULL;
xfc->railIconCache = nullptr;
}
return 1;
@@ -1360,12 +1360,12 @@ xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, INT32 x, INT32 y, UIN
UINT32 height, UINT32 surfaceId)
{
if (!xfc)
return NULL;
return nullptr;
xfAppWindow* appWindow = (xfAppWindow*)calloc(1, sizeof(xfAppWindow));
if (!appWindow)
return NULL;
return nullptr;
appWindow->xfc = xfc;
appWindow->windowId = id;
@@ -1382,7 +1382,7 @@ xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, INT32 x, INT32 y, UIN
return appWindow;
fail:
rail_window_free(appWindow);
return NULL;
return nullptr;
}
BOOL xf_rail_del_window(xfContext* xfc, UINT64 id)
@@ -1399,10 +1399,10 @@ BOOL xf_rail_del_window(xfContext* xfc, UINT64 id)
xfAppWindow* xf_rail_get_window(xfContext* xfc, UINT64 id)
{
if (!xfc)
return NULL;
return nullptr;
if (!xfc->railWindows)
return NULL;
return nullptr;
HashTable_Lock(xfc->railWindows);
xfAppWindow* window = HashTable_GetItemValue(xfc->railWindows, &id);

View File

@@ -75,16 +75,16 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
int y = 0;
UINT32 width = 0;
UINT32 height = 0;
BYTE* data1 = NULL;
BYTE* data2 = NULL;
BYTE* data1 = nullptr;
BYTE* data2 = nullptr;
UINT32 pixfmt = 0;
UINT32 xvpixfmt = 0;
XvImage* image = NULL;
XvImage* image = nullptr;
int colorkey = 0;
int numRects = 0;
xfContext* xfc = NULL;
xfXvContext* xv = NULL;
XRectangle* xrects = NULL;
xfContext* xfc = nullptr;
xfXvContext* xv = nullptr;
XRectangle* xrects = nullptr;
XShmSegmentInfo shminfo;
BOOL converti420yv12 = FALSE;
@@ -110,7 +110,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
return -1002;
}
xrects = NULL;
xrects = nullptr;
numRects = event->numVisibleRects;
if (numRects > 0)
@@ -196,7 +196,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
if (xv->xv_image_size > 0)
{
shmdt(xv->xv_shmaddr);
shmctl(xv->xv_shmid, IPC_RMID, NULL);
shmctl(xv->xv_shmid, IPC_RMID, nullptr);
}
xv->xv_image_size = image->data_size;
@@ -316,10 +316,10 @@ static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
unsigned int error_base = 0;
unsigned int request_base = 0;
unsigned int num_adaptors = 0;
xfXvContext* xv = NULL;
XvAdaptorInfo* ai = NULL;
XvAttribute* attr = NULL;
XvImageFormatValues* fo = NULL;
xfXvContext* xv = nullptr;
XvAdaptorInfo* ai = nullptr;
XvAttribute* attr = nullptr;
XvImageFormatValues* fo = nullptr;
if (xfc->xv_context)
return 1; /* context already created */
@@ -386,7 +386,7 @@ static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
{
if (strcmp(attr[i].name, "XV_COLORKEY") == 0)
{
static wLog* log = NULL;
static wLog* log = nullptr;
if (!log)
log = WLog_Get(TAG);
xv->xv_colorkey_atom = Logging_XInternAtom(log, xfc->display, "XV_COLORKEY", FALSE);
@@ -438,21 +438,21 @@ static int xf_tsmf_xv_uninit(xfContext* xfc, TsmfClientContext* tsmf)
if (xv->xv_image_size > 0)
{
shmdt(xv->xv_shmaddr);
shmctl(xv->xv_shmid, IPC_RMID, NULL);
shmctl(xv->xv_shmid, IPC_RMID, nullptr);
}
if (xv->xv_pixfmts)
{
free(xv->xv_pixfmts);
xv->xv_pixfmts = NULL;
xv->xv_pixfmts = nullptr;
}
free(xv);
xfc->xv_context = NULL;
xfc->xv_context = nullptr;
}
if (xfc->tsmf)
{
xfc->tsmf->custom = NULL;
xfc->tsmf = NULL;
xfc->tsmf->custom = nullptr;
xfc->tsmf = nullptr;
}
return 1;

View File

@@ -219,14 +219,14 @@ BOOL IsGnome(void)
{
// NOLINTNEXTLINE(concurrency-mt-unsafe)
char* env = getenv("DESKTOP_SESSION");
return (env != NULL && strcmp(env, "gnome") == 0);
return (env != nullptr && strcmp(env, "gnome") == 0);
}
BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_action_script_run fkt,
void* user)
{
BOOL rc = FALSE;
FILE* keyScript = NULL;
FILE* keyScript = nullptr;
WINPR_ASSERT(xfc);
rdpSettings* settings = xfc->common.context.settings;
@@ -256,9 +256,9 @@ BOOL run_action_script(xfContext* xfc, const char* what, const char* arg, fn_act
{
BOOL read_data = FALSE;
char buffer[2048] = WINPR_C_ARRAY_INIT;
while (fgets(buffer, sizeof(buffer), keyScript) != NULL)
while (fgets(buffer, sizeof(buffer), keyScript) != nullptr)
{
char* context = NULL;
char* context = nullptr;
(void)strtok_s(buffer, "\n", &context);
if (fkt)
@@ -738,10 +738,10 @@ int LogDynAndXReparentWindow_ex(wLog* log, const char* file, const char* fkt, si
char* getConfigOption(BOOL system, const char* option)
{
char* res = NULL;
char* res = nullptr;
WINPR_JSON* file = freerdp_GetJSONConfigFile(system, "xfreerdp.json");
if (!file)
return NULL;
return nullptr;
WINPR_JSON* obj = WINPR_JSON_GetObjectItemCaseSensitive(file, option);
if (obj)

View File

@@ -37,13 +37,13 @@ typedef struct
static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, UINT32 x, UINT32 y,
UINT32 width, UINT32 height)
{
xfContext* xfc = NULL;
xfVideoSurface* ret = NULL;
xfContext* xfc = nullptr;
xfVideoSurface* ret = nullptr;
WINPR_ASSERT(video);
ret = (xfVideoSurface*)VideoClient_CreateCommonContext(sizeof(xfContext), x, y, width, height);
if (!ret)
return NULL;
return nullptr;
xfc = (xfContext*)video->custom;
WINPR_ASSERT(xfc);
@@ -57,7 +57,7 @@ static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, UINT32 x, U
{
WLog_ERR(TAG, "unable to create surface image");
VideoClient_DestroyCommonContext(&ret->base);
return NULL;
return nullptr;
}
return &ret->base;
@@ -68,8 +68,8 @@ static BOOL xfVideoShowSurface(VideoClientContext* video, const VideoSurface* su
WINPR_ATTR_UNUSED UINT32 destinationHeight)
{
const xfVideoSurface* xfSurface = (const xfVideoSurface*)surface;
xfContext* xfc = NULL;
const rdpSettings* settings = NULL;
xfContext* xfc = nullptr;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(video);
WINPR_ASSERT(xfSurface);

View File

@@ -132,7 +132,7 @@ static const char* window_style_to_string(UINT32 style)
ENTRY(WS_VISIBLE);
ENTRY(WS_VSCROLL);
default:
return NULL;
return nullptr;
}
}
@@ -187,7 +187,7 @@ static const char* window_style_ex_to_string(UINT32 styleEx)
ENTRY(WS_EX_TRANSPARENT);
ENTRY(WS_EX_WINDOWEDGE);
default:
return NULL;
return nullptr;
}
}
@@ -262,7 +262,7 @@ void xf_SetWindowMinimized(xfContext* xfc, xfWindow* window)
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
{
const rdpSettings* settings = NULL;
const rdpSettings* settings = nullptr;
int startX = 0;
int startY = 0;
UINT32 width = WINPR_ASSERTING_INT_CAST(uint32_t, window->width);
@@ -401,7 +401,7 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
BYTE state = 0;
unsigned long nitems = 0;
unsigned long bytes = 0;
BYTE* prop = NULL;
BYTE* prop = nullptr;
if (xf_GetWindowProperty(xfc, window->handle, xfc->NET_WM_STATE, 255, &nitems,
&bytes, &prop))
@@ -498,7 +498,7 @@ BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int leng
WLog_DBG(TAG, "Property %lu does not exist", (unsigned long)property);
if (*prop)
XFree(*prop);
*prop = NULL;
*prop = nullptr;
return FALSE;
}
@@ -509,7 +509,7 @@ static BOOL xf_GetNumberOfDesktops(xfContext* xfc, Window root, unsigned* pval)
{
unsigned long nitems = 0;
unsigned long bytes = 0;
BYTE* bprop = NULL;
BYTE* bprop = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(pval);
@@ -538,7 +538,7 @@ static BOOL xf_GetCurrentDesktop(xfContext* xfc, Window root)
{
unsigned long nitems = 0;
unsigned long bytes = 0;
BYTE* bprop = NULL;
BYTE* bprop = nullptr;
unsigned max = 0;
if (!xf_GetNumberOfDesktops(xfc, root, &max))
@@ -563,7 +563,7 @@ static BOOL xf_GetWorkArea_NET_WORKAREA(xfContext* xfc, Window root)
BOOL rc = FALSE;
unsigned long nitems = 0;
unsigned long bytes = 0;
BYTE* bprop = NULL;
BYTE* bprop = nullptr;
const BOOL status =
xf_GetWindowProperty(xfc, root, xfc->NET_WORKAREA, INT_MAX, &nitems, &bytes, &bprop);
@@ -656,11 +656,11 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
{
XEvent xevent = WINPR_C_ARRAY_INIT;
int input_mask = 0;
XClassHint* classHints = NULL;
XClassHint* classHints = nullptr;
xfWindow* window = (xfWindow*)calloc(1, sizeof(xfWindow));
if (!window)
return NULL;
return nullptr;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
@@ -698,7 +698,7 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
}
else
{
void* mem = mmap(0, sizeof(window->handle), PROT_READ | PROT_WRITE, MAP_SHARED,
void* mem = mmap(nullptr, sizeof(window->handle), PROT_READ | PROT_WRITE, MAP_SHARED,
window->shmid, 0);
if (mem == MAP_FAILED)
@@ -721,7 +721,7 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
{
classHints->res_name = "xfreerdp";
char* res_class = NULL;
char* res_class = nullptr;
const char* WmClass = freerdp_settings_get_string(settings, FreeRDP_WmClass);
if (WmClass)
res_class = _strdup(WmClass);
@@ -795,8 +795,8 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height)
{
XSizeHints* size_hints = NULL;
rdpSettings* settings = NULL;
XSizeHints* size_hints = nullptr;
rdpSettings* settings = nullptr;
if (!xfc || !window)
return;
@@ -839,7 +839,7 @@ void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window)
return;
if (xfc->window == window)
xfc->window = NULL;
xfc->window = nullptr;
xf_floatbar_free(window->floatbar);
@@ -853,7 +853,7 @@ void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window)
}
if (window->xfwin)
munmap(0, sizeof(*window->xfwin));
munmap(nullptr, sizeof(*window->xfwin));
if (window->shmid >= 0)
close(window->shmid);
@@ -1033,9 +1033,9 @@ BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
{
XGCValues gcv = WINPR_C_ARRAY_INIT;
int input_mask = 0;
XWMHints* InputModeHint = NULL;
XClassHint* class_hints = NULL;
const rdpSettings* settings = NULL;
XWMHints* InputModeHint = nullptr;
XClassHint* class_hints = nullptr;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
WINPR_ASSERT(appWindow);
@@ -1077,7 +1077,7 @@ BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
if (class_hints)
{
char* strclass = NULL;
char* strclass = nullptr;
const char* WmClass = freerdp_settings_get_string(settings, FreeRDP_WmClass);
if (WmClass)
@@ -1120,7 +1120,7 @@ void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, WINPR_ATTR_U
WINPR_ATTR_UNUSED int maxPosY, int minTrackWidth, int minTrackHeight,
int maxTrackWidth, int maxTrackHeight)
{
XSizeHints* size_hints = NULL;
XSizeHints* size_hints = nullptr;
size_hints = XAllocSizeHints();
if (size_hints)
@@ -1296,7 +1296,7 @@ void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rects, int nrects)
{
XRectangle* xrects = NULL;
XRectangle* xrects = nullptr;
if (nrects < 1)
return;
@@ -1321,7 +1321,7 @@ void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rec
void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
UINT32 rectsOffsetY, RECTANGLE_16* rects, int nrects)
{
XRectangle* xrects = NULL;
XRectangle* xrects = nullptr;
if (nrects < 1)
return;
@@ -1349,14 +1349,14 @@ void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow, int x, int y, i
{
int ax = 0;
int ay = 0;
const rdpSettings* settings = NULL;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
if (appWindow == NULL)
if (appWindow == nullptr)
return;
if (appWindow->surfaceId < UINT16_MAX)
@@ -1392,9 +1392,9 @@ void xf_AppWindowDestroyImage(xfAppWindow* appWindow)
WINPR_ASSERT(appWindow);
if (appWindow->image)
{
appWindow->image->data = NULL;
appWindow->image->data = nullptr;
XDestroyImage(appWindow->image);
appWindow->image = NULL;
appWindow->image = nullptr;
}
}
@@ -1404,7 +1404,7 @@ void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
return;
if (xfc->appWindow == appWindow)
xfc->appWindow = NULL;
xfc->appWindow = nullptr;
if (appWindow->gc)
LogDynAndXFreeGC(xfc->log, xfc->display, appWindow->gc);
@@ -1421,7 +1421,7 @@ void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
}
if (appWindow->xfwin)
munmap(0, sizeof(*appWindow->xfwin));
munmap(nullptr, sizeof(*appWindow->xfwin));
if (appWindow->shmid >= 0)
close(appWindow->shmid);
@@ -1437,11 +1437,11 @@ void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd)
{
ULONG_PTR* pKeys = NULL;
ULONG_PTR* pKeys = nullptr;
WINPR_ASSERT(xfc);
if (!xfc->railWindows)
return NULL;
return nullptr;
HashTable_Lock(xfc->railWindows);
size_t count = HashTable_GetKeys(xfc->railWindows, &pKeys);
@@ -1454,7 +1454,7 @@ xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd)
{
HashTable_Unlock(xfc->railWindows);
free(pKeys);
return NULL;
return nullptr;
}
if (appWindow->handle == wnd)
@@ -1467,12 +1467,12 @@ xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd)
HashTable_Unlock(xfc->railWindows);
free(pKeys);
return NULL;
return nullptr;
}
UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface)
{
XImage* image = NULL;
XImage* image = nullptr;
UINT rc = ERROR_INTERNAL_ERROR;
WINPR_ASSERT(xfc);

View File

@@ -739,10 +739,10 @@ static const XKB_VARIANT tm_variants[] = {
static const XKB_LAYOUT xkbLayouts[] = {
{ "us", KBD_US, us_variants }, /* USA */
{ "ad", 0, NULL }, /* Andorra */
{ "ad", 0, nullptr }, /* Andorra */
{ "af", KBD_FARSI, af_variants }, /* Afghanistan */
{ "ara", KBD_ARABIC_101, ara_variants }, /* Arabic */
{ "al", 0, NULL }, /* Albania */
{ "al", 0, nullptr }, /* Albania */
{ "am", KBD_ARMENIAN_EASTERN, am_variants }, /* Armenia */
{ "az", KBD_AZERI_CYRILLIC, az_variants }, /* Azerbaijan */
{ "by", KBD_BELARUSIAN, by_variants }, /* Belarus */
@@ -753,15 +753,15 @@ static const XKB_LAYOUT xkbLayouts[] = {
{ "br", KBD_PORTUGUESE_BRAZILIAN_ABNT, br_variants }, /* Brazil */
{ "bg", KBD_BULGARIAN_LATIN, bg_variants }, /* Bulgaria */
{ "ma", KBD_FRENCH, ma_variants }, /* Morocco */
{ "mm", 0, NULL }, /* Myanmar */
{ "mm", 0, nullptr }, /* Myanmar */
{ "ca", KBD_US, ca_variants }, /* Canada */
{ "cd", 0, NULL }, /* Congo, Democratic Republic of the */
{ "cd", 0, nullptr }, /* Congo, Democratic Republic of the */
{ "cn", KBD_CHINESE_TRADITIONAL_PHONETIC, cn_variants }, /* China */
{ "hr", KBD_CROATIAN, hr_variants }, /* Croatia */
{ "cz", KBD_CZECH, cz_variants }, /* Czechia */
{ "dk", KBD_DANISH, dk_variants }, /* Denmark */
{ "nl", KBD_DUTCH, nl_variants }, /* Netherlands */
{ "bt", 0, NULL }, /* Bhutan */
{ "bt", 0, nullptr }, /* Bhutan */
{ "ee", KBD_ESTONIAN, ee_variants }, /* Estonia */
{ "ir", 0, ir_variants }, /* Iran */
{ "iq", 0, iq_variants }, /* Iraq */
@@ -769,7 +769,7 @@ static const XKB_LAYOUT xkbLayouts[] = {
{ "fi", KBD_FINNISH, fi_variants }, /* Finland */
{ "fr", KBD_FRENCH, fr_variants }, /* France */
{ "gh", 0, gh_variants }, /* Ghana */
{ "gn", 0, NULL }, /* Guinea */
{ "gn", 0, nullptr }, /* Guinea */
{ "ge", KBD_GEORGIAN, ge_variants }, /* Georgia */
{ "at", KBD_GERMAN, de_variants }, /* Austria */
{ "de", KBD_GERMAN, de_variants }, /* Germany */
@@ -780,17 +780,17 @@ static const XKB_LAYOUT xkbLayouts[] = {
{ "it", KBD_ITALIAN, it_variants }, /* Italy */
{ "jp", KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002, jp_variants }, /* Japan */
{ "kg", 0, kg_variants }, /* Kyrgyzstan */
{ "kh", 0, NULL }, /* Cambodia */
{ "kh", 0, nullptr }, /* Cambodia */
{ "kz", KBD_KAZAKH, kz_variants }, /* Kazakhstan */
{ "la", 0, NULL }, /* Laos */
{ "la", 0, nullptr }, /* Laos */
{ "latam", KBD_LATIN_AMERICAN, latam_variants }, /* Latin America */
{ "lt", KBD_LITHUANIAN, lt_variants }, /* Lithuania */
{ "lv", KBD_LATVIAN, lv_variants }, /* Latvia */
{ "mao", KBD_MAORI, NULL }, /* Maori */
{ "mao", KBD_MAORI, nullptr }, /* Maori */
{ "me", KBD_SERBIAN_LATIN, me_variants }, /* Montenegro */
{ "mk", KBD_FYRO_MACEDONIAN, mk_variants }, /* Macedonia */
{ "mt", KBD_MALTESE_48_KEY, mt_variants }, /* Malta */
{ "mn", KBD_MONGOLIAN_CYRILLIC, NULL }, /* Mongolia */
{ "mn", KBD_MONGOLIAN_CYRILLIC, nullptr }, /* Mongolia */
{ "no", KBD_NORWEGIAN, no_variants }, /* Norway */
{ "pl", KBD_POLISH_PROGRAMMERS, pl_variants }, /* Poland */
{ "pt", KBD_PORTUGUESE, pt_variants }, /* Portugal */
@@ -810,17 +810,17 @@ static const XKB_LAYOUT xkbLayouts[] = {
{ "ua", KBD_UKRAINIAN, ua_variants }, /* Ukraine */
{ "gb", KBD_UNITED_KINGDOM, gb_variants }, /* United Kingdom */
{ "uz", KBD_UZBEK_CYRILLIC, uz_variants }, /* Uzbekistan */
{ "vn", KBD_VIETNAMESE, NULL }, /* Vietnam */
{ "vn", KBD_VIETNAMESE, nullptr }, /* Vietnam */
{ "kr", KBD_KOREAN_INPUT_SYSTEM_IME_2000, kr_variants }, /* Korea, Republic of */
{ "ie", KBD_UNITED_KINGDOM, ie_variants }, /* Ireland */
{ "pk", 0, pk_variants }, /* Pakistan */
{ "mv", 0, NULL }, /* Maldives */
{ "za", KBD_US, NULL }, /* South Africa */
{ "mv", 0, nullptr }, /* Maldives */
{ "za", KBD_US, nullptr }, /* South Africa */
{ "epo", 0, epo_variants }, /* Esperanto */
{ "np", KBD_NEPALI, NULL }, /* Nepal */
{ "np", KBD_NEPALI, nullptr }, /* Nepal */
{ "ng", 0, ng_variants }, /* Nigeria */
{ "et", 0, NULL }, /* Ethiopia */
{ "sn", 0, NULL }, /* Senegal */
{ "et", 0, nullptr }, /* Ethiopia */
{ "sn", 0, nullptr }, /* Senegal */
{ "brai", 0, brai_variants }, /* Braille */
{ "tm", KBD_TURKISH_Q, tm_variants }, /* Turkmenistan */
};
@@ -854,7 +854,7 @@ static UINT32 find_keyboard_layout_variant(const XKB_LAYOUT* layout, const char*
UINT32 xf_find_keyboard_layout_in_xorg_rules(const char* layout, const char* variant)
{
if ((layout == NULL) || (variant == NULL))
if ((layout == nullptr) || (variant == nullptr))
return 0;
DEBUG_X11("xkbLayout: %s\txkbVariant: %s", layout, variant);