From 465a6353d5b6d252087166a3393c96ef95f60673 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 26 Feb 2026 14:35:00 +0100 Subject: [PATCH] [c23,client] replace NULL with nullptr --- .../src/main/cpp/android_cliprdr.c | 20 +- .../freeRDPCore/src/main/cpp/android_event.c | 26 +- .../src/main/cpp/android_freerdp.c | 36 +- .../src/main/cpp/android_jni_callback.c | 2 +- .../src/main/cpp/android_jni_utils.c | 26 +- client/Mac/Clipboard.m | 18 +- client/Mac/Keyboard.m | 12 +- client/Mac/MRDPView.m | 24 +- client/Mac/PasswordDialog.m | 4 +- client/Mac/mf_client.m | 4 +- client/SDL/SDL3/sdl_pointer.cpp | 2 +- client/SDL/common/aad/sdl_webview.cpp | 5 +- client/Sample/tf_channels.c | 2 +- client/Sample/tf_freerdp.c | 16 +- client/Wayland/wlf_cliprdr.c | 38 +- client/Wayland/wlf_disp.c | 54 +- client/Wayland/wlf_input.c | 22 +- client/Wayland/wlf_pointer.c | 6 +- client/Wayland/wlfreerdp.c | 46 +- client/Windows/cli/wfreerdp.c | 10 +- client/Windows/wf_channels.c | 2 +- client/Windows/wf_client.c | 116 ++-- client/Windows/wf_cliprdr.c | 110 ++-- client/Windows/wf_defaults.c | 16 +- client/Windows/wf_event.c | 43 +- client/Windows/wf_floatbar.c | 59 ++- client/Windows/wf_gdi.c | 40 +- client/Windows/wf_graphics.c | 34 +- client/Windows/wf_rail.c | 54 +- client/X11/cli/xfreerdp.c | 8 +- client/X11/keyboard_x11.c | 8 +- client/X11/xf_channels.c | 4 +- client/X11/xf_client.c | 99 ++-- client/X11/xf_cliprdr.c | 160 +++--- client/X11/xf_disp.c | 62 +-- client/X11/xf_event.c | 28 +- client/X11/xf_floatbar.c | 52 +- client/X11/xf_gfx.c | 26 +- client/X11/xf_graphics.c | 10 +- client/X11/xf_input.c | 19 +- client/X11/xf_keyboard.c | 20 +- client/X11/xf_monitor.c | 10 +- client/X11/xf_rail.c | 44 +- client/X11/xf_tsmf.c | 36 +- client/X11/xf_utils.c | 12 +- client/X11/xf_video.c | 12 +- client/X11/xf_window.c | 68 +-- client/X11/xkb_layout_ids.c | 34 +- client/common/client.c | 144 ++--- client/common/client_cliprdr_file.c | 146 +++--- client/common/cmdline.c | 296 +++++------ client/common/cmdline.h | 494 +++++++++--------- client/common/file.c | 138 ++--- client/common/geometry.c | 6 +- client/common/man/generate_argument_manpage.c | 30 +- client/common/smartcard_cli.c | 2 +- client/common/sso_mib_tokens.c | 37 +- client/common/test/TestClientChannels.c | 22 +- client/common/test/TestClientCmdLine.c | 40 +- client/common/test/TestClientRdpFile.c | 44 +- client/iOS/FreeRDP/ios_cliprdr.m | 20 +- client/iOS/FreeRDP/ios_freerdp.m | 16 +- client/iOS/FreeRDP/ios_freerdp_events.m | 2 +- client/iOS/FreeRDP/ios_freerdp_ui.m | 2 +- client/iOS/Misc/Reachability.m | 29 +- client/iOS/Misc/SFHFKeychainUtils.m | 20 +- client/iOS/Misc/Utils.m | 6 +- client/iOS/Models/Encryptor.m | 2 +- client/iOS/Models/RDPSession.m | 6 +- 69 files changed, 1544 insertions(+), 1517 deletions(-) diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c index c8950281c..b93e189f1 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c @@ -51,7 +51,7 @@ UINT android_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr) if (!afc || !afc->cliprdr) return ERROR_INVALID_PARAMETER; - pFormatIds = NULL; + pFormatIds = nullptr; numFormats = ClipboardGetFormatIds(afc->clipboard, &pFormatIds); formats = (CLIPRDR_FORMAT*)calloc(numFormats, sizeof(CLIPRDR_FORMAT)); @@ -63,7 +63,7 @@ UINT android_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr) formatId = pFormatIds[index]; formatName = ClipboardGetFormatName(afc->clipboard, formatId); formats[index].formatId = formatId; - formats[index].formatName = NULL; + formats[index].formatName = nullptr; if ((formatId > CF_MAX) && formatName) { @@ -222,7 +222,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr, free(afc->serverFormats[index].formatName); free(afc->serverFormats); - afc->serverFormats = NULL; + afc->serverFormats = nullptr; afc->numServerFormats = 0; } @@ -238,7 +238,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr, for (UINT32 index = 0; index < afc->numServerFormats; index++) { afc->serverFormats[index].formatId = formatList->formats[index].formatId; - afc->serverFormats[index].formatName = NULL; + afc->serverFormats[index].formatName = nullptr; if (formatList->formats[index].formatName) { @@ -352,7 +352,7 @@ android_cliprdr_server_format_data_request(CliprdrClientContext* cliprdr, { response.common.msgFlags = CB_RESPONSE_FAIL; response.common.dataLen = 0; - response.requestedFormatData = NULL; + response.requestedFormatData = nullptr; } rc = cliprdr->ClientFormatDataResponse(cliprdr, &response); @@ -369,7 +369,7 @@ static UINT android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse) { - CLIPRDR_FORMAT* format = NULL; + CLIPRDR_FORMAT* format = nullptr; if (!cliprdr || !formatDataResponse) return ERROR_INVALID_PARAMETER; @@ -409,7 +409,7 @@ android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, if ((formatId == CF_TEXT) || (formatId == CF_UNICODETEXT)) { - JNIEnv* env = NULL; + JNIEnv* env = nullptr; formatId = ClipboardRegisterFormat(afc->clipboard, "text/plain"); char* data = (char*)ClipboardGetData(afc->clipboard, formatId, &size); jboolean attached = jni_attach_thread(&env); @@ -462,7 +462,7 @@ BOOL android_cliprdr_init(androidContext* afc, CliprdrClientContext* cliprdr) if (!afc || !cliprdr) return FALSE; - if (!(hevent = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (!(hevent = CreateEvent(nullptr, TRUE, FALSE, nullptr))) return FALSE; if (!(clipboard = ClipboardCreate())) @@ -493,8 +493,8 @@ BOOL android_cliprdr_uninit(androidContext* afc, CliprdrClientContext* cliprdr) if (!afc || !cliprdr) return FALSE; - cliprdr->custom = NULL; - afc->cliprdr = NULL; + cliprdr->custom = nullptr; + afc->cliprdr = nullptr; ClipboardDestroy(afc->clipboard); (void)CloseHandle(afc->clipboardRequestEvent); return TRUE; diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c index 5a9fb2421..f0a2ea2be 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c @@ -55,7 +55,7 @@ static ANDROID_EVENT* android_peek_event(ANDROID_EVENT_QUEUE* queue) ANDROID_EVENT* event; if (queue->count < 1) - return NULL; + return nullptr; event = queue->events[0]; return event; @@ -66,7 +66,7 @@ static ANDROID_EVENT* android_pop_event(ANDROID_EVENT_QUEUE* queue) ANDROID_EVENT* event; if (queue->count < 1) - return NULL; + return nullptr; event = queue->events[0]; (queue->count)--; @@ -160,12 +160,12 @@ HANDLE android_get_handle(freerdp* inst) androidContext* aCtx; if (!inst || !inst->context) - return NULL; + return nullptr; aCtx = (androidContext*)inst->context; if (!aCtx->event_queue || !aCtx->event_queue->isSet) - return NULL; + return nullptr; return aCtx->event_queue->isSet; } @@ -199,7 +199,7 @@ ANDROID_EVENT_KEY* android_event_key_new(int flags, UINT16 scancode) ANDROID_EVENT_KEY* event = (ANDROID_EVENT_KEY*)calloc(1, sizeof(ANDROID_EVENT_KEY)); if (!event) - return NULL; + return nullptr; event->type = EVENT_TYPE_KEY; event->flags = flags; @@ -218,7 +218,7 @@ ANDROID_EVENT_KEY* android_event_unicodekey_new(UINT16 flags, UINT16 key) event = (ANDROID_EVENT_KEY*)calloc(1, sizeof(ANDROID_EVENT_KEY)); if (!event) - return NULL; + return nullptr; event->type = EVENT_TYPE_KEY_UNICODE; event->flags = flags; @@ -237,7 +237,7 @@ ANDROID_EVENT_CURSOR* android_event_cursor_new(UINT16 flags, UINT16 x, UINT16 y) event = (ANDROID_EVENT_CURSOR*)calloc(1, sizeof(ANDROID_EVENT_CURSOR)); if (!event) - return NULL; + return nullptr; event->type = EVENT_TYPE_CURSOR; event->x = x; @@ -257,7 +257,7 @@ ANDROID_EVENT* android_event_disconnect_new(void) event = (ANDROID_EVENT*)calloc(1, sizeof(ANDROID_EVENT)); if (!event) - return NULL; + return nullptr; event->type = EVENT_TYPE_DISCONNECT; return event; @@ -274,7 +274,7 @@ ANDROID_EVENT_CLIPBOARD* android_event_clipboard_new(const void* data, size_t da event = (ANDROID_EVENT_CLIPBOARD*)calloc(1, sizeof(ANDROID_EVENT_CLIPBOARD)); if (!event) - return NULL; + return nullptr; event->type = EVENT_TYPE_CLIPBOARD; @@ -285,7 +285,7 @@ ANDROID_EVENT_CLIPBOARD* android_event_clipboard_new(const void* data, size_t da if (!event->data) { free(event); - return NULL; + return nullptr; } memcpy(event->data, data, data_length); @@ -318,7 +318,7 @@ BOOL android_event_queue_init(freerdp* inst) queue->size = 16; queue->count = 0; - queue->isSet = CreateEventA(NULL, TRUE, FALSE, NULL); + queue->isSet = CreateEventA(nullptr, TRUE, FALSE, nullptr); if (!queue->isSet) { @@ -356,13 +356,13 @@ void android_event_queue_uninit(freerdp* inst) if (queue->isSet) { (void)CloseHandle(queue->isSet); - queue->isSet = NULL; + queue->isSet = nullptr; } if (queue->events) { free(queue->events); - queue->events = NULL; + queue->events = nullptr; queue->size = 0; queue->count = 0; } diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_freerdp.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_freerdp.c index 1ef1a5de4..9e06851b5 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_freerdp.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_freerdp.c @@ -419,7 +419,7 @@ static int android_freerdp_run(freerdp* instance) DWORD count; DWORD status = WAIT_FAILED; HANDLE handles[MAXIMUM_WAIT_OBJECTS]; - HANDLE inputEvent = NULL; + HANDLE inputEvent = nullptr; const rdpSettings* settings = instance->context->settings; rdpContext* context = instance->context; @@ -536,7 +536,7 @@ static BOOL android_client_new(freerdp* instance, rdpContext* context) instance->GatewayAuthenticate = android_gw_authenticate; instance->VerifyCertificateEx = android_verify_certificate_ex; instance->VerifyChangedCertificateEx = android_verify_changed_certificate_ex; - instance->LogonErrorInfo = NULL; + instance->LogonErrorInfo = nullptr; return TRUE; } @@ -556,13 +556,13 @@ static int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints) pEntryPoints->Version = RDP_CLIENT_INTERFACE_VERSION; pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1); - pEntryPoints->GlobalInit = NULL; - pEntryPoints->GlobalUninit = NULL; + pEntryPoints->GlobalInit = nullptr; + pEntryPoints->GlobalUninit = nullptr; pEntryPoints->ContextSize = sizeof(androidContext); pEntryPoints->ClientNew = android_client_new; pEntryPoints->ClientFree = android_client_free; - pEntryPoints->ClientStart = NULL; - pEntryPoints->ClientStop = NULL; + pEntryPoints->ClientStart = nullptr; + pEntryPoints->ClientStop = nullptr; return 0; } @@ -590,7 +590,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp { WLog_FATAL(TAG, "Failed to load class references %s=%p, %s=%p", JAVA_CONTEXT_CLASS, (void*)contextClass, JAVA_FILE_CLASS, (void*)fileClass); - return (jlong)NULL; + return (jlong) nullptr; } getFilesDirID = @@ -599,7 +599,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!getFilesDirID) { WLog_FATAL(TAG, "Failed to find method ID getFilesDir ()L" JAVA_FILE_CLASS ";"); - return (jlong)NULL; + return (jlong) nullptr; } getAbsolutePathID = @@ -608,7 +608,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!getAbsolutePathID) { WLog_FATAL(TAG, "Failed to find method ID getAbsolutePath ()Ljava/lang/String;"); - return (jlong)NULL; + return (jlong) nullptr; } filesDirObj = (*env)->CallObjectMethod(env, context, getFilesDirID); @@ -616,7 +616,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!filesDirObj) { WLog_FATAL(TAG, "Failed to call getFilesDir"); - return (jlong)NULL; + return (jlong) nullptr; } path = (*env)->CallObjectMethod(env, filesDirObj, getAbsolutePathID); @@ -624,7 +624,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!path) { WLog_FATAL(TAG, "Failed to call getAbsolutePath"); - return (jlong)NULL; + return (jlong) nullptr; } raw = (*env)->GetStringUTFChars(env, path, 0); @@ -632,7 +632,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!raw) { WLog_FATAL(TAG, "Failed to get C string from java string"); - return (jlong)NULL; + return (jlong) nullptr; } envStr = _strdup(raw); @@ -641,7 +641,7 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp if (!envStr) { WLog_FATAL(TAG, "_strdup(%s) failed", raw); - return (jlong)NULL; + return (jlong) nullptr; } if (setenv("HOME", _strdup(envStr), 1) != 0) @@ -649,14 +649,14 @@ JNIEXPORT jlong JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp char ebuffer[256] = WINPR_C_ARRAY_INIT; WLog_FATAL(TAG, "Failed to set environment HOME=%s %s [%d]", envStr, winpr_strerror(errno, ebuffer, sizeof(ebuffer)), errno); - return (jlong)NULL; + return (jlong) nullptr; } RdpClientEntry(&clientEntryPoints); ctx = freerdp_client_context_new(&clientEntryPoints); if (!ctx) - return (jlong)NULL; + return (jlong) nullptr; return (jlong)ctx->instance; } @@ -739,7 +739,7 @@ JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_free androidContext* ctx = (androidContext*)inst->context; - if (!(ctx->thread = CreateThread(NULL, 0, android_thread_func, inst, 0, NULL))) + if (!(ctx->thread = CreateThread(nullptr, 0, android_thread_func, inst, 0, nullptr))) { return JNI_FALSE; } @@ -927,7 +927,7 @@ Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1send_1clipboard_1data( { ANDROID_EVENT* event; freerdp* inst = (freerdp*)instance; - const char* data = jdata != NULL ? (*env)->GetStringUTFChars(env, jdata, NULL) : NULL; + const char* data = jdata != nullptr ? (*env)->GetStringUTFChars(env, jdata, nullptr) : nullptr; const size_t data_length = data ? (*env)->GetStringUTFLength(env, jdata) : 0; jboolean ret = JNI_FALSE; event = (ANDROID_EVENT*)android_event_clipboard_new((void*)data, data_length); @@ -987,7 +987,7 @@ Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1get_1build_1config(JNI return (*env)->NewStringUTF(env, freerdp_get_build_config()); } -static jclass gJavaActivityClass = NULL; +static jclass gJavaActivityClass = nullptr; jint JNI_OnLoad(JavaVM* vm, void* reserved) { diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_callback.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_callback.c index 31384a515..9d964fcfd 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_callback.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_callback.c @@ -74,7 +74,7 @@ jboolean jni_attach_thread(JNIEnv** env) if ((*jVM)->GetEnv(jVM, (void**)env, JNI_VERSION_1_4) != JNI_OK) { WLog_DBG(TAG, "android_java_callback: attaching current thread"); - (*jVM)->AttachCurrentThread(jVM, env, NULL); + (*jVM)->AttachCurrentThread(jVM, env, nullptr); if ((*jVM)->GetEnv(jVM, (void**)env, JNI_VERSION_1_4) != JNI_OK) { diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_utils.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_utils.c index 929f6402a..0a21510e7 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_utils.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_jni_utils.c @@ -29,11 +29,11 @@ JavaVM* getJavaVM() JNIEnv* getJNIEnv() { - JNIEnv* env = NULL; + JNIEnv* env = nullptr; if ((*g_JavaVm)->GetEnv(g_JavaVm, (void**)&env, JNI_VERSION_1_4) != JNI_OK) { WLog_FATAL(TAG, "Failed to obtain JNIEnv"); - return NULL; + return nullptr; } return env; } @@ -47,14 +47,14 @@ jobject create_string_builder(JNIEnv* env, char* initialStr) // get class cls = (*env)->FindClass(env, "java/lang/StringBuilder"); if (!cls) - return NULL; + return nullptr; if (initialStr) { // get method id for constructor methodId = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V"); if (!methodId) - return NULL; + return nullptr; // create string that holds our initial string jstring jstr = (*env)->NewStringUTF(env, initialStr); @@ -67,7 +67,7 @@ jobject create_string_builder(JNIEnv* env, char* initialStr) // get method id for constructor methodId = (*env)->GetMethodID(env, cls, "", "()V"); if (!methodId) - return NULL; + return nullptr; // construct new StringBuilder obj = (*env)->NewObject(env, cls, methodId); @@ -87,20 +87,20 @@ char* get_string_from_string_builder(JNIEnv* env, jobject strBuilder) // get class cls = (*env)->FindClass(env, "java/lang/StringBuilder"); if (!cls) - return NULL; + return nullptr; // get method id for constructor methodId = (*env)->GetMethodID(env, cls, "toString", "()Ljava/lang/String;"); if (!methodId) - return NULL; + return nullptr; // get jstring representation of our buffer strObj = (*env)->CallObjectMethod(env, strBuilder, methodId); // read string - native_str = (*env)->GetStringUTFChars(env, strObj, NULL); + native_str = (*env)->GetStringUTFChars(env, strObj, nullptr); if (!native_str) - return NULL; + return nullptr; result = _strdup(native_str); (*env)->ReleaseStringUTFChars(env, strObj, native_str); @@ -109,14 +109,14 @@ char* get_string_from_string_builder(JNIEnv* env, jobject strBuilder) jstring jniNewStringUTF(JNIEnv* env, const char* in, int len) { - jstring out = NULL; - jchar* unicode = NULL; + jstring out = nullptr; + jchar* unicode = nullptr; jint result_size = 0; unsigned char* utf8 = (unsigned char*)in; if (!in) { - return NULL; + return nullptr; } if (len < 0) len = strlen(in); @@ -124,7 +124,7 @@ jstring jniNewStringUTF(JNIEnv* env, const char* in, int len) unicode = (jchar*)malloc(sizeof(jchar) * (len + 1)); if (!unicode) { - return NULL; + return nullptr; } for (jint i = 0; i < len; i++) diff --git a/client/Mac/Clipboard.m b/client/Mac/Clipboard.m index 11f336593..1562f32ea 100644 --- a/client/Mac/Clipboard.m +++ b/client/Mac/Clipboard.m @@ -34,7 +34,7 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr) mfContext *mfc = (mfContext *)cliprdr->custom; WINPR_ASSERT(mfc); - pFormatIds = NULL; + pFormatIds = nullptr; numFormats = ClipboardGetFormatIds(mfc->clipboard, &pFormatIds); formats = (CLIPRDR_FORMAT *)calloc(numFormats, sizeof(CLIPRDR_FORMAT)); @@ -48,7 +48,7 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr) formatName = ClipboardGetFormatName(mfc->clipboard, formatId); formats[index].formatId = formatId; - formats[index].formatName = NULL; + formats[index].formatName = nullptr; if ((formatId > CF_MAX) && formatName) formats[index].formatName = _strdup(formatName); @@ -193,7 +193,7 @@ static UINT mac_cliprdr_server_format_list(CliprdrClientContext *cliprdr, } free(mfc->serverFormats); - mfc->serverFormats = NULL; + mfc->serverFormats = nullptr; mfc->numServerFormats = 0; } @@ -209,7 +209,7 @@ static UINT mac_cliprdr_server_format_list(CliprdrClientContext *cliprdr, for (UINT32 index = 0; index < mfc->numServerFormats; index++) { mfc->serverFormats[index].formatId = formatList->formats[index].formatId; - mfc->serverFormats[index].formatName = NULL; + mfc->serverFormats[index].formatName = nullptr; if (formatList->formats[index].formatName) mfc->serverFormats[index].formatName = _strdup(formatList->formats[index].formatName); @@ -305,7 +305,7 @@ mac_cliprdr_server_format_data_request(CliprdrClientContext *cliprdr, { response.common.msgFlags = CB_RESPONSE_FAIL; response.common.dataLen = 0; - response.requestedFormatData = NULL; + response.requestedFormatData = nullptr; } cliprdr->ClientFormatDataResponse(cliprdr, &response); @@ -325,7 +325,7 @@ mac_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr, const CLIPRDR_FORMAT_DATA_RESPONSE *formatDataResponse) { UINT32 formatId; - CLIPRDR_FORMAT *format = NULL; + CLIPRDR_FORMAT *format = nullptr; mfContext *mfc = (mfContext *)cliprdr->custom; MRDPView *view = (MRDPView *)mfc->view; @@ -409,7 +409,7 @@ void mac_cliprdr_init(mfContext *mfc, CliprdrClientContext *cliprdr) mfc->cliprdr = cliprdr; mfc->clipboard = ClipboardCreate(); - mfc->clipboardRequestEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + mfc->clipboardRequestEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); cliprdr->MonitorReady = mac_cliprdr_monitor_ready; cliprdr->ServerCapabilities = mac_cliprdr_server_capabilities; @@ -425,8 +425,8 @@ void mac_cliprdr_init(mfContext *mfc, CliprdrClientContext *cliprdr) void mac_cliprdr_uninit(mfContext *mfc, CliprdrClientContext *cliprdr) { - cliprdr->custom = NULL; - mfc->cliprdr = NULL; + cliprdr->custom = nullptr; + mfc->cliprdr = nullptr; ClipboardDestroy(mfc->clipboard); (void)CloseHandle(mfc->clipboardRequestEvent); diff --git a/client/Mac/Keyboard.m b/client/Mac/Keyboard.m index 625142d56..31682d1d5 100644 --- a/client/Mac/Keyboard.m +++ b/client/Mac/Keyboard.m @@ -158,9 +158,9 @@ static enum APPLE_KEYBOARD_TYPE mac_identify_keyboard_type(uint32_t vendorID, ui enum APPLE_KEYBOARD_TYPE mac_detect_keyboard_type(void) { - CFSetRef deviceCFSetRef = NULL; - IOHIDDeviceRef inIOHIDDeviceRef = NULL; - IOHIDManagerRef tIOHIDManagerRef = NULL; + CFSetRef deviceCFSetRef = nullptr; + IOHIDDeviceRef inIOHIDDeviceRef = nullptr; + IOHIDManagerRef tIOHIDManagerRef = nullptr; IOHIDDeviceRef *tIOHIDDeviceRefs = nil; enum APPLE_KEYBOARD_TYPE type = APPLE_KEYBOARD_TYPE_ANSI; tIOHIDManagerRef = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); @@ -168,7 +168,7 @@ enum APPLE_KEYBOARD_TYPE mac_detect_keyboard_type(void) if (!tIOHIDManagerRef) return type; - IOHIDManagerSetDeviceMatching(tIOHIDManagerRef, NULL); + IOHIDManagerSetDeviceMatching(tIOHIDManagerRef, nullptr); IOReturn tIOReturn = IOHIDManagerOpen(tIOHIDManagerRef, kIOHIDOptionsTypeNone); if (noErr != tIOReturn) @@ -187,7 +187,7 @@ enum APPLE_KEYBOARD_TYPE mac_detect_keyboard_type(void) CFSetGetValues(deviceCFSetRef, (const void **)tIOHIDDeviceRefs); CFRelease(deviceCFSetRef); - deviceCFSetRef = NULL; + deviceCFSetRef = nullptr; for (deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) { @@ -230,7 +230,7 @@ enum APPLE_KEYBOARD_TYPE mac_detect_keyboard_type(void) if (deviceCFSetRef) { CFRelease(deviceCFSetRef); - deviceCFSetRef = NULL; + deviceCFSetRef = nullptr; } if (tIOHIDManagerRef) diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index de2905fad..2d9a20d5c 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -112,7 +112,7 @@ static CGContextRef mac_create_bitmap_context(rdpContext *context); mfc->client_width = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth); if (!(mfc->common.thread = - CreateThread(NULL, 0, mac_client_thread, (void *)context, 0, &mfc->mainThreadId))) + CreateThread(nullptr, 0, mac_client_thread, (void *)context, 0, &mfc->mainThreadId))) { WLog_ERR(TAG, "failed to create client thread"); return -1; @@ -577,7 +577,7 @@ static BOOL updateFlagState(rdpInput *input, DWORD modFlags, DWORD aKbdModFlags, BOOL press = ((modFlags & flag) != 0) && ((aKbdModFlags & flag) == 0); BOOL release = ((modFlags & flag) == 0) && ((aKbdModFlags & flag) != 0); DWORD keyFlags = 0; - const char *name = NULL; + const char *name = nullptr; DWORD scancode = 0; if ((modFlags & flag) == (aKbdModFlags & flag)) @@ -988,9 +988,9 @@ static BOOL mac_show_auth_dialog(MRDPView *view, NSString *title, char **usernam free(*username); free(*password); free(*domain); - *username = NULL; - *password = NULL; - *domain = NULL; + *username = nullptr; + *password = nullptr; + *domain = nullptr; dispatch_sync(dispatch_get_main_queue(), ^{ [dialog performSelectorOnMainThread:@selector(runModal:) @@ -1045,7 +1045,7 @@ static BOOL mac_authenticate_raw(freerdp *instance, char **username, char **pass const rdpSettings *settings = instance->context->settings; mfContext *mfc = (mfContext *)instance->context; MRDPView *view = (MRDPView *)mfc->view; - NSString *title = NULL; + NSString *title = nullptr; switch (reason) { @@ -1106,9 +1106,9 @@ fail: free(*username); free(*domain); free(*password); - *username = NULL; - *domain = NULL; - *password = NULL; + *username = nullptr; + *domain = nullptr; + *password = nullptr; return FALSE; } @@ -1263,10 +1263,10 @@ BOOL mf_Pointer_New(rdpContext *context, rdpPointer *pointer) if (!freerdp_image_copy_from_pointer_data(cursor_data, format, 0, 0, 0, pointer->width, pointer->height, pointer->xorMaskData, pointer->lengthXorMask, pointer->andMaskData, - pointer->lengthAndMask, pointer->xorBpp, NULL)) + pointer->lengthAndMask, pointer->xorBpp, nullptr)) { free(cursor_data); - mrdpCursor->cursor_data = NULL; + mrdpCursor->cursor_data = nullptr; return FALSE; } @@ -1476,7 +1476,7 @@ BOOL mac_desktop_resize(rdpContext *context) * resize, and then continue with post-resizing graphical updates. */ CGContextRef old_context = view->bitmap_context; - view->bitmap_context = NULL; + view->bitmap_context = nullptr; CGContextRelease(old_context); mfc->width = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth); mfc->height = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight); diff --git a/client/Mac/PasswordDialog.m b/client/Mac/PasswordDialog.m index aabb102a2..7217794e6 100644 --- a/client/Mac/PasswordDialog.m +++ b/client/Mac/PasswordDialog.m @@ -72,8 +72,8 @@ - (IBAction)onOK:(NSObject *)sender { - char *submittedUser = NULL; - char *submittedDomain = NULL; + char *submittedUser = nullptr; + char *submittedDomain = nullptr; if (freerdp_parse_username( [self.usernameText.stringValue cStringUsingEncoding:NSUTF8StringEncoding], diff --git a/client/Mac/mf_client.m b/client/Mac/mf_client.m index 1dcc1577c..f88209e33 100644 --- a/client/Mac/mf_client.m +++ b/client/Mac/mf_client.m @@ -48,7 +48,7 @@ static int mfreerdp_client_start(rdpContext *context) MRDPView *view; mfContext *mfc = (mfContext *)context; - if (mfc->view == NULL) + if (mfc->view == nullptr) { // view not specified beforehand. Create view dynamically mfc->view = [[MRDPView alloc] @@ -90,7 +90,7 @@ static BOOL mfreerdp_client_new(freerdp *instance, rdpContext *context) mfc = (mfContext *)instance->context; WINPR_ASSERT(mfc); - mfc->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + mfc->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); if (!mfc->stopEvent) return FALSE; context->instance->PreConnect = mac_pre_connect; diff --git a/client/SDL/SDL3/sdl_pointer.cpp b/client/SDL/SDL3/sdl_pointer.cpp index ebc5ac39e..c8a0e83f2 100644 --- a/client/SDL/SDL3/sdl_pointer.cpp +++ b/client/SDL/SDL3/sdl_pointer.cpp @@ -166,7 +166,7 @@ bool sdl_Pointer_Set_Process(SdlContext* sdl) auto fw = sdl->getFirstWindow(); if (!fw) { - WLog_Print(sdl->getWLog(), WLOG_ERROR, "sdl->getFirstWindow() NULL"); + WLog_Print(sdl->getWLog(), WLOG_ERROR, "sdl->getFirstWindow() nullptr"); return false; } diff --git a/client/SDL/common/aad/sdl_webview.cpp b/client/SDL/common/aad/sdl_webview.cpp index f5f37b514..5940f562f 100644 --- a/client/SDL/common/aad/sdl_webview.cpp +++ b/client/SDL/common/aad/sdl_webview.cpp @@ -36,7 +36,7 @@ static std::string from_settings(const rdpSettings* settings, FreeRDP_Settings_K auto val = freerdp_settings_get_string(settings, id); if (!val) { - WLog_WARN(TAG, "Settings key %s is NULL", freerdp_settings_get_name_for_key(id)); + WLog_WARN(TAG, "Settings key %s is nullptr", freerdp_settings_get_name_for_key(id)); return ""; } return val; @@ -48,7 +48,8 @@ static std::string from_aad_wellknown(rdpContext* context, AAD_WELLKNOWN_VALUES if (!val) { - WLog_WARN(TAG, "[wellknown] key %s is NULL", freerdp_utils_aad_wellknwon_value_name(which)); + WLog_WARN(TAG, "[wellknown] key %s is nullptr", + freerdp_utils_aad_wellknwon_value_name(which)); return ""; } return val; diff --git a/client/Sample/tf_channels.c b/client/Sample/tf_channels.c index efd451d5e..16556093c 100644 --- a/client/Sample/tf_channels.c +++ b/client/Sample/tf_channels.c @@ -66,7 +66,7 @@ void tf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect { CliprdrClientContext* clip = (CliprdrClientContext*)e->pInterface; WINPR_ASSERT(clip); - clip->custom = NULL; + clip->custom = nullptr; } else freerdp_client_OnChannelDisconnectedEventHandler(&tf->common, e); diff --git a/client/Sample/tf_freerdp.c b/client/Sample/tf_freerdp.c index ce16edfc4..d8e33d0a7 100644 --- a/client/Sample/tf_freerdp.c +++ b/client/Sample/tf_freerdp.c @@ -51,7 +51,7 @@ * It can be used to reset invalidated areas. */ static BOOL tf_begin_paint(rdpContext* context) { - rdpGdi* gdi = NULL; + rdpGdi* gdi = nullptr; WINPR_ASSERT(context); @@ -71,7 +71,7 @@ static BOOL tf_begin_paint(rdpContext* context) */ static BOOL tf_end_paint(rdpContext* context) { - rdpGdi* gdi = NULL; + rdpGdi* gdi = nullptr; WINPR_ASSERT(context); @@ -95,8 +95,8 @@ static BOOL tf_end_paint(rdpContext* context) static BOOL tf_desktop_resize(rdpContext* context) { - rdpGdi* gdi = NULL; - rdpSettings* settings = NULL; + rdpGdi* gdi = nullptr; + rdpSettings* settings = nullptr; WINPR_ASSERT(context); @@ -144,7 +144,7 @@ static BOOL tf_keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 * Set all configuration options to support and load channels here. */ static BOOL tf_pre_connect(freerdp* instance) { - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; WINPR_ASSERT(instance); WINPR_ASSERT(instance->context); @@ -185,7 +185,7 @@ static BOOL tf_pre_connect(freerdp* instance) */ static BOOL tf_post_connect(freerdp* instance) { - rdpContext* context = NULL; + rdpContext* context = nullptr; if (!gdi_init(instance, PIXEL_FORMAT_XRGB32)) return FALSE; @@ -215,7 +215,7 @@ static BOOL tf_post_connect(freerdp* instance) */ static void tf_post_disconnect(freerdp* instance) { - tfContext* context = NULL; + tfContext* context = nullptr; if (!instance) return; @@ -309,7 +309,7 @@ static void tf_client_global_uninit(void) static int tf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type) { - tfContext* tf = NULL; + tfContext* tf = nullptr; const char* str_data = freerdp_get_logon_error_info_data(data); const char* str_type = freerdp_get_logon_error_info_type(type); diff --git a/client/Wayland/wlf_cliprdr.c b/client/Wayland/wlf_cliprdr.c index c0c56fa7d..88419a948 100644 --- a/client/Wayland/wlf_cliprdr.c +++ b/client/Wayland/wlf_cliprdr.c @@ -123,7 +123,7 @@ static void* wlf_request_clone(const void* oth) const wlf_request* other = (const wlf_request*)oth; wlf_request* copy = wlf_request_new(); if (!copy) - return NULL; + return nullptr; *copy = *other; if (other->responseMime) { @@ -134,7 +134,7 @@ static void* wlf_request_clone(const void* oth) return copy; fail: wlf_request_free(copy); - return NULL; + return nullptr; } static BOOL wlf_mime_is_file(const char* mime) @@ -186,7 +186,7 @@ static void wlf_cliprdr_free_server_formats(wfClipboard* clipboard) } free(clipboard->serverFormats); - clipboard->serverFormats = NULL; + clipboard->serverFormats = nullptr; clipboard->numServerFormats = 0; } @@ -205,7 +205,7 @@ static void wlf_cliprdr_free_client_formats(wfClipboard* clipboard) } free(clipboard->clientFormats); - clipboard->clientFormats = NULL; + clipboard->clientFormats = nullptr; clipboard->numClientFormats = 0; } @@ -245,7 +245,7 @@ static UINT wlf_cliprdr_send_client_format_list(wfClipboard* clipboard) static void wfl_cliprdr_add_client_format_id(wfClipboard* clipboard, UINT32 formatId) { - CLIPRDR_FORMAT* format = NULL; + CLIPRDR_FORMAT* format = nullptr; const char* name = ClipboardGetFormatName(clipboard->system, formatId); for (size_t x = 0; x < clipboard->numClientFormats; x++) @@ -265,7 +265,7 @@ static void wfl_cliprdr_add_client_format_id(wfClipboard* clipboard, UINT32 form clipboard->clientFormats = format; format = &clipboard->clientFormats[clipboard->numClientFormats++]; format->formatId = formatId; - format->formatName = NULL; + format->formatName = nullptr; if (name && (formatId >= CF_MAX)) format->formatName = _strdup(name); @@ -515,7 +515,7 @@ static const char* wlf_get_server_format_name(const wfClipboard* clipboard, UINT if (format->formatId == formatId) return format->formatName; } - return NULL; + return nullptr; } static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char* mime, int fd) @@ -550,7 +550,7 @@ static void wlf_cliprdr_transfer_data(UwacSeat* seat, void* context, const char* request.responseFormat = CF_DIB; } - if (request.responseMime != NULL) + if (request.responseMime != nullptr) { request.responseFile = fdopen(fd, "w"); @@ -614,7 +614,7 @@ static UINT wlf_cliprdr_server_format_list(CliprdrClientContext* context, if (!clipboard->seat) { WLog_Print(clipboard->log, WLOG_ERROR, - "clipboard->seat=NULL, check your client implementation"); + "clipboard->seat=nullptr, check your client implementation"); return ERROR_INTERNAL_ERROR; } @@ -724,15 +724,15 @@ wlf_cliprdr_server_format_data_request(CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest) { UINT rc = CHANNEL_RC_OK; - char* data = NULL; + char* data = nullptr; size_t size = 0; - const char* mime = NULL; + const char* mime = nullptr; UINT32 formatId = 0; UINT32 localFormatId = 0; - wfClipboard* clipboard = 0; + wfClipboard* clipboard = nullptr; UINT32 dsize = 0; - BYTE* ddata = NULL; + BYTE* ddata = nullptr; WINPR_ASSERT(context); WINPR_ASSERT(formatDataRequest); @@ -795,7 +795,7 @@ wlf_cliprdr_server_format_data_request(CliprdrClientContext* context, free(data); UINT32 len = 0; - data = NULL; + data = nullptr; if (res) data = ClipboardGetData(clipboard->system, formatId, &len); @@ -855,7 +855,7 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context, ClipboardLock(clipboard->system); EnterCriticalSection(&clipboard->lock); { - BYTE* cdata = NULL; + BYTE* cdata = nullptr; UINT32 srcFormatId = 0; UINT32 dstFormatId = 0; switch (request->responseFormat) @@ -933,8 +933,8 @@ fail: wfClipboard* wlf_clipboard_new(wlfContext* wfc) { - rdpChannels* channels = NULL; - wfClipboard* clipboard = NULL; + rdpChannels* channels = nullptr; + wfClipboard* clipboard = nullptr; WINPR_ASSERT(wfc); @@ -974,7 +974,7 @@ wfClipboard* wlf_clipboard_new(wlfContext* wfc) fail: wlf_clipboard_free(clipboard); - return NULL; + return nullptr; } void wlf_clipboard_free(wfClipboard* clipboard) @@ -1019,7 +1019,7 @@ BOOL wlf_cliprdr_uninit(wfClipboard* clipboard, CliprdrClientContext* cliprdr) return FALSE; if (cliprdr) - cliprdr->custom = NULL; + cliprdr->custom = nullptr; return TRUE; } diff --git a/client/Wayland/wlf_disp.c b/client/Wayland/wlf_disp.c index cdeb8bad3..ff92fa576 100644 --- a/client/Wayland/wlf_disp.c +++ b/client/Wayland/wlf_disp.c @@ -55,7 +55,7 @@ static UINT wlf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monit static BOOL wlf_disp_settings_changed(wlfDispContext* wlfDisp) { - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; WINPR_ASSERT(wlfDisp); WINPR_ASSERT(wlfDisp->wlc); @@ -89,7 +89,7 @@ static BOOL wlf_disp_settings_changed(wlfDispContext* wlfDisp) static BOOL wlf_update_last_sent(wlfDispContext* wlfDisp) { - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; WINPR_ASSERT(wlfDisp); WINPR_ASSERT(wlfDisp->wlc); @@ -114,9 +114,9 @@ static uint64_t wlf_disp_OnTimer(rdpContext* context, WINPR_ATTR_UNUSED void* us WINPR_ATTR_UNUSED FreeRDP_TimerID timerID, WINPR_ATTR_UNUSED uint64_t timestamp, uint64_t interval) { - wlfContext* wlc = NULL; - wlfDispContext* wlfDisp = NULL; - rdpSettings* settings = NULL; + wlfContext* wlc = nullptr; + wlfDispContext* wlfDisp = nullptr; + rdpSettings* settings = nullptr; if (!wlf_disp_check_context(context, &wlc, &wlfDisp, &settings)) return interval; @@ -137,7 +137,7 @@ static BOOL update_timer(wlfDispContext* wlfDisp, uint64_t intervalNS) { rdpContext* context = &wlfDisp->wlc->common.context; - wlfDisp->timerID = freerdp_timer_add(context, intervalNS, wlf_disp_OnTimer, NULL, true); + wlfDisp->timerID = freerdp_timer_add(context, intervalNS, wlf_disp_OnTimer, nullptr, true); } return TRUE; } @@ -145,8 +145,8 @@ static BOOL update_timer(wlfDispContext* wlfDisp, uint64_t intervalNS) BOOL wlf_disp_sendResize(wlfDispContext* wlfDisp, BOOL fromTimer) { DISPLAY_CONTROL_MONITOR_LAYOUT layout; - wlfContext* wlc = NULL; - rdpSettings* settings = NULL; + wlfContext* wlc = nullptr; + rdpSettings* settings = nullptr; if (!wlfDisp || !wlfDisp->wlc) return FALSE; @@ -209,7 +209,7 @@ static BOOL wlf_disp_set_window_resizable(WINPR_ATTR_UNUSED wlfDispContext* wlfD BOOL wlf_disp_check_context(void* context, wlfContext** ppwlc, wlfDispContext** ppwlfDisp, rdpSettings** ppSettings) { - wlfContext* wlc = NULL; + wlfContext* wlc = nullptr; if (!context) return FALSE; @@ -230,9 +230,9 @@ BOOL wlf_disp_check_context(void* context, wlfContext** ppwlc, wlfDispContext** static void wlf_disp_OnActivated(void* context, const ActivatedEventArgs* e) { - wlfContext* wlc = NULL; - wlfDispContext* wlfDisp = NULL; - rdpSettings* settings = NULL; + wlfContext* wlc = nullptr; + wlfDispContext* wlfDisp = nullptr; + rdpSettings* settings = nullptr; if (!wlf_disp_check_context(context, &wlc, &wlfDisp, &settings)) return; @@ -252,9 +252,9 @@ static void wlf_disp_OnActivated(void* context, const ActivatedEventArgs* e) static void wlf_disp_OnGraphicsReset(void* context, const GraphicsResetEventArgs* e) { - wlfContext* wlc = NULL; - wlfDispContext* wlfDisp = NULL; - rdpSettings* settings = NULL; + wlfContext* wlc = nullptr; + wlfDispContext* wlfDisp = nullptr; + rdpSettings* settings = nullptr; WINPR_UNUSED(e); if (!wlf_disp_check_context(context, &wlc, &wlfDisp, &settings)) @@ -271,19 +271,19 @@ static void wlf_disp_OnGraphicsReset(void* context, const GraphicsResetEventArgs wlfDispContext* wlf_disp_new(wlfContext* wlc) { - wlfDispContext* ret = NULL; - wPubSub* pubSub = NULL; - rdpSettings* settings = NULL; + wlfDispContext* ret = nullptr; + wPubSub* pubSub = nullptr; + rdpSettings* settings = nullptr; if (!wlc || !wlc->common.context.settings || !wlc->common.context.pubSub) - return NULL; + return nullptr; settings = wlc->common.context.settings; pubSub = wlc->common.context.pubSub; ret = calloc(1, sizeof(wlfDispContext)); if (!ret) - return NULL; + return nullptr; ret->wlc = wlc; ret->lastSentWidth = ret->targetWidth = @@ -313,9 +313,9 @@ void wlf_disp_free(wlfDispContext* disp) UINT wlf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, size_t nmonitors) { UINT ret = CHANNEL_RC_OK; - DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = NULL; - wlfDispContext* wlfDisp = NULL; - rdpSettings* settings = NULL; + DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = nullptr; + wlfDispContext* wlfDisp = nullptr; + rdpSettings* settings = nullptr; WINPR_ASSERT(disp); WINPR_ASSERT(monitors); @@ -400,8 +400,8 @@ static UINT wlf_DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitor UINT32 maxMonitorAreaFactorA, UINT32 maxMonitorAreaFactorB) { /* we're called only if dynamic resolution update is activated */ - wlfDispContext* wlfDisp = NULL; - rdpSettings* settings = NULL; + wlfDispContext* wlfDisp = nullptr; + rdpSettings* settings = nullptr; WINPR_ASSERT(disp); @@ -427,7 +427,7 @@ static UINT wlf_DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitor BOOL wlf_disp_init(wlfDispContext* wlfDisp, DispClientContext* disp) { - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; if (!wlfDisp || !wlfDisp->wlc || !disp) return FALSE; @@ -453,7 +453,7 @@ BOOL wlf_disp_uninit(wlfDispContext* wlfDisp, DispClientContext* disp) if (!wlfDisp || !disp) return FALSE; - wlfDisp->disp = NULL; + wlfDisp->disp = nullptr; return TRUE; } diff --git a/client/Wayland/wlf_input.c b/client/Wayland/wlf_input.c index 53f263b71..27a8b7050 100644 --- a/client/Wayland/wlf_input.c +++ b/client/Wayland/wlf_input.c @@ -59,7 +59,7 @@ BOOL wlf_handle_pointer_enter(freerdp* instance, const UwacPointerEnterLeaveEven { uint32_t x = 0; uint32_t y = 0; - rdpClientContext* cctx = NULL; + rdpClientContext* cctx = nullptr; if (!instance || !ev) return FALSE; @@ -78,7 +78,7 @@ BOOL wlf_handle_pointer_enter(freerdp* instance, const UwacPointerEnterLeaveEven BOOL wlf_handle_pointer_motion(freerdp* instance, const UwacPointerMotionEvent* ev) { - rdpClientContext* cctx = NULL; + rdpClientContext* cctx = nullptr; if (!instance || !ev) return FALSE; @@ -99,7 +99,7 @@ BOOL wlf_handle_pointer_motion(freerdp* instance, const UwacPointerMotionEvent* BOOL wlf_handle_pointer_buttons(freerdp* instance, const UwacPointerButtonEvent* ev) { - rdpClientContext* cctx = NULL; + rdpClientContext* cctx = nullptr; UINT16 flags = 0; UINT16 xflags = 0; @@ -161,7 +161,7 @@ BOOL wlf_handle_pointer_buttons(freerdp* instance, const UwacPointerButtonEvent* BOOL wlf_handle_pointer_axis(freerdp* instance, const UwacPointerAxisEvent* ev) { - wlfContext* context = NULL; + wlfContext* context = nullptr; if (!instance || !instance->context || !ev) return FALSE; @@ -171,7 +171,7 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, const UwacPointerAxisEvent* ev) BOOL wlf_handle_pointer_axis_discrete(freerdp* instance, const UwacPointerAxisEvent* ev) { - wlfContext* context = NULL; + wlfContext* context = nullptr; if (!instance || !instance->context || !ev) return FALSE; @@ -182,7 +182,7 @@ BOOL wlf_handle_pointer_axis_discrete(freerdp* instance, const UwacPointerAxisEv static BOOL wlf_handle_wheel(freerdp* instance, uint32_t x, uint32_t y, uint32_t axis, int32_t value) { - rdpClientContext* cctx = NULL; + rdpClientContext* cctx = nullptr; UINT16 flags = 0; int32_t direction = 0; uint32_t avalue = (uint32_t)abs(value); @@ -239,7 +239,7 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev { BOOL success = TRUE; BOOL handle = FALSE; - wlfContext* context = NULL; + wlfContext* context = nullptr; enum wl_pointer_axis_source source = WL_POINTER_AXIS_SOURCE_CONTINUOUS; if (!instance || !ev || !instance->context) @@ -308,7 +308,7 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev BOOL wlf_handle_pointer_source(freerdp* instance, const UwacPointerSourceEvent* ev) { - wlfContext* context = NULL; + wlfContext* context = nullptr; if (!instance || !instance->context || !ev) return FALSE; @@ -341,7 +341,7 @@ BOOL wlf_handle_key(freerdp* instance, const UwacKeyEvent* ev) BOOL wlf_handle_ungrab_key(freerdp* instance, const UwacKeyEvent* ev) { - wlfContext* context = NULL; + wlfContext* context = nullptr; if (!instance || !instance->context || !ev) return FALSE; @@ -361,9 +361,9 @@ BOOL wlf_keyboard_enter(freerdp* instance, const UwacKeyboardEnterLeaveEvent* ev BOOL wlf_keyboard_modifiers(freerdp* instance, const UwacKeyboardModifiersEvent* ev) { - rdpInput* input = NULL; + rdpInput* input = nullptr; UINT16 syncFlags = 0; - wlfContext* wlf = NULL; + wlfContext* wlf = nullptr; if (!instance || !ev) return FALSE; diff --git a/client/Wayland/wlf_pointer.c b/client/Wayland/wlf_pointer.c index 5bef4d854..0bc414f10 100644 --- a/client/Wayland/wlf_pointer.c +++ b/client/Wayland/wlf_pointer.c @@ -70,7 +70,7 @@ static BOOL wlf_Pointer_Set(rdpContext* context, rdpPointer* pointer) { wlfContext* wlf = (wlfContext*)context; wlfPointer* ptr = (wlfPointer*)pointer; - void* data = NULL; + void* data = nullptr; size_t size = 0; UwacReturnCode rc = UWAC_ERROR_INTERNAL; BOOL res = FALSE; @@ -121,7 +121,7 @@ static BOOL wlf_Pointer_SetNull(rdpContext* context) if (!wlf || !wlf->seat) return FALSE; - if (UwacSeatSetMouseCursor(wlf->seat, NULL, 0, 0, 0, 0, 0) != UWAC_SUCCESS) + if (UwacSeatSetMouseCursor(wlf->seat, nullptr, 0, 0, 0, 0, 0) != UWAC_SUCCESS) return FALSE; return TRUE; @@ -134,7 +134,7 @@ static BOOL wlf_Pointer_SetDefault(rdpContext* context) if (!wlf || !wlf->seat) return FALSE; - if (UwacSeatSetMouseCursor(wlf->seat, NULL, 1, 0, 0, 0, 0) != UWAC_SUCCESS) + if (UwacSeatSetMouseCursor(wlf->seat, nullptr, 1, 0, 0, 0, 0) != UWAC_SUCCESS) return FALSE; return TRUE; diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c index ad1343a27..3cb8527ad 100644 --- a/client/Wayland/wlfreerdp.c +++ b/client/Wayland/wlfreerdp.c @@ -51,8 +51,8 @@ static BOOL wl_update_buffer(wlfContext* context_w, INT32 ix, INT32 iy, INT32 iw, INT32 ih) { BOOL res = FALSE; - rdpGdi* gdi = NULL; - char* data = NULL; + rdpGdi* gdi = nullptr; + char* data = nullptr; UwacSize geometry = WINPR_C_ARRAY_INIT; size_t stride = 0; UwacReturnCode rc = UWAC_ERROR_INTERNAL; @@ -152,7 +152,7 @@ static BOOL wl_end_paint(rdpContext* context) static BOOL wl_refresh_display(wlfContext* context) { - rdpGdi* gdi = NULL; + rdpGdi* gdi = nullptr; if (!context || !context->common.context.gdi) return FALSE; @@ -176,9 +176,9 @@ static BOOL wl_resize_display(rdpContext* context) static BOOL wl_pre_connect(freerdp* instance) { - rdpSettings* settings = NULL; - wlfContext* context = NULL; - const UwacOutput* output = NULL; + rdpSettings* settings = nullptr; + wlfContext* context = nullptr; + const UwacOutput* output = nullptr; UwacSize resolution; if (!instance) @@ -206,7 +206,7 @@ static BOOL wl_pre_connect(freerdp* instance) // Use the resolution of the first display output output = UwacDisplayGetOutput(context->display, 0); - if ((output != NULL) && (UwacOutputGetResolution(output, &resolution) == UWAC_SUCCESS)) + if ((output != nullptr) && (UwacOutputGetResolution(output, &resolution) == UWAC_SUCCESS)) { if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, (UINT32)resolution.width)) @@ -276,7 +276,7 @@ static BOOL wl_post_connect(freerdp* instance) return FALSE; UwacWindowSetFullscreenState( - context->window, NULL, + context->window, nullptr, freerdp_settings_get_bool(instance->context->settings, FreeRDP_Fullscreen)); UwacWindowSetTitle(context->window, title); UwacWindowSetAppId(context->window, app_id); @@ -317,13 +317,13 @@ static void wl_post_disconnect(freerdp* instance) if (context->window) UwacDestroyWindow(&context->window); freerdp_keyboard_remap_free(context->remap_table); - context->remap_table = NULL; + context->remap_table = nullptr; } static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) { UwacEvent event; - wlfContext* context = NULL; + wlfContext* context = nullptr; if (UwacDisplayDispatch(display, 1) < 0) return FALSE; @@ -343,7 +343,7 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) break; case UWAC_EVENT_REMOVED_SEAT: - context->seat = NULL; + context->seat = nullptr; break; case UWAC_EVENT_FRAME_DONE: @@ -465,12 +465,12 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display) static BOOL handle_window_events(freerdp* instance) { - return instance != NULL; + return instance != nullptr; } static int wlfreerdp_run(freerdp* instance) { - wlfContext* context = NULL; + wlfContext* context = nullptr; HANDLE handles[MAXIMUM_WAIT_OBJECTS] = WINPR_C_ARRAY_INIT; DWORD status = WAIT_ABANDONED; @@ -560,7 +560,7 @@ static void wlf_client_global_uninit(void) static int wlf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type) { - wlfContext* wlf = NULL; + wlfContext* wlf = nullptr; const char* str_data = freerdp_get_logon_error_info_data(data); const char* str_type = freerdp_get_logon_error_info_type(type); @@ -590,19 +590,19 @@ static void wlf_client_free(freerdp* instance, rdpContext* context) static void* uwac_event_clone(const void* val) { - UwacEvent* copy = NULL; + UwacEvent* copy = nullptr; const UwacEvent* ev = (const UwacEvent*)val; copy = calloc(1, sizeof(UwacEvent)); if (!copy) - return NULL; + return nullptr; *copy = *ev; return copy; } static BOOL wlf_client_new(freerdp* instance, rdpContext* context) { - wObject* obj = NULL; + wObject* obj = nullptr; UwacReturnCode status = UWAC_ERROR_INTERNAL; wlfContext* wfl = (wlfContext*)context; @@ -614,12 +614,12 @@ static BOOL wlf_client_new(freerdp* instance, rdpContext* context) instance->PostDisconnect = wl_post_disconnect; instance->LogonErrorInfo = wlf_logon_error_info; wfl->log = WLog_Get(TAG); - wfl->display = UwacOpenDisplay(NULL, &status); + wfl->display = UwacOpenDisplay(nullptr, &status); if (!wfl->display || (status != UWAC_SUCCESS) || !wfl->log) return FALSE; - wfl->displayHandle = CreateFileDescriptorEvent(NULL, FALSE, FALSE, + wfl->displayHandle = CreateFileDescriptorEvent(nullptr, FALSE, FALSE, UwacDisplayGetFd(wfl->display), WINPR_FD_READ); if (!wfl->displayHandle) @@ -665,9 +665,9 @@ int main(int argc, char* argv[]) int rc = -1; int status = 0; RDP_CLIENT_ENTRY_POINTS clientEntryPoints; - rdpContext* context = NULL; - rdpSettings* settings = NULL; - wlfContext* wlc = NULL; + rdpContext* context = nullptr; + rdpSettings* settings = nullptr; + wlfContext* wlc = nullptr; freerdp_client_warn_deprecated(argc, argv); @@ -758,7 +758,7 @@ BOOL wlf_scale_coordinates(rdpContext* context, UINT32* px, UINT32* py, BOOL fro rdpGdi* gdi = context->gdi; - if (UwacWindowGetDrawingBufferGeometry(wlf->window, &geometry, NULL) != UWAC_SUCCESS) + if (UwacWindowGetDrawingBufferGeometry(wlf->window, &geometry, nullptr) != UWAC_SUCCESS) return FALSE; const double sx = 1.0 * geometry.width / (double)gdi->width; diff --git a/client/Windows/cli/wfreerdp.c b/client/Windows/cli/wfreerdp.c index 02d95b4b9..dfc6f66c1 100644 --- a/client/Windows/cli/wfreerdp.c +++ b/client/Windows/cli/wfreerdp.c @@ -49,11 +49,11 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine rdpContext* context; rdpSettings* settings; LPWSTR cmd; - char** argv = NULL; + char** argv = nullptr; RDP_CLIENT_ENTRY_POINTS clientEntryPoints = WINPR_C_ARRAY_INIT; int ret = 1; int argc = 0; - LPWSTR* args = NULL; + LPWSTR* args = nullptr; WINPR_UNUSED(hInstance); WINPR_UNUSED(hPrevInstance); @@ -83,7 +83,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine for (int i = 0; i < argc; i++) { - int size = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, NULL, 0, NULL, NULL); + int size = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, nullptr, 0, nullptr, nullptr); if (size <= 0) goto out; argv[i] = calloc((size_t)size, sizeof(char)); @@ -91,7 +91,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine if (!argv[i]) goto out; - if (WideCharToMultiByte(CP_UTF8, 0, args[i], -1, argv[i], size, NULL, NULL) != size) + if (WideCharToMultiByte(CP_UTF8, 0, args[i], -1, argv[i], size, nullptr, nullptr) != size) goto out; } @@ -147,6 +147,6 @@ out: #ifdef WITH_WIN_CONSOLE int main() { - return WinMain(NULL, NULL, NULL, 0); + return WinMain(nullptr, nullptr, nullptr, 0); } #endif diff --git a/client/Windows/wf_channels.c b/client/Windows/wf_channels.c index 69c99efef..65e7154d3 100644 --- a/client/Windows/wf_channels.c +++ b/client/Windows/wf_channels.c @@ -79,7 +79,7 @@ void wf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnect } else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) { - wfc->disp = NULL; + wfc->disp = nullptr; } else freerdp_client_OnChannelDisconnectedEventHandler(context, e); diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index 241143ba8..e2459b9d6 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -87,7 +87,7 @@ static BOOL wf_end_paint(rdpContext* context) RECT updateRect = WINPR_C_ARRAY_INIT; REGION16 invalidRegion = WINPR_C_ARRAY_INIT; RECTANGLE_16 invalidRect = WINPR_C_ARRAY_INIT; - const RECTANGLE_16* extents = NULL; + const RECTANGLE_16* extents = nullptr; WINPR_ASSERT(context); @@ -195,12 +195,12 @@ static BOOL wf_desktop_resize(rdpContext* context) wfc->primary = wf_image_new(wfc, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth), freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), - context->gdi->dstFormat, NULL); + context->gdi->dstFormat, nullptr); } if (!gdi_resize_ex(context->gdi, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth), freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), 0, - context->gdi->dstFormat, wfc->primary->pdata, NULL)) + context->gdi->dstFormat, wfc->primary->pdata, nullptr)) return FALSE; if (same) @@ -291,7 +291,7 @@ static BOOL wf_pre_connect(freerdp* instance) ULONG rc = 0; errno = 0; - rc = strtoul(name, NULL, 16); + rc = strtoul(name, nullptr, 16); if (errno == 0) keyboardLayoutId = rc; } @@ -364,25 +364,25 @@ static void wf_add_system_menu(wfContext* wfc) static WCHAR* wf_window_get_title(rdpSettings* settings) { BOOL port; - WCHAR* windowTitle = NULL; + WCHAR* windowTitle = nullptr; size_t size; WCHAR prefix[] = L"FreeRDP:"; if (!settings) - return NULL; + return nullptr; const char* name = freerdp_settings_get_string(settings, FreeRDP_ServerHostname); if (freerdp_settings_get_string(settings, FreeRDP_WindowTitle)) return ConvertUtf8ToWCharAlloc(freerdp_settings_get_string(settings, FreeRDP_WindowTitle), - NULL); + nullptr); port = (freerdp_settings_get_uint32(settings, FreeRDP_ServerPort) != 3389); size = strlen(name) + 16 + wcslen(prefix); windowTitle = calloc(size, sizeof(WCHAR)); if (!windowTitle) - return NULL; + return nullptr; if (!port) _snwprintf_s(windowTitle, size, _TRUNCATE, L"%s %S", prefix, name); @@ -417,7 +417,7 @@ static BOOL wf_post_connect(freerdp* instance) wfc->primary = wf_image_new(wfc, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth), - freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), format, NULL); + freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), format, nullptr); if (!wfc->primary) { @@ -425,7 +425,7 @@ static BOOL wf_post_connect(freerdp* instance) return FALSE; } - if (!gdi_init_ex(instance, format, 0, wfc->primary->pdata, NULL)) + if (!gdi_init_ex(instance, format, 0, wfc->primary->pdata, nullptr)) return FALSE; cache = instance->context->cache; @@ -460,7 +460,7 @@ static BOOL wf_post_connect(freerdp* instance) if (!wfc->hwnd) { wfc->hwnd = CreateWindowEx(0, wfc->wndClassName, wfc->window_title, dwStyle, 0, 0, 0, 0, - wfc->hWndParent, NULL, wfc->hInstance, NULL); + wfc->hWndParent, nullptr, wfc->hInstance, nullptr); if (!wfc->hwnd) { WLog_ERR(TAG, "CreateWindowEx failed with error: %lu", GetLastError()); @@ -472,7 +472,7 @@ static BOOL wf_post_connect(freerdp* instance) wf_resize_window(wfc); wf_add_system_menu(wfc); BitBlt(wfc->primary->hdc, 0, 0, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth), - freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), NULL, 0, 0, BLACKNESS); + freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight), nullptr, 0, 0, BLACKNESS); wfc->drawing = wfc->primary; EventArgsInit(&e, "wfreerdp"); e.embed = FALSE; @@ -511,8 +511,8 @@ static void wf_post_disconnect(freerdp* instance) free(wfc->window_title); } -static CREDUI_INFOW wfUiInfo = { sizeof(CREDUI_INFOW), NULL, L"Enter your credentials", - L"Remote Desktop Security", NULL }; +static CREDUI_INFOW wfUiInfo = { sizeof(CREDUI_INFOW), nullptr, L"Enter your credentials", + L"Remote Desktop Security", nullptr }; static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** password, char** domain, rdp_auth_reason reason) @@ -591,11 +591,11 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo WLog_ERR(TAG, "Flag for stdin read present but stdin is redirected; using GUI"); if (wfc->isConsole && freerdp_settings_get_bool(wfc->common.context.settings, FreeRDP_CredentialsFromStdin)) - status = CredUICmdLinePromptForCredentialsW(titleW, NULL, 0, UserNameW, + status = CredUICmdLinePromptForCredentialsW(titleW, nullptr, 0, UserNameW, ARRAYSIZE(UserNameW), PasswordW, ARRAYSIZE(PasswordW), &fSave, dwFlags); else - status = CredUIPromptForCredentialsW(&wfUiInfo, titleW, NULL, 0, UserNameW, + status = CredUIPromptForCredentialsW(&wfUiInfo, titleW, nullptr, 0, UserNameW, ARRAYSIZE(UserNameW), PasswordW, ARRAYSIZE(PasswordW), &fSave, dwFlags); if (status != NO_ERROR) @@ -625,7 +625,7 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo } } - *username = ConvertWCharNToUtf8Alloc(UserW, ARRAYSIZE(UserW), NULL); + *username = ConvertWCharNToUtf8Alloc(UserW, ARRAYSIZE(UserW), nullptr); if (!(*username)) { WLog_ERR(TAG, "ConvertWCharNToUtf8Alloc failed", status); @@ -633,7 +633,7 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo } if (_wcsnlen(DomainW, ARRAYSIZE(DomainW)) > 0) - *domain = ConvertWCharNToUtf8Alloc(DomainW, ARRAYSIZE(DomainW), NULL); + *domain = ConvertWCharNToUtf8Alloc(DomainW, ARRAYSIZE(DomainW), nullptr); else *domain = _strdup("\0"); @@ -644,7 +644,7 @@ static BOOL wf_authenticate_ex(freerdp* instance, char** username, char** passwo return FALSE; } - *password = ConvertWCharNToUtf8Alloc(PasswordW, ARRAYSIZE(PasswordW), NULL); + *password = ConvertWCharNToUtf8Alloc(PasswordW, ARRAYSIZE(PasswordW), nullptr); if (!(*password)) { free(*username); @@ -659,11 +659,11 @@ static WCHAR* wf_format_text(const WCHAR* fmt, ...) { int rc; size_t size = 0; - WCHAR* buffer = NULL; + WCHAR* buffer = nullptr; do { - WCHAR* tmp = NULL; + WCHAR* tmp = nullptr; va_list ap = WINPR_C_ARRAY_INIT; va_start(ap, fmt); rc = _vsnwprintf(buffer, size, fmt, ap); @@ -684,7 +684,7 @@ static WCHAR* wf_format_text(const WCHAR* fmt, ...) fail: free(buffer); - return NULL; + return nullptr; } #ifdef WITH_WINDOWS_CERT_STORE @@ -697,15 +697,15 @@ fail: static void wf_report_error(char* wszMessage, DWORD dwErrCode) { - LPSTR pwszMsgBuf = NULL; + LPSTR pwszMsgBuf = nullptr; - if (NULL != wszMessage && 0 != *wszMessage) + if (nullptr != wszMessage && 0 != *wszMessage) { WLog_ERR(TAG, "%s", wszMessage); } FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, // Location of message + nullptr, // Location of message // definition ignored dwErrCode, // Message identifier for // the requested message @@ -716,10 +716,10 @@ static void wf_report_error(char* wszMessage, DWORD dwErrCode) 0, // Size of output buffer // not needed as allocate // buffer flag is set - NULL // Array of insert values + nullptr // Array of insert values ); - if (NULL != pwszMsgBuf) + if (nullptr != pwszMsgBuf) { WLog_ERR(TAG, "Error: 0x%08x (%d) %s", dwErrCode, dwErrCode, pwszMsgBuf); LocalFree(pwszMsgBuf); @@ -736,9 +736,9 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* HRESULT hr = CRYPT_E_NOT_FOUND; DWORD dwChainFlags = CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; - PCCERT_CONTEXT pCert = NULL; - HCERTCHAINENGINE hChainEngine = NULL; - PCCERT_CHAIN_CONTEXT pChainContext = NULL; + PCCERT_CONTEXT pCert = nullptr; + HCERTCHAINENGINE hChainEngine = nullptr; + PCCERT_CHAIN_CONTEXT pChainContext = nullptr; CERT_ENHKEY_USAGE EnhkeyUsage = WINPR_C_ARRAY_INIT; CERT_USAGE_MATCH CertUsage = WINPR_C_ARRAY_INIT; @@ -749,7 +749,7 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* DWORD derPubKeyLen = WINPR_ASSERTING_INT_CAST(uint32_t, strlen(fingerprint)); char* derPubKey = calloc(derPubKeyLen, sizeof(char)); - if (NULL == derPubKey) + if (nullptr == derPubKey) { WLog_ERR(TAG, "Could not allocate derPubKey"); goto CleanUp; @@ -759,7 +759,7 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* * Convert from PEM format to DER format - removes header and footer and decodes from base64 */ if (!CryptStringToBinaryA(fingerprint, 0, CRYPT_STRING_BASE64HEADER, derPubKey, &derPubKeyLen, - NULL, NULL)) + nullptr, nullptr)) { WLog_ERR(TAG, "CryptStringToBinary failed. Err: %d", GetLastError()); goto CleanUp; @@ -769,7 +769,7 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* // Initialize data structures for chain building. EnhkeyUsage.cUsageIdentifier = 0; - EnhkeyUsage.rgpszUsageIdentifier = NULL; + EnhkeyUsage.rgpszUsageIdentifier = nullptr; CertUsage.dwType = USAGE_MATCH_TYPE_AND; CertUsage.Usage = EnhkeyUsage; @@ -785,7 +785,7 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* EngineConfig.dwUrlRetrievalTimeout = 0; pCert = CertCreateCertificateContext(X509_ASN_ENCODING, derPubKey, derPubKeyLen); - if (NULL == pCert) + if (nullptr == pCert) { WLog_ERR(TAG, "FAILED: Certificate could not be parsed."); goto CleanUp; @@ -811,13 +811,13 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char* if (!CertGetCertificateChain(hChainEngine, // use the default chain engine pCert, // pointer to the end certificate - NULL, // use the default time - NULL, // search no additional stores + nullptr, // use the default time + nullptr, // search no additional stores &ChainPara, // use AND logic and enhanced key usage // as indicated in the ChainPara // data structure dwChainFlags, - NULL, // currently reserved + nullptr, // currently reserved &pChainContext)) // return a pointer to the chain created { hr = HRESULT_FROM_WIN32(GetLastError()); @@ -864,22 +864,22 @@ CleanUp: { WLog_INFO(TAG, "CertVerifyCertificateChainPolicy failed for %s (%s) issued by %s", common_name, subject, issuer); - wf_report_error(NULL, hr); + wf_report_error(nullptr, hr); } free(derPubKey); - if (NULL != pChainContext) + if (nullptr != pChainContext) { CertFreeCertificateChain(pChainContext); } - if (NULL != hChainEngine) + if (nullptr != hChainEngine) { CertFreeCertificateChainEngine(hChainEngine); } - if (NULL != pCert) + if (nullptr != pCert) { CertFreeCertificateContext(pCert); } @@ -948,7 +948,7 @@ static DWORD wf_verify_certificate_ex(freerdp* instance, const char* host, UINT1 if (!buffer || !caption) goto fail; - what = MessageBoxW(NULL, buffer, caption, MB_YESNOCANCEL); + what = MessageBoxW(nullptr, buffer, caption, MB_YESNOCANCEL); fail: free(buffer); free(caption); @@ -1003,7 +1003,7 @@ static DWORD wf_verify_changed_certificate_ex(freerdp* instance, const char* hos if (!buffer || !caption) goto fail; - what = MessageBoxW(NULL, buffer, caption, MB_YESNOCANCEL); + what = MessageBoxW(nullptr, buffer, caption, MB_YESNOCANCEL); fail: free(buffer); free(caption); @@ -1035,7 +1035,7 @@ static BOOL wf_present_gateway_message(freerdp* instance, UINT32 type, BOOL isDi msg = wf_format_text(L"%.*s\n\nI understand and agree to the terms of this policy", length, message); - mbRes = MessageBoxW(NULL, msg, L"Consent Message", MB_YESNO); + mbRes = MessageBoxW(nullptr, msg, L"Consent Message", MB_YESNO); free(msg); if (mbRes != IDYES) @@ -1122,9 +1122,9 @@ static DWORD WINAPI wf_client_thread(LPVOID lpParam) quit_msg = FALSE; - while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + while (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) { - msg_ret = GetMessage(&msg, NULL, 0, 0); + msg_ret = GetMessage(&msg, nullptr, 0, 0); if (freerdp_settings_get_bool(settings, FreeRDP_EmbeddedWindow)) { @@ -1187,12 +1187,12 @@ static DWORD WINAPI wf_keyboard_thread(LPVOID lpParam) wfContext* wfc; HHOOK hook_handle; wfc = (wfContext*)lpParam; - WINPR_ASSERT(NULL != wfc); + WINPR_ASSERT(nullptr != wfc); hook_handle = SetWindowsHookEx(WH_KEYBOARD_LL, wf_ll_kbd_proc, wfc->hInstance, 0); if (hook_handle) { - while ((status = GetMessage(&msg, NULL, 0, 0)) != 0) + while ((status = GetMessage(&msg, nullptr, 0, 0)) != 0) { if (status == -1) { @@ -1406,8 +1406,8 @@ static BOOL wfreerdp_client_new(freerdp* instance, rdpContext* context) } #ifdef WITH_PROGRESS_BAR - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_ALL, &IID_ITaskbarList3, + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + CoCreateInstance(&CLSID_TaskbarList, nullptr, CLSCTX_ALL, &IID_ITaskbarList3, (void**)&wfc->taskBarList); #endif @@ -1438,7 +1438,7 @@ static int wfreerdp_client_start(rdpContext* context) rdpSettings* settings = context->settings; WINPR_ASSERT(settings); - HINSTANCE hInstance = GetModuleHandle(NULL); + HINSTANCE hInstance = GetModuleHandle(nullptr); HWND hWndParent = (HWND)freerdp_settings_get_uint64(settings, FreeRDP_ParentWindowId); if (!freerdp_settings_set_bool(settings, FreeRDP_EmbeddedWindow, (hWndParent) ? TRUE : FALSE)) return -1; @@ -1474,30 +1474,30 @@ static int wfreerdp_client_start(rdpContext* context) wfc->systemMenuInsertPosition = 6; wfc->hInstance = hInstance; - wfc->cursor = LoadCursor(NULL, IDC_ARROW); - wfc->icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); + wfc->cursor = LoadCursor(nullptr, IDC_ARROW); + wfc->icon = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_ICON1)); wfc->wndClassName = _tcsdup(_T("FreeRDP")); wfc->wndClass.cbSize = sizeof(WNDCLASSEX); wfc->wndClass.style = CS_HREDRAW | CS_VREDRAW; wfc->wndClass.lpfnWndProc = wf_event_proc; wfc->wndClass.cbClsExtra = 0; wfc->wndClass.cbWndExtra = 0; - wfc->wndClass.hCursor = NULL; + wfc->wndClass.hCursor = nullptr; wfc->wndClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wfc->wndClass.lpszMenuName = NULL; + wfc->wndClass.lpszMenuName = nullptr; wfc->wndClass.lpszClassName = wfc->wndClassName; wfc->wndClass.hInstance = hInstance; wfc->wndClass.hIcon = wfc->icon; wfc->wndClass.hIconSm = wfc->icon; RegisterClassEx(&(wfc->wndClass)); wfc->keyboardThread = - CreateThread(NULL, 0, wf_keyboard_thread, (void*)wfc, 0, &wfc->keyboardThreadId); + CreateThread(nullptr, 0, wf_keyboard_thread, (void*)wfc, 0, &wfc->keyboardThreadId); if (!wfc->keyboardThread) return -1; wfc->common.thread = - CreateThread(NULL, 0, wf_client_thread, (void*)instance, 0, &wfc->mainThreadId); + CreateThread(nullptr, 0, wf_client_thread, (void*)instance, 0, &wfc->mainThreadId); if (!wfc->common.thread) return -1; @@ -1520,7 +1520,7 @@ static int wfreerdp_client_stop(rdpContext* context) PostThreadMessage(wfc->keyboardThreadId, WM_QUIT, 0, 0); (void)WaitForSingleObject(wfc->keyboardThread, INFINITE); (void)CloseHandle(wfc->keyboardThread); - wfc->keyboardThread = NULL; + wfc->keyboardThread = nullptr; wfc->keyboardThreadId = 0; } diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index b549747ca..8fc563cc7 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -369,7 +369,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Stat(IStream* This, STATSTG* psta if (!instance) return E_INVALIDARG; - if (pstatstg == NULL) + if (pstatstg == nullptr) return STG_E_INVALIDPOINTER; ZeroMemory(pstatstg, sizeof(STATSTG)); @@ -471,7 +471,7 @@ static CliprdrStream* CliprdrStream_New(ULONG index, void* pData, const FILEDESC if (!success) { CliprdrStream_Delete(instance); - instance = NULL; + instance = nullptr; } return instance; @@ -621,10 +621,10 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO if (clipboard->hmem) { GlobalFree(clipboard->hmem); - clipboard->hmem = NULL; + clipboard->hmem = nullptr; } - pMedium->u.hGlobal = NULL; + pMedium->u.hGlobal = nullptr; return E_OUTOFMEMORY; } } @@ -678,7 +678,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetCanonicalFormatEtc(IDataOb if (!pformatetcOut) return E_INVALIDARG; - pformatetcOut->ptd = NULL; + pformatetcOut->ptd = nullptr; return E_NOTIMPL; } @@ -772,7 +772,7 @@ static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* st instance->m_nNumFormats = count; instance->m_pData = data; instance->m_nStreams = 0; - instance->m_pStream = NULL; + instance->m_pStream = nullptr; if (count > 0) { @@ -796,7 +796,7 @@ static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* st return instance; error: CliprdrDataObject_Delete(instance); - return NULL; + return nullptr; } void CliprdrDataObject_Delete(CliprdrDataObject* instance) @@ -984,7 +984,7 @@ CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats, FORMATETC* pForma IEnumFORMATETC* iEnumFORMATETC; if ((nFormats != 0) && !pFormatEtc) - return NULL; + return nullptr; instance = (CliprdrEnumFORMATETC*)calloc(1, sizeof(CliprdrEnumFORMATETC)); @@ -1022,7 +1022,7 @@ CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats, FORMATETC* pForma return instance; error: CliprdrEnumFORMATETC_Delete(instance); - return NULL; + return nullptr; } void CliprdrEnumFORMATETC_Delete(CliprdrEnumFORMATETC* instance) @@ -1154,7 +1154,7 @@ static BOOL clear_format_map(wfClipboard* clipboard) map->remote_format_id = 0; map->local_format_id = 0; free(map->name); - map->name = NULL; + map->name = nullptr; } } @@ -1217,7 +1217,7 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard) UINT32 numFormats = 0; UINT32 formatId = 0; char formatName[1024]; - CLIPRDR_FORMAT* formats = NULL; + CLIPRDR_FORMAT* formats = nullptr; CLIPRDR_FORMAT_LIST formatList = WINPR_C_ARRAY_INIT; if (!clipboard) @@ -1348,7 +1348,7 @@ static UINT cliprdr_send_response_filecontents(wfClipboard* clipboard, UINT32 st static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - static wfClipboard* clipboard = NULL; + static wfClipboard* clipboard = nullptr; switch (Msg) { @@ -1389,7 +1389,7 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM if (clipboard->hmem) { GlobalFree(clipboard->hmem); - clipboard->hmem = NULL; + clipboard->hmem = nullptr; } cliprdr_send_format_list(clipboard); @@ -1428,7 +1428,7 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM if (clipboard->hmem) { GlobalFree(clipboard->hmem); - clipboard->hmem = NULL; + clipboard->hmem = nullptr; } } @@ -1476,7 +1476,7 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM if (OleSetClipboard(clipboard->data_obj) != S_OK) { wf_destroy_file_obj(clipboard->data_obj); - clipboard->data_obj = NULL; + clipboard->data_obj = nullptr; } } @@ -1510,17 +1510,17 @@ static int create_cliprdr_window(wfClipboard* clipboard) wnd_cls.lpfnWndProc = cliprdr_proc; wnd_cls.cbClsExtra = 0; wnd_cls.cbWndExtra = 0; - wnd_cls.hIcon = NULL; - wnd_cls.hCursor = NULL; - wnd_cls.hbrBackground = NULL; - wnd_cls.lpszMenuName = NULL; + wnd_cls.hIcon = nullptr; + wnd_cls.hCursor = nullptr; + wnd_cls.hbrBackground = nullptr; + wnd_cls.lpszMenuName = nullptr; wnd_cls.lpszClassName = _T("ClipboardHiddenMessageProcessor"); - wnd_cls.hInstance = GetModuleHandle(NULL); - wnd_cls.hIconSm = NULL; + wnd_cls.hInstance = GetModuleHandle(nullptr); + wnd_cls.hIconSm = nullptr; RegisterClassEx(&wnd_cls); clipboard->hwnd = CreateWindowEx(WS_EX_LEFT, _T("ClipboardHiddenMessageProcessor"), _T("rdpclip"), 0, 0, 0, 0, - 0, HWND_MESSAGE, NULL, GetModuleHandle(NULL), clipboard); + 0, HWND_MESSAGE, nullptr, GetModuleHandle(nullptr), clipboard); if (!clipboard->hwnd) { @@ -1575,11 +1575,11 @@ static void clear_file_array(wfClipboard* clipboard) for (size_t i = 0; i < clipboard->nFiles; i++) { free(clipboard->file_names[i]); - clipboard->file_names[i] = NULL; + clipboard->file_names[i] = nullptr; } free(clipboard->file_names); - clipboard->file_names = NULL; + clipboard->file_names = nullptr; } /* clear fileDescriptor array */ @@ -1588,11 +1588,11 @@ static void clear_file_array(wfClipboard* clipboard) for (size_t i = 0; i < clipboard->nFiles; i++) { free(clipboard->fileDescriptor[i]); - clipboard->fileDescriptor[i] = NULL; + clipboard->fileDescriptor[i] = nullptr; } free(clipboard->fileDescriptor); - clipboard->fileDescriptor = NULL; + clipboard->fileDescriptor = nullptr; } clipboard->file_array_size = 0; @@ -1612,8 +1612,8 @@ static BOOL wf_cliprdr_get_file_contents(WCHAR* file_name, BYTE* buffer, LONG po return FALSE; } - hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); + hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (hFile == INVALID_HANDLE_VALUE) return FALSE; @@ -1623,7 +1623,7 @@ static BOOL wf_cliprdr_get_file_contents(WCHAR* file_name, BYTE* buffer, LONG po if (rc == INVALID_SET_FILE_POINTER) goto error; - if (!ReadFile(hFile, buffer, nRequested, &nGet, NULL)) + if (!ReadFile(hFile, buffer, nRequested, &nGet, nullptr)) { DEBUG_CLIPRDR("ReadFile failed with 0x%08lX.", GetLastError()); goto error; @@ -1649,21 +1649,21 @@ static FILEDESCRIPTORW* wf_cliprdr_get_file_descriptor(WCHAR* file_name, size_t fd = (FILEDESCRIPTORW*)calloc(1, sizeof(FILEDESCRIPTORW)); if (!fd) - return NULL; + return nullptr; - hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); + hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (hFile == INVALID_HANDLE_VALUE) { free(fd); - return NULL; + return nullptr; } fd->dwFlags = FD_ATTRIBUTES | FD_FILESIZE | FD_WRITESTIME | FD_PROGRESSUI; fd->dwFileAttributes = GetFileAttributes(file_name); - if (!GetFileTime(hFile, NULL, NULL, &fd->ftLastWriteTime)) + if (!GetFileTime(hFile, nullptr, nullptr, &fd->ftLastWriteTime)) { fd->dwFlags &= ~FD_WRITESTIME; } @@ -1885,14 +1885,14 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context, if (format->formatName) { - mapping->name = ConvertUtf8ToWCharAlloc(format->formatName, NULL); + mapping->name = ConvertUtf8ToWCharAlloc(format->formatName, nullptr); if (mapping->name) mapping->local_format_id = RegisterClipboardFormatW((LPWSTR)mapping->name); } else { - mapping->name = NULL; + mapping->name = nullptr; mapping->local_format_id = mapping->remote_format_id; } @@ -1913,7 +1913,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context, if (EmptyClipboard()) { for (UINT32 i = 0; i < (UINT32)clipboard->map_size; i++) - SetClipboardData(clipboard->format_mappings[i].local_format_id, NULL); + SetClipboardData(clipboard->format_mappings[i].local_format_id, nullptr); rc = CHANNEL_RC_OK; } @@ -2010,7 +2010,7 @@ static SSIZE_T wf_cliprdr_tryopen(wfClipboard* clipboard, UINT32 requestedFormat WINPR_ASSERT(clipboard); WINPR_ASSERT(pData); - *pData = NULL; + *pData = nullptr; /* Ignore if other app is holding the clipboard */ if (!try_open_clipboard(clipboard->hwnd)) @@ -2027,7 +2027,7 @@ static SSIZE_T wf_cliprdr_tryopen(wfClipboard* clipboard, UINT32 requestedFormat goto unlock; BYTE* buff = malloc(size); - if (buff == NULL) + if (buff == nullptr) goto fail; CopyMemory(buff, globlemem, size); *pData = buff; @@ -2048,11 +2048,11 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat WINPR_ASSERT(pData); SSIZE_T rc = -1; - LPDATAOBJECT dataObj = NULL; + LPDATAOBJECT dataObj = nullptr; FORMATETC format_etc = WINPR_C_ARRAY_INIT; STGMEDIUM stg_medium = WINPR_C_ARRAY_INIT; - *pData = NULL; + *pData = nullptr; HRESULT result = OleGetClipboard(&dataObj); if (FAILED(result)) @@ -2100,7 +2100,7 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat p += len + 1, clipboard->nFiles++) { const int ilen = WINPR_ASSERTING_INT_CAST(int, len); - const int cchWideChar = MultiByteToWideChar(CP_ACP, MB_COMPOSITE, p, ilen, NULL, 0); + const int cchWideChar = MultiByteToWideChar(CP_ACP, MB_COMPOSITE, p, ilen, nullptr, 0); WCHAR* wFileName = (LPWSTR)calloc(cchWideChar, sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, MB_COMPOSITE, p, ilen, wFileName, cchWideChar); wf_cliprdr_process_filename(clipboard, wFileName, cchWideChar); @@ -2152,7 +2152,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context, return ERROR_INTERNAL_ERROR; const UINT32 requestedFormatId = formatDataRequest->requestedFormatId; - BYTE* requestedFormatData = NULL; + BYTE* requestedFormatData = nullptr; SSIZE_T res = 0; if (requestedFormatId == RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW)) { @@ -2181,7 +2181,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context, CB_FORMAT_DATA_RESPONSE, .msgFlags = CB_RESPONSE_FAIL, .dataLen = 0 }, - .requestedFormatData = NULL }; + .requestedFormatData = nullptr }; rc = clipboard->context->ClientFormatDataResponse(clipboard->context, &response); } @@ -2213,7 +2213,7 @@ wf_cliprdr_server_format_data_response(CliprdrClientContext* context, if (formatDataResponse->common.msgFlags != CB_RESPONSE_OK) { - clipboard->hmem = NULL; + clipboard->hmem = nullptr; if (!SetEvent(clipboard->response_data_event)) return ERROR_INTERNAL_ERROR; @@ -2260,13 +2260,13 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest) { DWORD uSize = 0; - BYTE* pData = NULL; + BYTE* pData = nullptr; HRESULT hRet = S_OK; FORMATETC vFormatEtc = WINPR_C_ARRAY_INIT; - LPDATAOBJECT pDataObj = NULL; + LPDATAOBJECT pDataObj = nullptr; STGMEDIUM vStgMedium = WINPR_C_ARRAY_INIT; BOOL bIsStreamFile = TRUE; - static LPSTREAM pStreamStc = NULL; + static LPSTREAM pStreamStc = nullptr; static UINT32 uStreamIdStc = 0; wfClipboard* clipboard; UINT rc = ERROR_INTERNAL_ERROR; @@ -2302,7 +2302,7 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context, vFormatEtc.tymed = TYMED_ISTREAM; vFormatEtc.dwAspect = 1; vFormatEtc.lindex = fileContentsRequest->listIndex; - vFormatEtc.ptd = NULL; + vFormatEtc.ptd = nullptr; if ((uStreamIdStc != fileContentsRequest->streamId) || !pStreamStc) { @@ -2313,7 +2313,7 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context, if (pStreamStc) { IStream_Release(pStreamStc); - pStreamStc = NULL; + pStreamStc = nullptr; } bIsStreamFile = FALSE; @@ -2411,7 +2411,7 @@ error: if (uSize == 0) { free(pData); - pData = NULL; + pData = nullptr; } sRc = @@ -2504,13 +2504,13 @@ BOOL wf_cliprdr_init(wfContext* wfc, CliprdrClientContext* cliprdr) (formatMapping*)calloc(clipboard->map_capacity, sizeof(formatMapping)))) goto error; - if (!(clipboard->response_data_event = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (!(clipboard->response_data_event = CreateEvent(nullptr, TRUE, FALSE, nullptr))) goto error; - if (!(clipboard->req_fevent = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (!(clipboard->req_fevent = CreateEvent(nullptr, TRUE, FALSE, nullptr))) goto error; - if (!(clipboard->thread = CreateThread(NULL, 0, cliprdr_thread_func, clipboard, 0, NULL))) + if (!(clipboard->thread = CreateThread(nullptr, 0, cliprdr_thread_func, clipboard, 0, nullptr))) goto error; cliprdr->MonitorReady = wf_cliprdr_monitor_ready; @@ -2542,7 +2542,7 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr) if (!clipboard) return FALSE; - cliprdr->custom = NULL; + cliprdr->custom = nullptr; if (clipboard->hwnd) PostMessage(clipboard->hwnd, WM_QUIT, 0, 0); diff --git a/client/Windows/wf_defaults.c b/client/Windows/wf_defaults.c index 6b3e3b66b..5d9af4f7e 100644 --- a/client/Windows/wf_defaults.c +++ b/client/Windows/wf_defaults.c @@ -40,13 +40,13 @@ static void AddDefaultSettings_I(rdpSettings* settings, size_t idHostname, size_ { static const PSTR TERMSRV = "TERMSRV/%s"; - PSTR TargetName = NULL; - PSTR UserName = NULL; - PWSTR TargetNameW = NULL; - PWSTR ServerHostNameW = NULL; - PWSTR ParsedUserNameW = NULL; - PWSTR ParsedDomainW = NULL; - PWSTR PasswordNullTerminatedW = NULL; + PSTR TargetName = nullptr; + PSTR UserName = nullptr; + PWSTR TargetNameW = nullptr; + PWSTR ServerHostNameW = nullptr; + PWSTR ParsedUserNameW = nullptr; + PWSTR ParsedDomainW = nullptr; + PWSTR PasswordNullTerminatedW = nullptr; PCREDENTIALW Credential = WINPR_C_ARRAY_INIT; PCSTR ServerHostname = freerdp_settings_get_string(settings, idHostname); @@ -74,7 +74,7 @@ static void AddDefaultSettings_I(rdpSettings* settings, size_t idHostname, size_ TargetName[len - 1] = 0; - TargetNameW = ConvertUtf8ToWCharAlloc(TargetName, NULL); + TargetNameW = ConvertUtf8ToWCharAlloc(TargetName, nullptr); if (!TargetNameW) goto fail; diff --git a/client/Windows/wf_event.c b/client/Windows/wf_event.c index 7f9d09f44..ed0fc3840 100644 --- a/client/Windows/wf_event.c +++ b/client/Windows/wf_event.c @@ -36,9 +36,9 @@ #include -static HWND g_focus_hWnd = NULL; -static HWND g_main_hWnd = NULL; -static HWND g_parent_hWnd = NULL; +static HWND g_focus_hWnd = nullptr; +static HWND g_main_hWnd = nullptr; +static HWND g_parent_hWnd = nullptr; #define RESIZE_MIN_DELAY 200 /* minimum delay in ms between two resizes */ @@ -70,7 +70,7 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) { DWORD ext_proc_id = 0; - wfContext* wfc = NULL; + wfContext* wfc = nullptr; DWORD rdp_scancode; BOOL keystate; rdpInput* input; @@ -83,7 +83,7 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) if (!alt_ctrl_down()) g_flipping_in = FALSE; - return CallNextHookEx(NULL, nCode, wParam, lParam); + return CallNextHookEx(nullptr, nCode, wParam, lParam); } if (g_parent_hWnd && g_main_hWnd) @@ -96,8 +96,8 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) BOOL result = GetGUIThreadInfo(fg_win_thread_id, &gui_thread_info); if (gui_thread_info.hwndFocus != wfc->hWndParent) { - g_focus_hWnd = NULL; - return CallNextHookEx(NULL, nCode, wParam, lParam); + g_focus_hWnd = nullptr; + return CallNextHookEx(nullptr, nCode, wParam, lParam); } g_focus_hWnd = g_main_hWnd; @@ -205,11 +205,11 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) if (!alt_ctrl_down()) { g_flipping_out = FALSE; - g_focus_hWnd = NULL; + g_focus_hWnd = nullptr; } } - return CallNextHookEx(NULL, nCode, wParam, lParam); + return CallNextHookEx(nullptr, nCode, wParam, lParam); } void wf_event_focus_in(wfContext* wfc) @@ -327,7 +327,8 @@ static void wf_send_resize(wfContext* wfc) int targetHeight = wfc->client_height; rdpSettings* settings = wfc->common.context.settings; - if (freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate) && wfc->disp != NULL) + if (freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate) && + wfc->disp != nullptr) { if (GetTickCount64() - wfc->lastSentDate > RESIZE_MIN_DELAY) { @@ -375,13 +376,13 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam PAINTSTRUCT ps = WINPR_C_ARRAY_INIT; BOOL processed = FALSE; RECT windowRect = WINPR_C_ARRAY_INIT; - MINMAXINFO* minmax = NULL; + MINMAXINFO* minmax = nullptr; SCROLLINFO si = WINPR_C_ARRAY_INIT; processed = TRUE; LONG_PTR ptr = GetWindowLongPtr(hWnd, GWLP_USERDATA); wfContext* wfc = (wfContext*)ptr; - if (wfc != NULL) + if (wfc != nullptr) { rdpInput* input = wfc->common.context.input; rdpSettings* settings = wfc->common.context.settings; @@ -475,7 +476,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam } else if (wParam == SIZE_MINIMIZED) { - g_focus_hWnd = NULL; + g_focus_hWnd = nullptr; } } @@ -640,8 +641,9 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam // client area when ScrollWindowEx is called; however, it is // necessary to call UpdateWindow in order to repaint the // rectangle of pixels that were invalidated.) - ScrollWindowEx(wfc->hwnd, -xDelta, -yDelta, (CONST RECT*)NULL, (CONST RECT*)NULL, - (HRGN)NULL, (PRECT)NULL, SW_INVALIDATE); + ScrollWindowEx(wfc->hwnd, -xDelta, -yDelta, (CONST RECT*)nullptr, + (CONST RECT*)nullptr, (HRGN) nullptr, (PRECT) nullptr, + SW_INVALIDATE); UpdateWindow(wfc->hwnd); // Reset the scroll bar. si.cbSize = sizeof(si); @@ -709,8 +711,9 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam // client area when ScrollWindowEx is called; however, it is // necessary to call UpdateWindow in order to repaint the // rectangle of pixels that were invalidated.) - ScrollWindowEx(wfc->hwnd, -xDelta, -yDelta, (CONST RECT*)NULL, (CONST RECT*)NULL, - (HRGN)NULL, (PRECT)NULL, SW_INVALIDATE); + ScrollWindowEx(wfc->hwnd, -xDelta, -yDelta, (CONST RECT*)nullptr, + (CONST RECT*)nullptr, (HRGN) nullptr, (PRECT) nullptr, + SW_INVALIDATE); UpdateWindow(wfc->hwnd); // Reset the scroll bar. si.cbSize = sizeof(si); @@ -801,7 +804,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam if (alt_ctrl_down()) g_flipping_out = TRUE; else - g_focus_hWnd = NULL; + g_focus_hWnd = nullptr; } break; @@ -823,7 +826,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam if (alt_ctrl_down()) g_flipping_out = TRUE; else - g_focus_hWnd = NULL; + g_focus_hWnd = nullptr; } } @@ -869,7 +872,7 @@ BOOL wf_scale_blt(wfContext* wfc, HDC hdc, int x, int y, int w, int h, HDC hdcSr else { SetStretchBltMode(hdc, HALFTONE); - SetBrushOrgEx(hdc, 0, 0, NULL); + SetBrushOrgEx(hdc, 0, 0, nullptr); return StretchBlt(hdc, 0, 0, ww, wh, wfc->primary->hdc, 0, 0, dw, dh, SRCCOPY); } diff --git a/client/Windows/wf_floatbar.c b/client/Windows/wf_floatbar.c index a9d9a67aa..b97bf01b0 100644 --- a/client/Windows/wf_floatbar.c +++ b/client/Windows/wf_floatbar.c @@ -122,7 +122,7 @@ static BOOL floatbar_animation(wfFloatBar* const floatbar, const BOOL show) floatbar->animating = timer; - if (SetTimer(floatbar->hwnd, timer, USER_TIMER_MINIMUM, NULL) == 0) + if (SetTimer(floatbar->hwnd, timer, USER_TIMER_MINIMUM, nullptr) == 0) { DWORD err = GetLastError(); WLog_ERR(TAG, "SetTimer failed with %08" PRIx32, err); @@ -139,7 +139,7 @@ static BOOL floatbar_trigger_hide(wfFloatBar* floatbar) if (!floatbar->locked && floatbar->shown) { - if (SetTimer(floatbar->hwnd, TIMER_HIDE, 3000, NULL) == 0) + if (SetTimer(floatbar->hwnd, TIMER_HIDE, 3000, nullptr) == 0) { DWORD err = GetLastError(); WLog_ERR(TAG, "SetTimer failed with %08" PRIx32, err); @@ -209,7 +209,7 @@ static BOOL button_set_locked(Button* button, BOOL locked) button->bmp_act = button->unlocked_bmp_act; } - InvalidateRect(button->floatbar->hwnd, NULL, FALSE); + InvalidateRect(button->floatbar->hwnd, nullptr, FALSE); UpdateWindow(button->floatbar->hwnd); return TRUE; } @@ -261,7 +261,7 @@ static int button_hit(Button* const button) static int button_paint(const Button* const button, const HDC hdc) { - if (button != NULL) + if (button != nullptr) { wfFloatBar* floatbar = button->floatbar; BLENDFUNCTION bf; @@ -284,7 +284,7 @@ static Button* floatbar_create_button(wfFloatBar* const floatbar, const int type Button* button = (Button*)calloc(1, sizeof(Button)); if (!button) - return NULL; + return nullptr; button->floatbar = floatbar; button->type = type; @@ -309,7 +309,7 @@ static Button* floatbar_create_lock_button(wfFloatBar* const floatbar, const int unlock_resid_act, x, y, h, w); if (!button) - return NULL; + return nullptr; button->unlocked_bmp = button->bmp; button->unlocked_bmp_act = button->bmp_act; @@ -327,7 +327,7 @@ static Button* floatbar_get_button(const wfFloatBar* const floatbar, const int x { for (int i = 0; i < BTN_MAX; i++) { - if ((floatbar->buttons[i] != NULL) && (x > floatbar->buttons[i]->x) && + if ((floatbar->buttons[i] != nullptr) && (x > floatbar->buttons[i]->x) && (x < floatbar->buttons[i]->x + floatbar->buttons[i]->w)) { return floatbar->buttons[i]; @@ -335,7 +335,7 @@ static Button* floatbar_get_button(const wfFloatBar* const floatbar, const int x } } - return NULL; + return nullptr; } static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc) @@ -363,7 +363,7 @@ static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc) /* paint shadow */ hpen = CreatePen(PS_SOLID, 1, RGB(71, 71, 71)); orig = SelectObject(hdc, hpen); - MoveToEx(hdc, left, top, NULL); + MoveToEx(hdc, left, top, nullptr); LineTo(hdc, left + angleOffset, bottom); LineTo(hdc, right - angleOffset, bottom); LineTo(hdc, right + 1, top - 1); @@ -373,7 +373,7 @@ static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc) left += 1; bottom -= 1; right -= 1; - MoveToEx(hdc, left, top, NULL); + MoveToEx(hdc, left, top, nullptr); LineTo(hdc, left + (angleOffset - 1), bottom); LineTo(hdc, right - (angleOffset - 1), bottom); LineTo(hdc, right + 1, top - 1); @@ -497,7 +497,7 @@ static LRESULT CALLBACK floatbar_proc(const HWND hWnd, const UINT Msg, const WPA { for (int i = 0; i < BTN_MAX; i++) { - if (floatbar->buttons[i] != NULL) + if (floatbar->buttons[i] != nullptr) { floatbar->buttons[i]->active = FALSE; } @@ -508,7 +508,7 @@ static LRESULT CALLBACK floatbar_proc(const HWND hWnd, const UINT Msg, const WPA if (button) button->active = TRUE; - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect(hWnd, nullptr, FALSE); UpdateWindow(hWnd); } @@ -523,13 +523,13 @@ static LRESULT CALLBACK floatbar_proc(const HWND hWnd, const UINT Msg, const WPA { for (int i = 0; i < BTN_MAX; i++) { - if (floatbar->buttons[i] != NULL) + if (floatbar->buttons[i] != nullptr) { floatbar->buttons[i]->active = FALSE; } } - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect(hWnd, nullptr, FALSE); UpdateWindow(hWnd); floatbar_trigger_hide(floatbar); break; @@ -605,18 +605,19 @@ static BOOL floatbar_window_create(wfFloatBar* floatbar) wnd_cls.lpfnWndProc = floatbar_proc; wnd_cls.cbClsExtra = 0; wnd_cls.cbWndExtra = 0; - wnd_cls.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wnd_cls.hIcon = LoadIcon(nullptr, IDI_APPLICATION); wnd_cls.hCursor = LoadCursor(floatbar->root_window, IDC_ARROW); - wnd_cls.hbrBackground = NULL; - wnd_cls.lpszMenuName = NULL; + wnd_cls.hbrBackground = nullptr; + wnd_cls.lpszMenuName = nullptr; wnd_cls.lpszClassName = L"floatbar"; wnd_cls.hInstance = floatbar->root_window; - wnd_cls.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + wnd_cls.hIconSm = LoadIcon(nullptr, IDI_APPLICATION); RegisterClassEx(&wnd_cls); - barWnd = CreateWindowEx(WS_EX_TOPMOST, L"floatbar", L"floatbar", WS_CHILD, x, 0, BACKGROUND_W, - BACKGROUND_H, floatbar->parent, NULL, floatbar->root_window, floatbar); + barWnd = + CreateWindowEx(WS_EX_TOPMOST, L"floatbar", L"floatbar", WS_CHILD, x, 0, BACKGROUND_W, + BACKGROUND_H, floatbar->parent, nullptr, floatbar->root_window, floatbar); - if (barWnd == NULL) + if (barWnd == nullptr) return FALSE; pt[0].x = 0; @@ -646,25 +647,25 @@ wfFloatBar* wf_floatbar_new(wfContext* wfc, HINSTANCE window, DWORD flags) /* Floatbar not enabled */ if ((flags & 0x0001) == 0) - return NULL; + return nullptr; if (!wfc) - return NULL; + return nullptr; // TODO: Disable for remote app floatbar = (wfFloatBar*)calloc(1, sizeof(wfFloatBar)); if (!floatbar) - return NULL; + return nullptr; floatbar->root_window = window; floatbar->flags = flags; floatbar->wfc = wfc; floatbar->locked = (flags & 0x0002) != 0; floatbar->shown = (flags & 0x0006) != 0; /* If it is loked or shown show it */ - floatbar->hwnd = NULL; + floatbar->hwnd = nullptr; floatbar->parent = wfc->hwnd; - floatbar->hdcmem = NULL; + floatbar->hdcmem = nullptr; if (wfc->fullscreen_toggle) { @@ -677,8 +678,8 @@ wfFloatBar* wf_floatbar_new(wfContext* wfc, HINSTANCE window, DWORD flags) } else { - floatbar->buttons[0] = NULL; - floatbar->buttons[1] = NULL; + floatbar->buttons[0] = nullptr; + floatbar->buttons[1] = nullptr; } floatbar->buttons[2] = floatbar_create_button(floatbar, BUTTON_CLOSE, IDB_CLOSE, IDB_CLOSE_ACT, @@ -700,7 +701,7 @@ wfFloatBar* wf_floatbar_new(wfContext* wfc, HINSTANCE window, DWORD flags) return floatbar; fail: wf_floatbar_free(floatbar); - return NULL; + return nullptr; } BOOL wf_floatbar_toggle_fullscreen(wfFloatBar* floatbar, BOOL fullscreen) diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index ac5f27b92..5aa756f51 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -136,7 +136,7 @@ static BYTE* wf_glyph_convert(wfContext* wfc, int width, int height, const BYTE* if (!cdata) { WLog_ERR(TAG, "malloc failed for cdata buffer"); - return NULL; + return nullptr; } const BYTE* src = data; @@ -162,7 +162,7 @@ static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color, UIN LOGBRUSH lbr; BYTE* cdata; BYTE ipattern[8]; - HBITMAP pattern = NULL; + HBITMAP pattern = nullptr; lbr.lbStyle = brush->style; if (lbr.lbStyle == BS_DIBPATTERN || lbr.lbStyle == BS_DIBPATTERN8X8 || @@ -176,7 +176,7 @@ static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color, UIN if (brush->bpp > 1) { UINT32 format = gdi_get_pixel_format(bpp); - pattern = wf_create_dib(wfc, 8, 8, format, brush->data, NULL); + pattern = wf_create_dib(wfc, 8, 8, format, brush->data, nullptr); lbr.lbHatch = (ULONG_PTR)pattern; } else @@ -200,9 +200,9 @@ static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color, UIN } br = CreateBrushIndirect(&lbr); - SetBrushOrgEx(wfc->drawing->hdc, brush->x, brush->y, NULL); + SetBrushOrgEx(wfc->drawing->hdc, brush->x, brush->y, nullptr); - if (pattern != NULL) + if (pattern != nullptr) DeleteObject(pattern); return br; @@ -439,7 +439,7 @@ void wf_toggle_fullscreen(wfContext* wfc) } wf_floatbar_toggle_fullscreen(wfc->floatbar, wfc->fullscreen); - SetParent(wfc->hwnd, wfc->fullscreen ? NULL : wfc->hWndParent); + SetParent(wfc->hwnd, wfc->fullscreen ? nullptr : wfc->hWndParent); wf_resize_window(wfc); ShowWindow(wfc->hwnd, SW_SHOW); SetForegroundWindow(wfc->hwnd); @@ -459,7 +459,7 @@ static BOOL wf_gdi_palette_update(rdpContext* context, const PALETTE_UPDATE* pal void wf_set_null_clip_rgn(wfContext* wfc) { - SelectClipRgn(wfc->drawing->hdc, NULL); + SelectClipRgn(wfc->drawing->hdc, nullptr); } void wf_set_clip_rgn(wfContext* wfc, int x, int y, int width, int height) @@ -478,14 +478,14 @@ static BOOL wf_gdi_set_bounds(rdpContext* context, const rdpBounds* bounds) if (!context || !bounds) return FALSE; - if (bounds != NULL) + if (bounds != nullptr) { hrgn = CreateRectRgn(bounds->left, bounds->top, bounds->right + 1, bounds->bottom + 1); SelectClipRgn(wfc->drawing->hdc, hrgn); DeleteObject(hrgn); } else - SelectClipRgn(wfc->drawing->hdc, NULL); + SelectClipRgn(wfc->drawing->hdc, nullptr); return TRUE; } @@ -498,7 +498,7 @@ static BOOL wf_gdi_dstblt(rdpContext* context, const DSTBLT_ORDER* dstblt) return FALSE; if (!BitBlt(wfc->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, - dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop))) + dstblt->nHeight, nullptr, 0, 0, gdi_rop3_code(dstblt->bRop))) return FALSE; wf_invalidate_region(wfc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); @@ -520,10 +520,10 @@ static BOOL wf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) if (!context || !patblt) return FALSE; - if (!wf_decode_color(wfc, patblt->foreColor, &fgcolor, NULL)) + if (!wf_decode_color(wfc, patblt->foreColor, &fgcolor, nullptr)) return FALSE; - if (!wf_decode_color(wfc, patblt->backColor, &bgcolor, NULL)) + if (!wf_decode_color(wfc, patblt->backColor, &bgcolor, nullptr)) return FALSE; brush = wf_create_brush(wfc, &patblt->brush, fgcolor, @@ -573,7 +573,7 @@ static BOOL wf_gdi_opaque_rect(rdpContext* context, const OPAQUE_RECT_ORDER* opa if (!context || !opaque_rect) return FALSE; - if (!wf_decode_color(wfc, opaque_rect->color, &brush_color, NULL)) + if (!wf_decode_color(wfc, opaque_rect->color, &brush_color, nullptr)) return FALSE; rect.left = opaque_rect->nLeftRect; @@ -602,7 +602,7 @@ static BOOL wf_gdi_multi_opaque_rect(rdpContext* context, if (!context || !multi_opaque_rect) return FALSE; - if (!wf_decode_color(wfc, multi_opaque_rect->color, &brush_color, NULL)) + if (!wf_decode_color(wfc, multi_opaque_rect->color, &brush_color, nullptr)) return FALSE; for (UINT32 i = 0; i < multi_opaque_rect->numRectangles; i++) @@ -636,13 +636,13 @@ static BOOL wf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to) if (!context || !line_to) return FALSE; - if (!wf_decode_color(wfc, line_to->penColor, &pen_color, NULL)) + if (!wf_decode_color(wfc, line_to->penColor, &pen_color, nullptr)) return FALSE; pen = CreatePen(line_to->penStyle, line_to->penWidth, pen_color); wf_set_rop2(wfc->drawing->hdc, line_to->bRop2); org_pen = (HPEN)SelectObject(wfc->drawing->hdc, pen); - MoveToEx(wfc->drawing->hdc, line_to->nXStart, line_to->nYStart, NULL); + MoveToEx(wfc->drawing->hdc, line_to->nXStart, line_to->nYStart, nullptr); LineTo(wfc->drawing->hdc, line_to->nXEnd, line_to->nYEnd); x = (line_to->nXStart < line_to->nXEnd) ? line_to->nXStart : line_to->nXEnd; y = (line_to->nYStart < line_to->nYEnd) ? line_to->nYStart : line_to->nYEnd; @@ -671,7 +671,7 @@ static BOOL wf_gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline) if (!context || !polyline) return FALSE; - if (!wf_decode_color(wfc, polyline->penColor, &pen_color, NULL)) + if (!wf_decode_color(wfc, polyline->penColor, &pen_color, nullptr)) return FALSE; hpen = CreatePen(0, 1, pen_color); @@ -750,7 +750,7 @@ static BOOL wf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) wfBitmap* bitmap; wfContext* wfc = (wfContext*)context; COLORREF fgcolor, bgcolor, orgColor; - HBRUSH orgBrush = NULL, brush = NULL; + HBRUSH orgBrush = nullptr, brush = nullptr; if (!context || !mem3blt) return FALSE; @@ -762,10 +762,10 @@ static BOOL wf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) hdc = wfc->drawing->hdc; - if (!wf_decode_color(wfc, mem3blt->foreColor, &fgcolor, NULL)) + if (!wf_decode_color(wfc, mem3blt->foreColor, &fgcolor, nullptr)) return FALSE; - if (!wf_decode_color(wfc, mem3blt->backColor, &bgcolor, NULL)) + if (!wf_decode_color(wfc, mem3blt->backColor, &bgcolor, nullptr)) return FALSE; orgColor = SetTextColor(hdc, fgcolor); diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c index a4d8230e1..63c84b13c 100644 --- a/client/Windows/wf_graphics.c +++ b/client/Windows/wf_graphics.c @@ -36,7 +36,7 @@ HBITMAP wf_create_dib(wfContext* wfc, UINT32 width, UINT32 height, UINT32 srcFor int negHeight; HBITMAP bitmap; BITMAPINFO bmi; - BYTE* cdata = NULL; + BYTE* cdata = nullptr; UINT32 dstFormat = srcFormat; /** * See: http://msdn.microsoft.com/en-us/library/dd183376 @@ -45,14 +45,14 @@ HBITMAP wf_create_dib(wfContext* wfc, UINT32 width, UINT32 height, UINT32 srcFor * Since we get top-down bitmaps, let's keep it that way */ negHeight = (height < 0) ? height : height * (-1); - hdc = GetDC(NULL); + hdc = GetDC(nullptr); bmi.bmiHeader.biSize = sizeof(BITMAPINFO); bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biHeight = negHeight; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = FreeRDPGetBitsPerPixel(dstFormat); bmi.bmiHeader.biCompression = BI_RGB; - bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&cdata, NULL, 0); + bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&cdata, nullptr, 0); if (data) freerdp_image_copy(cdata, dstFormat, 0, 0, 0, width, height, data, srcFormat, 0, 0, 0, @@ -61,7 +61,7 @@ HBITMAP wf_create_dib(wfContext* wfc, UINT32 width, UINT32 height, UINT32 srcFor if (pdata) *pdata = cdata; - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); GdiFlush(); return bitmap; } @@ -72,14 +72,14 @@ wfBitmap* wf_image_new(wfContext* wfc, UINT32 width, UINT32 height, UINT32 forma if (!image) { WLog_ERR(TAG, "malloc failed for wfBitmap"); - return NULL; + return nullptr; } - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); image->hdc = CreateCompatibleDC(hdc); image->bitmap = wf_create_dib(wfc, width, height, format, data, &(image->pdata)); image->org_bitmap = (HBITMAP)SelectObject(image->hdc, image->bitmap); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); return image; } @@ -106,17 +106,17 @@ static BOOL wf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) return FALSE; wf_bitmap = (wfBitmap*)bitmap; - hdc = GetDC(NULL); + hdc = GetDC(nullptr); wf_bitmap->hdc = CreateCompatibleDC(hdc); if (!bitmap->data) wf_bitmap->bitmap = CreateCompatibleBitmap(hdc, bitmap->width, bitmap->height); else - wf_bitmap->bitmap = - wf_create_dib(wfc, bitmap->width, bitmap->height, bitmap->format, bitmap->data, NULL); + wf_bitmap->bitmap = wf_create_dib(wfc, bitmap->width, bitmap->height, bitmap->format, + bitmap->data, nullptr); wf_bitmap->org_bitmap = (HBITMAP)SelectObject(wf_bitmap->hdc, wf_bitmap->bitmap); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); return TRUE; } @@ -131,7 +131,7 @@ static void wf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) DeleteDC(wf_bitmap->hdc); winpr_aligned_free(wf_bitmap->_bitmap.data); - wf_bitmap->_bitmap.data = NULL; + wf_bitmap->_bitmap.data = nullptr; } } @@ -209,7 +209,7 @@ static BOOL wf_Pointer_New(rdpContext* context, rdpPointer* pointer) if (pointer->xorBpp == 1) { - BYTE* pdata = NULL; + BYTE* pdata = nullptr; if ((pointer->lengthAndMask > 0) || (pointer->lengthXorMask > 0)) { @@ -224,12 +224,12 @@ static BOOL wf_Pointer_New(rdpContext* context, rdpPointer* pointer) CopyMemory(pdata + pointer->lengthAndMask, pointer->xorMaskData, pointer->lengthXorMask); info.hbmMask = CreateBitmap(pointer->width, pointer->height * 2, 1, 1, pdata); winpr_aligned_free(pdata); - info.hbmColor = NULL; + info.hbmColor = nullptr; } else { UINT32 srcFormat; - BYTE* pdata = NULL; + BYTE* pdata = nullptr; if (pointer->lengthAndMask > 0) { @@ -250,7 +250,7 @@ static BOOL wf_Pointer_New(rdpContext* context, rdpPointer* pointer) goto fail; info.hbmColor = wf_create_dib((wfContext*)context, pointer->width, pointer->height, - gdi->dstFormat, NULL, &pdata); + gdi->dstFormat, nullptr, &pdata); if (!info.hbmColor) goto fail; @@ -301,7 +301,7 @@ static BOOL wf_Pointer_Set(rdpContext* context, rdpPointer* pointer) hCur = ((wfPointer*)pointer)->cursor; - if (hCur != NULL) + if (hCur != nullptr) { SetCursor(hCur); wfc->cursor = hCur; diff --git a/client/Windows/wf_rail.c b/client/Windows/wf_rail.c index 415538abe..a775a588a 100644 --- a/client/Windows/wf_rail.c +++ b/client/Windows/wf_rail.c @@ -179,7 +179,7 @@ static void PrintRailWindowState(const WINDOW_ORDER_INFO* orderInfo, { const WCHAR* str = (const WCHAR*)windowState->titleInfo.string; char* title = - ConvertWCharNToUtf8Alloc(str, windowState->titleInfo.length / sizeof(WCHAR), NULL); + ConvertWCharNToUtf8Alloc(str, windowState->titleInfo.length / sizeof(WCHAR), nullptr); WLog_INFO(TAG, "\tTitleInfo: %s (length = %hu)", title, windowState->titleInfo.length); free(title); } @@ -289,9 +289,9 @@ LRESULT CALLBACK wf_RailWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara UINT32 yPos; PAINTSTRUCT ps; UINT32 inputFlags; - wfContext* wfc = NULL; - rdpInput* input = NULL; - rdpContext* context = NULL; + wfContext* wfc = nullptr; + rdpInput* input = nullptr; + rdpContext* context = nullptr; wfRailWindow* railWindow; railWindow = (wfRailWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -419,7 +419,7 @@ LRESULT CALLBACK wf_RailWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, const WINDOW_STATE_ORDER* windowState) { - wfRailWindow* railWindow = NULL; + wfRailWindow* railWindow = nullptr; wfContext* wfc = (wfContext*)context; RailClientContext* rail = wfc->rail; UINT32 fieldFlags = orderInfo->fieldFlags; @@ -429,7 +429,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* { BOOL rc; HANDLE hInstance; - WCHAR* titleW = NULL; + WCHAR* titleW = nullptr; WNDCLASSEX wndClassEx = WINPR_C_ARRAY_INIT; railWindow = (wfRailWindow*)calloc(1, sizeof(wfRailWindow)); @@ -449,7 +449,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* if (fieldFlags & WINDOW_ORDER_FIELD_TITLE) { const WCHAR* str = (const WCHAR*)windowState->titleInfo.string; - char* title = NULL; + char* title = nullptr; if (windowState->titleInfo.length == 0) { @@ -460,7 +460,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* } } else if (!(title = ConvertWCharNToUtf8Alloc( - str, windowState->titleInfo.length / sizeof(WCHAR), NULL))) + str, windowState->titleInfo.length / sizeof(WCHAR), nullptr))) { WLog_ERR(TAG, "failed to convert window title"); /* error handled below */ @@ -480,21 +480,21 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* return FALSE; } - titleW = ConvertUtf8ToWCharAlloc(railWindow->title, NULL); - hInstance = GetModuleHandle(NULL); + titleW = ConvertUtf8ToWCharAlloc(railWindow->title, nullptr); + hInstance = GetModuleHandle(nullptr); wndClassEx.cbSize = sizeof(WNDCLASSEX); wndClassEx.style = 0; wndClassEx.lpfnWndProc = wf_RailWndProc; wndClassEx.cbClsExtra = 0; wndClassEx.cbWndExtra = 0; - wndClassEx.hIcon = NULL; - wndClassEx.hCursor = NULL; - wndClassEx.hbrBackground = NULL; - wndClassEx.lpszMenuName = NULL; + wndClassEx.hIcon = nullptr; + wndClassEx.hCursor = nullptr; + wndClassEx.hbrBackground = nullptr; + wndClassEx.lpszMenuName = nullptr; wndClassEx.lpszClassName = _T("RdpRailWindow"); wndClassEx.hInstance = hInstance; - wndClassEx.hIconSm = NULL; + wndClassEx.hIconSm = nullptr; RegisterClassEx(&wndClassEx); railWindow->hWnd = CreateWindowExW(railWindow->dwExStyle, /* dwExStyle */ _T("RdpRailWindow"), /* lpClassName */ @@ -504,10 +504,10 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* railWindow->y, /* y */ railWindow->width, /* nWidth */ railWindow->height, /* nHeight */ - NULL, /* hWndParent */ - NULL, /* hMenu */ + nullptr, /* hWndParent */ + nullptr, /* hMenu */ hInstance, /* hInstance */ - NULL /* lpParam */ + nullptr /* lpParam */ ); if (!railWindow->hWnd) @@ -549,7 +549,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* railWindow->height = windowState->windowHeight; } - SetWindowPos(railWindow->hWnd, NULL, railWindow->x, railWindow->y, railWindow->width, + SetWindowPos(railWindow->hWnd, nullptr, railWindow->x, railWindow->y, railWindow->width, railWindow->height, 0); } @@ -575,7 +575,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* if (fieldFlags & WINDOW_ORDER_FIELD_TITLE) { const WCHAR* str = (const WCHAR*)windowState->titleInfo.string; - char* title = NULL; + char* title = nullptr; if (windowState->titleInfo.length == 0) { @@ -586,7 +586,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* } } else if (!(title = ConvertWCharNToUtf8Alloc( - str, windowState->titleInfo.length / sizeof(WCHAR), NULL))) + str, windowState->titleInfo.length / sizeof(WCHAR), nullptr))) { WLog_ERR(TAG, "failed to convert window title"); return FALSE; @@ -655,7 +655,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* static BOOL wf_rail_window_delete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo) { - wfRailWindow* railWindow = NULL; + wfRailWindow* railWindow = nullptr; wfContext* wfc = (wfContext*)context; RailClientContext* rail = wfc->rail; WLog_DBG(TAG, "RailWindowDelete"); @@ -731,7 +731,7 @@ static BOOL wf_rail_window_icon(rdpContext* context, const WINDOW_ORDER_INFO* or SendMessage(railWindow->hWnd, WM_SETICON, wParam, lParam); } - ReleaseDC(NULL, hDC); + ReleaseDC(nullptr, hDC); if (windowIcon->iconInfo->cacheEntry != 0xFFFF) { @@ -933,7 +933,7 @@ void wf_rail_invalidate_region(wfContext* wfc, REGION16* invalidRegion) { RECT updateRect; RECTANGLE_16 windowRect; - ULONG_PTR* pKeys = NULL; + ULONG_PTR* pKeys = nullptr; wfRailWindow* railWindow; const RECTANGLE_16* extents; REGION16 windowInvalidRegion; @@ -983,12 +983,12 @@ BOOL wf_rail_init(wfContext* wfc, RailClientContext* rail) rail->ServerGetAppIdResponse = wf_rail_server_get_appid_response; wf_rail_register_update_callbacks(context->update); wfc->railWindows = HashTable_New(TRUE); - return (wfc->railWindows != NULL); + return (wfc->railWindows != nullptr); } void wf_rail_uninit(wfContext* wfc, RailClientContext* rail) { - wfc->rail = NULL; - rail->custom = NULL; + wfc->rail = nullptr; + rail->custom = nullptr; HashTable_Free(wfc->railWindows); } diff --git a/client/X11/cli/xfreerdp.c b/client/X11/cli/xfreerdp.c index 4926cae2a..cd173355c 100644 --- a/client/X11/cli/xfreerdp.c +++ b/client/X11/cli/xfreerdp.c @@ -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); diff --git a/client/X11/keyboard_x11.c b/client/X11/keyboard_x11.c index 86a6f076e..235e0ecda 100644 --- a/client/X11/keyboard_x11.c +++ b/client/X11/keyboard_x11.c @@ -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; diff --git a/client/X11/xf_channels.c b/client/X11/xf_channels.c index 71776225b..76d0f1fa0 100644 --- a/client/X11/xf_channels.c +++ b/client/X11/xf_channels.c @@ -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); diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 0027676f3..a157d06ee 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -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); diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 64647f766..9753d9521 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -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; } } diff --git a/client/X11/xf_disp.c b/client/X11/xf_disp.c index 4b0070b6a..0bfeed842 100644 --- a/client/X11/xf_disp.c +++ b/client/X11/xf_disp.c @@ -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; } diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index 29dea4c85..4d6c542f2 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -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; diff --git a/client/X11/xf_floatbar.c b/client/X11/xf_floatbar.c index 4438b3a87..8d525cdc9 100644 --- a/client/X11/xf_floatbar.c +++ b/client/X11/xf_floatbar.c @@ -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) diff --git a/client/X11/xf_gfx.c b/client/X11/xf_gfx.c index e9da53085..bfb9f4f41 100644 --- a/client/X11/xf_gfx.c +++ b/client/X11/xf_gfx.c @@ -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); diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index b34e52dc2..554d68834 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -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); diff --git a/client/X11/xf_input.c b/client/X11/xf_input.c index e25c9b3c3..dba6e0f5f 100644 --- a/client/X11/xf_input.c +++ b/client/X11/xf_input.c @@ -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; diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index e9a80eb4f..e88c6ab58 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -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; diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 5358b7de3..8dac7086b 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -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; diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index 89ab79643..82b52e9d1 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -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); diff --git a/client/X11/xf_tsmf.c b/client/X11/xf_tsmf.c index d50b251cf..a3add01fb 100644 --- a/client/X11/xf_tsmf.c +++ b/client/X11/xf_tsmf.c @@ -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; diff --git a/client/X11/xf_utils.c b/client/X11/xf_utils.c index a9afac770..7f1142fb1 100644 --- a/client/X11/xf_utils.c +++ b/client/X11/xf_utils.c @@ -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) diff --git a/client/X11/xf_video.c b/client/X11/xf_video.c index 27dde8617..bf3a4d8f9 100644 --- a/client/X11/xf_video.c +++ b/client/X11/xf_video.c @@ -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); diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 90e87eb42..5c632e7fe 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -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); diff --git a/client/X11/xkb_layout_ids.c b/client/X11/xkb_layout_ids.c index b32033ee0..b0a63a5b5 100644 --- a/client/X11/xkb_layout_ids.c +++ b/client/X11/xkb_layout_ids.c @@ -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); diff --git a/client/common/client.c b/client/common/client.c index 8cfa75af1..59419d151 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -91,7 +91,7 @@ static void set_default_callbacks(freerdp* instance) static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context) { - RDP_CLIENT_ENTRY_POINTS* pEntryPoints = NULL; + RDP_CLIENT_ENTRY_POINTS* pEntryPoints = nullptr; WINPR_ASSERT(instance); WINPR_ASSERT(context); @@ -106,7 +106,7 @@ static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context) static void freerdp_client_common_free(freerdp* instance, rdpContext* context) { - RDP_CLIENT_ENTRY_POINTS* pEntryPoints = NULL; + RDP_CLIENT_ENTRY_POINTS* pEntryPoints = nullptr; WINPR_ASSERT(instance); WINPR_ASSERT(context); @@ -120,19 +120,19 @@ static void freerdp_client_common_free(freerdp* instance, rdpContext* context) rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints) { - freerdp* instance = NULL; - rdpContext* context = NULL; + freerdp* instance = nullptr; + rdpContext* context = nullptr; if (!pEntryPoints) - return NULL; + return nullptr; if (!IFCALLRESULT(TRUE, pEntryPoints->GlobalInit)) - return NULL; + return nullptr; instance = freerdp_new(); if (!instance) - return NULL; + return nullptr; instance->ContextSize = pEntryPoints->ContextSize; instance->ContextNew = freerdp_client_common_new; @@ -161,12 +161,12 @@ out_fail2: free(instance->pClientEntryPoints); out_fail: freerdp_free(instance); - return NULL; + return nullptr; } void freerdp_client_context_free(rdpContext* context) { - freerdp* instance = NULL; + freerdp* instance = nullptr; if (!context) return; @@ -188,7 +188,7 @@ void freerdp_client_context_free(rdpContext* context) int freerdp_client_start(rdpContext* context) { - RDP_CLIENT_ENTRY_POINTS* pEntryPoints = NULL; + RDP_CLIENT_ENTRY_POINTS* pEntryPoints = nullptr; if (!context || !context->instance || !context->instance->pClientEntryPoints) return ERROR_BAD_ARGUMENTS; @@ -209,7 +209,7 @@ int freerdp_client_start(rdpContext* context) int freerdp_client_stop(rdpContext* context) { - RDP_CLIENT_ENTRY_POINTS* pEntryPoints = NULL; + RDP_CLIENT_ENTRY_POINTS* pEntryPoints = nullptr; if (!context || !context->instance || !context->instance->pClientEntryPoints) return ERROR_BAD_ARGUMENTS; @@ -220,7 +220,7 @@ int freerdp_client_stop(rdpContext* context) #ifdef WITH_SSO_MIB rdpClientContext* client_context = (rdpClientContext*)context; sso_mib_free(client_context->mibClientWrapper); - client_context->mibClientWrapper = NULL; + client_context->mibClientWrapper = nullptr; #endif // WITH_SSO_MIB return rc; } @@ -228,7 +228,7 @@ int freerdp_client_stop(rdpContext* context) freerdp* freerdp_client_get_instance(rdpContext* context) { if (!context || !context->instance) - return NULL; + return nullptr; return context->instance; } @@ -236,7 +236,7 @@ freerdp* freerdp_client_get_instance(rdpContext* context) HANDLE freerdp_client_get_thread(rdpContext* context) { if (!context) - return NULL; + return nullptr; return ((rdpClientContext*)context)->thread; } @@ -310,8 +310,8 @@ int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc, BOOL allowUnknown) { - return freerdp_client_settings_parse_command_line_ex(settings, argc, argv, allowUnknown, NULL, - 0, NULL, NULL); + return freerdp_client_settings_parse_command_line_ex(settings, argc, argv, allowUnknown, + nullptr, 0, nullptr, nullptr); } int freerdp_client_settings_parse_command_line_ex( @@ -345,7 +345,7 @@ int freerdp_client_settings_parse_command_line_ex( int freerdp_client_settings_parse_connection_file(rdpSettings* settings, const char* filename) { - rdpFile* file = NULL; + rdpFile* file = nullptr; int ret = -1; file = freerdp_client_rdp_file_new(); @@ -367,7 +367,7 @@ out: int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings, const BYTE* buffer, size_t size) { - rdpFile* file = NULL; + rdpFile* file = nullptr; int status = -1; file = freerdp_client_rdp_file_new(); @@ -387,7 +387,7 @@ int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings, int freerdp_client_settings_write_connection_file(const rdpSettings* settings, const char* filename, BOOL unicode) { - rdpFile* file = NULL; + rdpFile* file = nullptr; int ret = -1; file = freerdp_client_rdp_file_new(); @@ -410,9 +410,9 @@ int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int arg { int status = 0; int ret = -1; - char* filename = NULL; - char* password = NULL; - rdpAssistanceFile* file = NULL; + char* filename = nullptr; + char* password = nullptr; + rdpAssistanceFile* file = nullptr; if (!settings || !argv || (argc < 2)) return -1; @@ -457,7 +457,7 @@ static int client_cli_read_string(freerdp* instance, const char* what, const cha printf("%s", what); (void)fflush(stdout); - char* line = NULL; + char* line = nullptr; if (suggestion && strlen(suggestion) > 0) { line = _strdup(suggestion); @@ -475,7 +475,7 @@ static int client_cli_read_string(freerdp* instance, const char* what, const cha } free(*result); - *result = NULL; + *result = nullptr; if (line) { @@ -574,7 +574,7 @@ static BOOL client_cli_authenticate_raw(freerdp* instance, rdp_auth_reason reaso freerdp_settings_get_bool(instance->context->settings, FreeRDP_CredentialsFromStdin); const char* rc = freerdp_passphrase_read(instance->context, pwdAuth, line, password_size, fromStdin); - if (rc == NULL) + if (rc == nullptr) goto fail; if (password_size > 0) @@ -589,9 +589,9 @@ fail: free(*username); free(*domain); free(*password); - *username = NULL; - *domain = NULL; - *password = NULL; + *username = nullptr; + *domain = nullptr; + *password = nullptr; return FALSE; } @@ -630,14 +630,14 @@ BOOL client_cli_choose_smartcard(WINPR_ATTR_UNUSED freerdp* instance, SmartcardC DWORD count, DWORD* choice, BOOL gateway) { unsigned long answer = 0; - char* p = NULL; + char* p = nullptr; printf("Multiple smartcards are available for use:\n"); for (DWORD i = 0; i < count; i++) { const SmartcardCertInfo* cert = cert_list[i]; - char* reader = ConvertWCharToUtf8Alloc(cert->reader, NULL); - char* container_name = ConvertWCharToUtf8Alloc(cert->containerName, NULL); + char* reader = ConvertWCharToUtf8Alloc(cert->reader, nullptr); + char* container_name = ConvertWCharToUtf8Alloc(cert->containerName, nullptr); printf("[%" PRIu32 "] %s\n\tReader: %s\n\tUser: %s@%s\n\tSubject: %s\n\tIssuer: %s\n\tUPN: %s\n", @@ -781,14 +781,14 @@ static char* client_cli_pem_cert(const char* pem) { rdpCertificate* cert = freerdp_certificate_new_from_pem(pem); if (!cert) - return NULL; + return nullptr; char* fp = freerdp_certificate_get_fingerprint(cert); char* start = freerdp_certificate_get_validity(cert, TRUE); char* end = freerdp_certificate_get_validity(cert, FALSE); freerdp_certificate_free(cert); - char* str = NULL; + char* str = nullptr; size_t slen = 0; winpr_asprintf(&str, &slen, "\tValid from: %s\n" @@ -1002,7 +1002,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD printf("%.*S\n", (int)length, message); #else { - LPSTR msg = ConvertWCharNToUtf8Alloc(message, length / sizeof(WCHAR), NULL); + LPSTR msg = ConvertWCharNToUtf8Alloc(message, length / sizeof(WCHAR), nullptr); if (!msg) { printf("Failed to convert message!\n"); @@ -1052,12 +1052,12 @@ static const char* extract_authorization_code(char* url) { WINPR_ASSERT(url); - for (char* p = strchr(url, '?'); p++ != NULL; p = strchr(p, '&')) + for (char* p = strchr(url, '?'); p++ != nullptr; p = strchr(p, '&')) { if (strncmp(p, "code=", 5) != 0) continue; - char* end = NULL; + char* end = nullptr; p += 5; end = strchr(p, '&'); @@ -1067,7 +1067,7 @@ static const char* extract_authorization_code(char* url) return p; } - return NULL; + return nullptr; } #if defined(WITH_AAD) @@ -1078,15 +1078,15 @@ static BOOL client_cli_get_rdsaad_access_token(freerdp* instance, const char* sc WINPR_ASSERT(instance->context); size_t size = 0; - char* url = NULL; - char* token_request = NULL; + char* url = nullptr; + char* token_request = nullptr; WINPR_ASSERT(scope); WINPR_ASSERT(req_cnf); WINPR_ASSERT(token); BOOL rc = FALSE; - *token = NULL; + *token = nullptr; char* request = freerdp_client_get_aad_url((rdpClientContext*)instance->context, FREERDP_CLIENT_AAD_AUTH_REQUEST, scope); @@ -1114,7 +1114,7 @@ static BOOL client_cli_get_rdsaad_access_token(freerdp* instance, const char* sc cleanup: free(token_request); free(url); - return rc && (*token != NULL); + return rc && (*token != nullptr); } static BOOL client_cli_get_avd_access_token(freerdp* instance, char** token) @@ -1123,14 +1123,14 @@ static BOOL client_cli_get_avd_access_token(freerdp* instance, char** token) WINPR_ASSERT(instance->context); size_t size = 0; - char* url = NULL; - char* token_request = NULL; + char* url = nullptr; + char* token_request = nullptr; WINPR_ASSERT(token); BOOL rc = FALSE; - *token = NULL; + *token = nullptr; char* request = freerdp_client_get_aad_url((rdpClientContext*)instance->context, FREERDP_CLIENT_AAD_AVD_AUTH_REQUEST); @@ -1159,7 +1159,7 @@ static BOOL client_cli_get_avd_access_token(freerdp* instance, char** token) cleanup: free(token_request); free(url); - return rc && (*token != NULL); + return rc && (*token != nullptr); } #endif @@ -1234,7 +1234,7 @@ BOOL client_common_get_access_token(freerdp* instance, const char* request, char BOOL ret = FALSE; long resp_code = 0; - BYTE* response = NULL; + BYTE* response = nullptr; size_t response_length = 0; wLog* log = WLog_Get(TAG); @@ -1318,7 +1318,7 @@ SSIZE_T client_common_retry_dialog(freerdp* instance, const char* what, size_t c BOOL client_auto_reconnect(freerdp* instance) { - return client_auto_reconnect_ex(instance, NULL); + return client_auto_reconnect_ex(instance, nullptr); } BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp* instance)) @@ -1326,7 +1326,7 @@ BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp* BOOL retry = TRUE; UINT32 error = 0; UINT32 numRetries = 0; - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; if (!instance) return FALSE; @@ -1399,7 +1399,7 @@ BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp* WLog_INFO(TAG, "Attempting reconnect (%" PRIu32 " of %" PRIu32 ")", numRetries, maxRetries); const SSIZE_T delay = - IFCALLRESULT(5000, instance->RetryDialog, instance, "connection", numRetries, NULL); + IFCALLRESULT(5000, instance->RetryDialog, instance, "connection", numRetries, nullptr); if (delay < 0) return FALSE; numRetries++; @@ -1442,7 +1442,7 @@ int freerdp_client_common_stop(rdpContext* context) { (void)WaitForSingleObject(cctx->thread, INFINITE); (void)CloseHandle(cctx->thread); - cctx->thread = NULL; + cctx->thread = nullptr; } return 0; @@ -1451,7 +1451,7 @@ int freerdp_client_common_stop(rdpContext* context) #if defined(CHANNEL_ENCOMSP_CLIENT) BOOL freerdp_client_encomsp_toggle_control(EncomspClientContext* encomsp) { - rdpClientContext* cctx = NULL; + rdpClientContext* cctx = nullptr; BOOL state = 0; if (!encomsp) @@ -1485,8 +1485,8 @@ static UINT client_encomsp_participant_created(EncomspClientContext* context, const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated) { - rdpClientContext* cctx = NULL; - rdpSettings* settings = NULL; + rdpClientContext* cctx = nullptr; + rdpSettings* settings = nullptr; BOOL request = 0; if (!context || !context->custom || !participantCreated) @@ -1529,12 +1529,12 @@ static void client_encomsp_uninit(rdpClientContext* cctx, EncomspClientContext* { if (encomsp) { - encomsp->custom = NULL; - encomsp->ParticipantCreated = NULL; + encomsp->custom = nullptr; + encomsp->ParticipantCreated = nullptr; } if (cctx) - cctx->encomsp = NULL; + cctx->encomsp = nullptr; } #endif @@ -1602,12 +1602,12 @@ void freerdp_client_OnChannelDisconnectedEventHandler(void* context, } #if defined(CHANNEL_AINPUT_CLIENT) else if (strcmp(e->name, AINPUT_DVC_CHANNEL_NAME) == 0) - cctx->ainput = NULL; + cctx->ainput = nullptr; #endif #if defined(CHANNEL_RDPEI_CLIENT) else if (strcmp(e->name, RDPEI_DVC_CHANNEL_NAME) == 0) { - cctx->rdpei = NULL; + cctx->rdpei = nullptr; } #endif #if defined(CHANNEL_RDPGFX_CLIENT) @@ -2163,7 +2163,7 @@ static FreeRDP_PenDevice* freerdp_client_get_pen(rdpClientContext* cctx, INT32 d return pen; } } - return NULL; + return nullptr; } static BOOL freerdp_client_register_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid, @@ -2416,7 +2416,7 @@ BOOL freerdp_client_use_relative_mouse_events(rdpClientContext* cctx) const BOOL haveRelative = freerdp_settings_get_bool(settings, FreeRDP_HasRelativeMouseEvent); BOOL ainput = FALSE; #if defined(CHANNEL_AINPUT_CLIENT) - ainput = cctx->ainput != NULL; + ainput = cctx->ainput != nullptr; #endif return useRelative && (haveRelative || ainput); @@ -2427,7 +2427,7 @@ WINPR_ATTR_MALLOC(free, 1) WINPR_ATTR_NODISCARD static char* get_redirect_uri(const rdpSettings* settings) { - char* redirect_uri = NULL; + char* redirect_uri = nullptr; const bool cli = freerdp_settings_get_bool(settings, FreeRDP_UseCommonStdioCallbacks); if (cli) { @@ -2468,13 +2468,13 @@ static char* avd_auth_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list const char* scope = freerdp_settings_get_string(settings, FreeRDP_GatewayAvdScope); if (!client_id || !ep || !scope) - return NULL; + return nullptr; char* redirect_uri = get_redirect_uri(settings); if (!redirect_uri) - return NULL; + return nullptr; - char* url = NULL; + char* url = nullptr; size_t urllen = 0; winpr_asprintf(&url, &urllen, "%s?client_id=%s&response_type=code&scope=%s&redirect_uri=%s", ep, client_id, scope, redirect_uri); @@ -2491,13 +2491,13 @@ static char* avd_token_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list const char* scope = freerdp_settings_get_string(settings, FreeRDP_GatewayAvdScope); if (!client_id || !ep || !scope) - return NULL; + return nullptr; char* redirect_uri = get_redirect_uri(settings); if (!redirect_uri) - return NULL; + return nullptr; - char* url = NULL; + char* url = nullptr; size_t urllen = 0; const char* code = va_arg(ap, const char*); @@ -2511,7 +2511,7 @@ static char* avd_token_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list static char* aad_auth_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list ap) { const rdpSettings* settings = cctx->context.settings; - char* url = NULL; + char* url = nullptr; size_t urllen = 0; char* redirect_uri = get_redirect_uri(settings); @@ -2549,13 +2549,13 @@ static char* aad_token_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list const char* req_cnf = va_arg(ap, const char*); if (!client_id || !ep || !scope || !code || !req_cnf) - return NULL; + return nullptr; char* redirect_uri = get_redirect_uri(settings); if (!redirect_uri) - return NULL; + return nullptr; - char* url = NULL; + char* url = nullptr; size_t urllen = 0; winpr_asprintf( @@ -2570,7 +2570,7 @@ static char* aad_token_request(rdpClientContext* cctx, WINPR_ATTR_UNUSED va_list char* freerdp_client_get_aad_url(rdpClientContext* cctx, freerdp_client_aad_type type, ...) { WINPR_ASSERT(cctx); - char* str = NULL; + char* str = nullptr; va_list ap = WINPR_C_ARRAY_INIT; va_start(ap, type); diff --git a/client/common/client_cliprdr_file.c b/client/common/client_cliprdr_file.c index 8e4540cdd..50784613b 100644 --- a/client/common/client_cliprdr_file.c +++ b/client/common/client_cliprdr_file.c @@ -219,7 +219,7 @@ static CliprdrFuseFile* fuse_file_new(WINPR_FORMAT_ARG const char* fmt, ...) { CliprdrFuseFile* file = calloc(1, sizeof(CliprdrFuseFile)); if (!file) - return NULL; + return nullptr; file->children = ArrayList_New(FALSE); if (!file->children) @@ -248,7 +248,7 @@ static CliprdrFuseFile* fuse_file_new(WINPR_FORMAT_ARG const char* fmt, ...) return file; fail: fuse_file_free(file); - return NULL; + return nullptr; } static void clip_data_entry_free(void* data) @@ -311,14 +311,14 @@ static UINT32 get_next_free_clip_data_id(CliprdrFileContext* file_context) static CliprdrFuseClipDataEntry* clip_data_entry_new(CliprdrFileContext* file_context, BOOL needs_clip_data_id) { - CliprdrFuseClipDataEntry* clip_data_entry = NULL; + CliprdrFuseClipDataEntry* clip_data_entry = nullptr; CLIPRDR_LOCK_CLIPBOARD_DATA lock_clipboard_data = WINPR_C_ARRAY_INIT; WINPR_ASSERT(file_context); clip_data_entry = calloc(1, sizeof(CliprdrFuseClipDataEntry)); if (!clip_data_entry) - return NULL; + return nullptr; clip_data_entry->file_context = file_context; clip_data_entry->clip_data_id = get_next_free_clip_data_id(file_context); @@ -334,7 +334,7 @@ static CliprdrFuseClipDataEntry* clip_data_entry_new(CliprdrFileContext* file_co HashTable_Lock(file_context->inode_table); clip_data_entry_free(clip_data_entry); HashTable_Unlock(file_context->inode_table); - return NULL; + return nullptr; } clip_data_entry->has_clip_data_id = TRUE; @@ -447,7 +447,7 @@ static void clear_selection(CliprdrFileContext* file_context, BOOL all_selection CliprdrFuseClipDataEntry* clip_data_entry) { FuseFileClearContext clear_context = WINPR_C_ARRAY_INIT; - CliprdrFuseFile* clip_data_dir = NULL; + CliprdrFuseFile* clip_data_dir = nullptr; WINPR_ASSERT(file_context); @@ -462,7 +462,7 @@ static void clear_selection(CliprdrFileContext* file_context, BOOL all_selection if (clip_data_entry) { clip_data_dir = clip_data_entry->clip_data_dir; - clip_data_entry->clip_data_dir = NULL; + clip_data_entry->clip_data_dir = nullptr; WINPR_ASSERT(clip_data_dir); @@ -535,7 +535,7 @@ static void clear_no_cdi_entry(CliprdrFileContext* file_context) clear_entry_selection(file_context->clip_data_entry_without_id); clip_data_entry_free(file_context->clip_data_entry_without_id); - file_context->clip_data_entry_without_id = NULL; + file_context->clip_data_entry_without_id = nullptr; } HashTable_Unlock(file_context->inode_table); } @@ -553,7 +553,7 @@ static void clear_cdi_entries(CliprdrFileContext* file_context) WINPR_ASSERT(file_context); HashTable_Lock(file_context->inode_table); - HashTable_Foreach(file_context->clip_data_table, clear_clip_data_entries, NULL); + HashTable_Foreach(file_context->clip_data_table, clear_clip_data_entries, nullptr); HashTable_Clear(file_context->clip_data_table); HashTable_Unlock(file_context->inode_table); @@ -561,7 +561,7 @@ static void clear_cdi_entries(CliprdrFileContext* file_context) static UINT prepare_clip_data_entry_with_id(CliprdrFileContext* file_context) { - CliprdrFuseClipDataEntry* clip_data_entry = NULL; + CliprdrFuseClipDataEntry* clip_data_entry = nullptr; WINPR_ASSERT(file_context); @@ -704,14 +704,14 @@ get_fuse_file_by_name_from_parent(WINPR_ATTR_UNUSED CliprdrFileContext* file_con DEBUG_CLIPRDR(file_context->log, "Requested file \"%s\" in directory \"%s\" does not exist", name, parent->filename); - return NULL; + return nullptr; } static CliprdrFuseRequest* cliprdr_fuse_request_new(CliprdrFileContext* file_context, CliprdrFuseFile* fuse_file, fuse_req_t fuse_req, FuseLowlevelOperationType operation_type) { - CliprdrFuseRequest* fuse_request = NULL; + CliprdrFuseRequest* fuse_request = nullptr; UINT32 stream_id = file_context->next_stream_id; WINPR_ASSERT(file_context); @@ -722,7 +722,7 @@ static CliprdrFuseRequest* cliprdr_fuse_request_new(CliprdrFileContext* file_con { WLog_Print(file_context->log, WLOG_ERROR, "Failed to allocate FUSE request for file \"%s\"", fuse_file->filename_with_root); - return NULL; + return nullptr; } fuse_request->fuse_file = fuse_file; @@ -742,7 +742,7 @@ static CliprdrFuseRequest* cliprdr_fuse_request_new(CliprdrFileContext* file_con WLog_Print(file_context->log, WLOG_ERROR, "Failed to track FUSE request for file \"%s\"", fuse_file->filename_with_root); free(fuse_request); - return NULL; + return nullptr; } return fuse_request; @@ -751,7 +751,7 @@ static CliprdrFuseRequest* cliprdr_fuse_request_new(CliprdrFileContext* file_con static BOOL request_file_size_async(CliprdrFileContext* file_context, CliprdrFuseFile* fuse_file, fuse_req_t fuse_req, FuseLowlevelOperationType operation_type) { - CliprdrFuseRequest* fuse_request = NULL; + CliprdrFuseRequest* fuse_request = nullptr; CLIPRDR_FILE_CONTENTS_REQUEST file_contents_request = WINPR_C_ARRAY_INIT; WINPR_ASSERT(file_context); @@ -808,14 +808,14 @@ static void write_file_attributes(CliprdrFuseFile* fuse_file, struct stat* attr) attr->st_uid = getuid(); attr->st_gid = getgid(); attr->st_atime = attr->st_mtime = attr->st_ctime = - (fuse_file->has_last_write_time ? fuse_file->last_write_time_unix : time(NULL)); + (fuse_file->has_last_write_time ? fuse_file->last_write_time_unix : time(nullptr)); } static void cliprdr_file_fuse_lookup(fuse_req_t fuse_req, fuse_ino_t parent_ino, const char* name) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* parent = NULL; - CliprdrFuseFile* fuse_file = NULL; + CliprdrFuseFile* parent = nullptr; + CliprdrFuseFile* fuse_file = nullptr; struct fuse_entry_param entry = WINPR_C_ARRAY_INIT; WINPR_ASSERT(file_context); @@ -865,7 +865,7 @@ static void cliprdr_file_fuse_getattr(fuse_req_t fuse_req, fuse_ino_t fuse_ino, WINPR_ATTR_UNUSED struct fuse_file_info* file_info) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* fuse_file = NULL; + CliprdrFuseFile* fuse_file = nullptr; struct stat attr = WINPR_C_ARRAY_INIT; WINPR_ASSERT(file_context); @@ -905,7 +905,7 @@ static void cliprdr_file_fuse_open(fuse_req_t fuse_req, fuse_ino_t fuse_ino, struct fuse_file_info* file_info) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* fuse_file = NULL; + CliprdrFuseFile* fuse_file = nullptr; WINPR_ASSERT(file_context); @@ -987,7 +987,7 @@ static void cliprdr_file_fuse_read(fuse_req_t fuse_req, fuse_ino_t fuse_ino, siz off_t offset, WINPR_ATTR_UNUSED struct fuse_file_info* file_info) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* fuse_file = NULL; + CliprdrFuseFile* fuse_file = nullptr; BOOL result = 0; WINPR_ASSERT(file_context); @@ -1025,7 +1025,7 @@ static void cliprdr_file_fuse_opendir(fuse_req_t fuse_req, fuse_ino_t fuse_ino, struct fuse_file_info* file_info) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* fuse_file = NULL; + CliprdrFuseFile* fuse_file = nullptr; WINPR_ASSERT(file_context); @@ -1058,13 +1058,13 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino, WINPR_ATTR_UNUSED struct fuse_file_info* file_info) { CliprdrFileContext* file_context = fuse_req_userdata(fuse_req); - CliprdrFuseFile* fuse_file = NULL; - CliprdrFuseFile* child = NULL; + CliprdrFuseFile* fuse_file = nullptr; + CliprdrFuseFile* child = nullptr; struct stat attr = WINPR_C_ARRAY_INIT; size_t written_size = 0; size_t entry_size = 0; - char* filename = NULL; - char* buf = NULL; + char* filename = nullptr; + char* buf = nullptr; WINPR_ASSERT(file_context); @@ -1088,7 +1088,7 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino, if ((offset < 0) || ((size_t)offset >= ArrayList_Count(fuse_file->children))) { HashTable_Unlock(file_context->inode_table); - fuse_reply_buf(fuse_req, NULL, 0); + fuse_reply_buf(fuse_req, nullptr, 0); return; } @@ -1173,13 +1173,13 @@ static DWORD WINAPI cliprdr_file_fuse_thread(LPVOID arg) DEBUG_CLIPRDR(file->log, "Starting fuse with mountpoint '%s'", file->path); - struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + struct fuse_args args = FUSE_ARGS_INIT(0, nullptr); fuse_opt_add_arg(&args, file->path); file->fuse_sess = fuse_session_new(&args, &cliprdr_file_fuse_oper, sizeof(cliprdr_file_fuse_oper), (void*)file); (void)SetEvent(file->fuse_start_sync); - if (file->fuse_sess != NULL) + if (file->fuse_sess != nullptr) { if (freerdp_add_signal_cleanup_handler(file, fuse_abort)) { @@ -1208,8 +1208,8 @@ static UINT cliprdr_file_context_server_file_contents_response( CliprdrClientContext* cliprdr_context, const CLIPRDR_FILE_CONTENTS_RESPONSE* file_contents_response) { - CliprdrFileContext* file_context = NULL; - CliprdrFuseRequest* fuse_request = NULL; + CliprdrFileContext* file_context = nullptr; + CliprdrFuseRequest* fuse_request = nullptr; struct fuse_entry_param entry = WINPR_C_ARRAY_INIT; WINPR_ASSERT(cliprdr_context); @@ -1393,7 +1393,7 @@ static CliprdrLocalFile* file_info_for_request(CliprdrFileContext* file, UINT32 HashTable_Foreach(file->local_streams, dump_streams, file); } - return NULL; + return nullptr; } static CliprdrLocalFile* file_for_request(CliprdrFileContext* file, UINT32 lockId, UINT32 listIndex) @@ -1414,7 +1414,7 @@ static CliprdrLocalFile* file_for_request(CliprdrFileContext* file, UINT32 lockI "] failed to open file '%s' [size %" PRId64 "] %s [%d]", lockId, listIndex, f->name, f->size, winpr_strerror(errno, ebuffer, sizeof(ebuffer)), errno); - return NULL; + return nullptr; } } @@ -1444,7 +1444,7 @@ static void cliprdr_local_file_try_close(CliprdrLocalFile* file, UINT res, UINT6 } if (file->fp) (void)fclose(file->fp); - file->fp = NULL; + file->fp = nullptr; } static UINT cliprdr_file_context_server_file_size_request( @@ -1487,7 +1487,7 @@ static UINT cliprdr_file_context_server_file_size_request( static UINT cliprdr_file_context_server_file_range_request( CliprdrFileContext* file, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest) { - BYTE* data = NULL; + BYTE* data = nullptr; WINPR_ASSERT(fileContentsRequest); @@ -1540,12 +1540,12 @@ static UINT change_lock(CliprdrFileContext* file, UINT32 lockId, BOOL lock) CliprdrLocalStream* stream = HashTable_GetItemValue(file->local_streams, &lockId); if (lock && !stream) { - stream = cliprdr_local_stream_new(file, lockId, NULL, 0); + stream = cliprdr_local_stream_new(file, lockId, nullptr, 0); if (!HashTable_Insert(file->local_streams, &lockId, stream)) { rc = ERROR_INTERNAL_ERROR; cliprdr_local_stream_free(stream); - stream = NULL; + stream = nullptr; } file->local_lock_id = lockId; } @@ -1638,7 +1638,7 @@ BOOL cliprdr_file_context_init(CliprdrFileContext* file, CliprdrClientContext* c cliprdr->ServerFileContentsResponse = cliprdr_file_context_server_file_contents_response; CliprdrFuseFile* root_dir = fuse_file_new_root(file); - return root_dir != NULL; + return root_dir != nullptr; #else return TRUE; #endif @@ -1651,7 +1651,7 @@ static void clear_all_selections(CliprdrFileContext* file_context) WINPR_ASSERT(file_context->inode_table); HashTable_Lock(file_context->inode_table); - clear_selection(file_context, TRUE, NULL); + clear_selection(file_context, TRUE, nullptr); HashTable_Clear(file_context->clip_data_table); HashTable_Unlock(file_context->inode_table); @@ -1675,10 +1675,10 @@ BOOL cliprdr_file_context_uninit(CliprdrFileContext* file, CliprdrClientContext* HashTable_Clear(file->local_streams); - file->context = NULL; + file->context = nullptr; #if defined(WITH_FUSE) - cliprdr->ServerFileContentsResponse = NULL; + cliprdr->ServerFileContentsResponse = nullptr; #endif return TRUE; @@ -1738,7 +1738,7 @@ static CliprdrFuseFile* clip_data_dir_new(CliprdrFileContext* file_context, BOOL CliprdrFuseFile* clip_data_dir = fuse_file_new("/%" PRIu64, data_id); if (!clip_data_dir) - return NULL; + return nullptr; clip_data_dir->ino = get_next_free_inode(file_context); clip_data_dir->is_directory = TRUE; @@ -1751,13 +1751,13 @@ static CliprdrFuseFile* clip_data_dir_new(CliprdrFileContext* file_context, BOOL { WLog_Print(file_context->log, WLOG_ERROR, "FUSE root directory missing"); fuse_file_free(clip_data_dir); - return NULL; + return nullptr; } if (!ArrayList_Append(root_dir->children, clip_data_dir)) { WLog_Print(file_context->log, WLOG_ERROR, "Failed to append FUSE file"); fuse_file_free(clip_data_dir); - return NULL; + return nullptr; } clip_data_dir->parent = root_dir; @@ -1767,7 +1767,7 @@ static CliprdrFuseFile* clip_data_dir_new(CliprdrFileContext* file_context, BOOL WLog_Print(file_context->log, WLOG_ERROR, "Failed to insert inode into inode table"); ArrayList_Remove(root_dir->children, clip_data_dir); fuse_file_free(clip_data_dir); - return NULL; + return nullptr; } return clip_data_dir; @@ -1785,7 +1785,7 @@ static char* get_parent_path(const char* filepath) const size_t parent_path_length = 1ULL + (size_t)(base - filepath); char* parent_path = calloc(parent_path_length + 1, sizeof(char)); if (!parent_path) - return NULL; + return nullptr; memcpy(parent_path, filepath, parent_path_length); @@ -1819,14 +1819,14 @@ static CliprdrFuseFile* get_parent_directory(CliprdrFileContext* file_context, c find_context.parent_path = get_parent_path(path); if (!find_context.parent_path) - return NULL; + return nullptr; WINPR_ASSERT(!find_context.parent); if (HashTable_Foreach(file_context->inode_table, is_fuse_file_not_parent, &find_context)) { free(find_context.parent_path); - return NULL; + return nullptr; } WINPR_ASSERT(find_context.parent); @@ -1964,8 +1964,8 @@ static BOOL set_selection_for_clip_data_entry(CliprdrFileContext* file_context, static BOOL update_exposed_path(CliprdrFileContext* file_context, wClipboard* clip, CliprdrFuseClipDataEntry* clip_data_entry) { - wClipboardDelegate* delegate = NULL; - CliprdrFuseFile* clip_data_dir = NULL; + wClipboardDelegate* delegate = nullptr; + CliprdrFuseFile* clip_data_dir = nullptr; WINPR_ASSERT(file_context); WINPR_ASSERT(clip); @@ -1985,7 +1985,7 @@ static BOOL update_exposed_path(CliprdrFileContext* file_context, wClipboard* cl delegate->basePath = file_context->exposed_path; - return delegate->basePath != NULL; + return delegate->basePath != nullptr; } #endif @@ -1993,8 +1993,8 @@ BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file_context, w const void* data, size_t size) { #if defined(WITH_FUSE) - CliprdrFuseClipDataEntry* clip_data_entry = NULL; - FILEDESCRIPTORW* files = NULL; + CliprdrFuseClipDataEntry* clip_data_entry = nullptr; + FILEDESCRIPTORW* files = nullptr; UINT32 n_files = 0; BOOL rc = FALSE; @@ -2123,7 +2123,7 @@ static BOOL create_base_path(CliprdrFileContext* file) if (!file->path) return FALSE; - if (!winpr_PathFileExists(file->path) && !winpr_PathMakePath(file->path, 0)) + if (!winpr_PathFileExists(file->path) && !winpr_PathMakePath(file->path, nullptr)) { WLog_Print(file->log, WLOG_ERROR, "Failed to create directory '%s'", file->path); return FALSE; @@ -2173,7 +2173,7 @@ static void cliprdr_local_files_free(CliprdrLocalStream* stream) cliprdr_local_file_free(&stream->files[x]); free(stream->files); - stream->files = NULL; + stream->files = nullptr; stream->count = 0; } @@ -2199,12 +2199,12 @@ static BOOL append_entry(CliprdrLocalStream* stream, const char* path) static BOOL is_directory(const char* path) { - WCHAR* wpath = ConvertUtf8ToWCharAlloc(path, NULL); + WCHAR* wpath = ConvertUtf8ToWCharAlloc(path, nullptr); if (!wpath) return FALSE; - HANDLE hFile = - CreateFileW(wpath, 0, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFileW(wpath, 0, FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, nullptr); free(wpath); if (hFile == INVALID_HANDLE_VALUE) @@ -2224,7 +2224,7 @@ static BOOL add_directory(CliprdrLocalStream* stream, const char* path) char* wildcardpath = GetCombinedPath(path, "*"); if (!wildcardpath) return FALSE; - WCHAR* wpath = ConvertUtf8ToWCharAlloc(wildcardpath, NULL); + WCHAR* wpath = ConvertUtf8ToWCharAlloc(wildcardpath, nullptr); free(wildcardpath); if (!wpath) return FALSE; @@ -2237,7 +2237,7 @@ static BOOL add_directory(CliprdrLocalStream* stream, const char* path) return FALSE; BOOL rc = FALSE; - char* next = NULL; + char* next = nullptr; WCHAR dotbuffer[6] = WINPR_C_ARRAY_INIT; WCHAR dotdotbuffer[6] = WINPR_C_ARRAY_INIT; @@ -2293,7 +2293,7 @@ static BOOL cliprdr_local_stream_update(CliprdrLocalStream* stream, const char* if (!copy) return FALSE; - char* saveptr = NULL; + char* saveptr = nullptr; char* ptr = strtok_s(copy, "\r\n", &saveptr); while (ptr) { @@ -2312,7 +2312,7 @@ static BOOL cliprdr_local_stream_update(CliprdrLocalStream* stream, const char* if (!res) goto fail; } - ptr = strtok_s(NULL, "\r\n", &saveptr); + ptr = strtok_s(nullptr, "\r\n", &saveptr); } rc = TRUE; @@ -2327,7 +2327,7 @@ CliprdrLocalStream* cliprdr_local_stream_new(CliprdrFileContext* context, UINT32 WINPR_ASSERT(context); CliprdrLocalStream* stream = calloc(1, sizeof(CliprdrLocalStream)); if (!stream) - return NULL; + return nullptr; stream->context = context; if (!cliprdr_local_stream_update(stream, data, size)) @@ -2338,7 +2338,7 @@ CliprdrLocalStream* cliprdr_local_stream_new(CliprdrFileContext* context, UINT32 fail: cliprdr_local_stream_free(stream); - return NULL; + return nullptr; } static UINT32 UINTPointerHash(const void* id) @@ -2361,11 +2361,11 @@ static void* UINTPointerClone(const void* other) { const UINT32* src = other; if (!src) - return NULL; + return nullptr; UINT32* copy = calloc(1, sizeof(UINT32)); if (!copy) - return NULL; + return nullptr; *copy = *src; return copy; @@ -2376,7 +2376,7 @@ CliprdrFuseFile* fuse_file_new_root(CliprdrFileContext* file_context) { CliprdrFuseFile* root_dir = fuse_file_new("/"); if (!root_dir) - return NULL; + return nullptr; root_dir->ino = FUSE_ROOT_ID; root_dir->is_directory = TRUE; @@ -2385,7 +2385,7 @@ CliprdrFuseFile* fuse_file_new_root(CliprdrFileContext* file_context) if (!HashTable_Insert(file_context->inode_table, (void*)(uintptr_t)root_dir->ino, root_dir)) { fuse_file_free(root_dir); - return NULL; + return nullptr; } return root_dir; @@ -2396,7 +2396,7 @@ CliprdrFileContext* cliprdr_file_context_new(void* context) { CliprdrFileContext* file = calloc(1, sizeof(CliprdrFileContext)); if (!file) - return NULL; + return nullptr; file->log = WLog_Get(CLIENT_TAG("common.cliprdr.file")); file->clipboard = context; @@ -2445,11 +2445,11 @@ CliprdrFileContext* cliprdr_file_context_new(void* context) goto fail; #if defined(WITH_FUSE) - if (!(file->fuse_start_sync = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (!(file->fuse_start_sync = CreateEvent(nullptr, TRUE, FALSE, nullptr))) goto fail; - if (!(file->fuse_stop_sync = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (!(file->fuse_stop_sync = CreateEvent(nullptr, TRUE, FALSE, nullptr))) goto fail; - if (!(file->fuse_thread = CreateThread(NULL, 0, cliprdr_file_fuse_thread, file, 0, NULL))) + if (!(file->fuse_thread = CreateThread(nullptr, 0, cliprdr_file_fuse_thread, file, 0, nullptr))) goto fail; if (WaitForSingleObject(file->fuse_start_sync, INFINITE) == WAIT_FAILED) @@ -2462,7 +2462,7 @@ fail: WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC cliprdr_file_context_free(file); WINPR_PRAGMA_DIAG_POP - return NULL; + return nullptr; } BOOL local_stream_discard(const void* key, void* value, void* arg) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 63ac2b676..941cc9d22 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -90,8 +90,8 @@ static BOOL freerdp_client_print_codepages(const char* arg) { size_t count = 0; DWORD column = 2; - const char* filter = NULL; - RDP_CODEPAGE* pages = NULL; + const char* filter = nullptr; + RDP_CODEPAGE* pages = nullptr; if (arg) { @@ -156,7 +156,7 @@ static BOOL freerdp_sanitize_drive_name(char* name, const char* invalid, const c const char with = *replacement++; char* cur = name; - while ((cur = strchr(cur, what)) != NULL) + while ((cur = strchr(cur, what)) != nullptr) *cur = with; } return TRUE; @@ -164,7 +164,7 @@ static BOOL freerdp_sanitize_drive_name(char* name, const char* invalid, const c static char* name_from_path(const char* path) { - const char* name = "NULL"; + const char* name = "nullptr"; if (path) { if (option_equals("%", path)) @@ -181,8 +181,8 @@ static char* name_from_path(const char* path) static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, const char* name) { - char* dname = NULL; - RDPDR_DEVICE* device = NULL; + char* dname = nullptr; + RDPDR_DEVICE* device = nullptr; if (name) { @@ -256,7 +256,7 @@ static BOOL value_to_int(const char* value, LONGLONG* result, LONGLONG min, LONG return FALSE; errno = 0; - rc = _strtoi64(value, NULL, 0); + rc = _strtoi64(value, nullptr, 0); if (errno != 0) return FALSE; @@ -276,7 +276,7 @@ static BOOL value_to_uint(const char* value, ULONGLONG* result, ULONGLONG min, U return FALSE; errno = 0; - rc = _strtoui64(value, NULL, 0); + rc = _strtoui64(value, nullptr, 0); if (errno != 0) return FALSE; @@ -344,7 +344,7 @@ static BOOL is_delimiter(char c, const char* delimiters) static const char* get_last(const char* start, size_t len, const char* delimiters) { - const char* last = NULL; + const char* last = nullptr; for (size_t x = 0; x < len; x++) { char c = start[x]; @@ -410,7 +410,7 @@ static char* print_token(char* text, size_t start_offset, size_t* current, size_ len = MIN(len, (size_t)force_at); if (!print_align(start_offset, current)) - return NULL; + return nullptr; const SSIZE_T delim = next_delimiter(text, len, limit - *current, delimiters); const BOOL isDelim = delim > 0; @@ -421,7 +421,7 @@ static char* print_token(char* text, size_t start_offset, size_t* current, size_ rc = printf("%.*s", (int)len, text); if (rc < 0) - return NULL; + return nullptr; if (isForce || isDelim) { @@ -435,7 +435,7 @@ static char* print_token(char* text, size_t start_offset, size_t* current, size_ *current += (size_t)rc; if (tlen == (size_t)rc) - return NULL; + return nullptr; return &text[(size_t)rc]; } @@ -448,7 +448,7 @@ static size_t print_optionals(const char* text, size_t start_offset, size_t curr do { cur = print_token(cur, start_offset + 1, ¤t, limit, "[], ", "\r\n"); - } while (cur != NULL); + } while (cur != nullptr); free(str); return current; @@ -460,7 +460,7 @@ static size_t print_description(const char* text, size_t start_offset, size_t cu char* str = _strdup(text); char* cur = str; - while (cur != NULL) + while (cur != nullptr) cur = print_token(cur, start_offset, ¤t, limit, " ", "\r\n"); free(str); @@ -568,12 +568,12 @@ static void freerdp_client_print_command_line_args(COMMAND_LINE_ARGUMENT_A* parg } print_description(arg->Text, description_offset, pos); - } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); + } while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr); } BOOL freerdp_client_print_command_line_help(int argc, char** argv) { - return freerdp_client_print_command_line_help_ex(argc, argv, NULL); + return freerdp_client_print_command_line_help_ex(argc, argv, nullptr); } static COMMAND_LINE_ARGUMENT_A* create_merged_args(const COMMAND_LINE_ARGUMENT_A* custom, @@ -595,7 +595,7 @@ static COMMAND_LINE_ARGUMENT_A* create_merged_args(const COMMAND_LINE_ARGUMENT_A calloc((size_t)count + ARRAYSIZE(global_cmd_args), sizeof(COMMAND_LINE_ARGUMENT_A)); *pcount = 0; if (!largs) - return NULL; + return nullptr; size_t lcount = 0; const COMMAND_LINE_ARGUMENT_A* cur = custom; @@ -718,7 +718,7 @@ static int freerdp_client_command_line_pre_filter(void* context, int index, int if (index == 1) { size_t length = 0; - rdpSettings* settings = NULL; + rdpSettings* settings = nullptr; if (argc <= index) return -1; @@ -771,7 +771,7 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, if (!freerdp_settings_set_bool(settings, FreeRDP_DeviceRedirection, TRUE)) return FALSE; if (count < 3) - rc = freerdp_client_add_drive(settings, params[1], NULL); + rc = freerdp_client_add_drive(settings, params[1], nullptr); else rc = freerdp_client_add_drive(settings, params[2], params[1]); @@ -779,7 +779,7 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, } else if (option_equals(params[0], "printer")) { - RDPDR_DEVICE* printer = NULL; + RDPDR_DEVICE* printer = nullptr; if (count < 1) return FALSE; @@ -803,7 +803,7 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, } else if (option_equals(params[0], "smartcard")) { - RDPDR_DEVICE* smartcard = NULL; + RDPDR_DEVICE* smartcard = nullptr; if (count < 1) return FALSE; @@ -829,7 +829,7 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, #if defined(CHANNEL_SERIAL_CLIENT) else if (option_equals(params[0], "serial")) { - RDPDR_DEVICE* serial = NULL; + RDPDR_DEVICE* serial = nullptr; if (count < 1) return FALSE; @@ -855,7 +855,7 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, #endif else if (option_equals(params[0], "parallel")) { - RDPDR_DEVICE* parallel = NULL; + RDPDR_DEVICE* parallel = nullptr; if (count < 1) return FALSE; @@ -890,7 +890,7 @@ BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name) BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count, const char* const* params) { - ADDIN_ARGV* _args = NULL; + ADDIN_ARGV* _args = nullptr; if (!settings || !params || !params[0] || (count > INT_MAX)) return FALSE; @@ -920,7 +920,7 @@ BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name) BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count, const char* const* params) { - ADDIN_ARGV* _args = NULL; + ADDIN_ARGV* _args = nullptr; if (!settings || !params || !params[0] || (count > INT_MAX)) return FALSE; @@ -1039,7 +1039,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI { rdpSettings* settings = (rdpSettings*)context; int status = CHANNEL_RC_OK; - BOOL enable = (arg->Value != NULL); + BOOL enable = (arg->Value != nullptr); CommandLineSwitchStart(arg) CommandLineSwitchCase(arg, "a") { @@ -1063,15 +1063,15 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI if (ptr) { const CmdLineSubOptions opts[] = { - { "kdc-url:", FreeRDP_KerberosKdcUrl, CMDLINE_SUBOPTION_STRING, NULL }, - { "start-time:", FreeRDP_KerberosStartTime, CMDLINE_SUBOPTION_STRING, NULL }, - { "lifetime:", FreeRDP_KerberosLifeTime, CMDLINE_SUBOPTION_STRING, NULL }, + { "kdc-url:", FreeRDP_KerberosKdcUrl, CMDLINE_SUBOPTION_STRING, nullptr }, + { "start-time:", FreeRDP_KerberosStartTime, CMDLINE_SUBOPTION_STRING, nullptr }, + { "lifetime:", FreeRDP_KerberosLifeTime, CMDLINE_SUBOPTION_STRING, nullptr }, { "renewable-lifetime:", FreeRDP_KerberosRenewableLifeTime, - CMDLINE_SUBOPTION_STRING, NULL }, - { "cache:", FreeRDP_KerberosCache, CMDLINE_SUBOPTION_STRING, NULL }, - { "armor:", FreeRDP_KerberosArmor, CMDLINE_SUBOPTION_STRING, NULL }, - { "pkinit-anchors:", FreeRDP_PkinitAnchors, CMDLINE_SUBOPTION_STRING, NULL }, - { "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, NULL } + CMDLINE_SUBOPTION_STRING, nullptr }, + { "cache:", FreeRDP_KerberosCache, CMDLINE_SUBOPTION_STRING, nullptr }, + { "armor:", FreeRDP_KerberosArmor, CMDLINE_SUBOPTION_STRING, nullptr }, + { "pkinit-anchors:", FreeRDP_PkinitAnchors, CMDLINE_SUBOPTION_STRING, nullptr }, + { "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, nullptr } }; for (size_t x = 1; x < count; x++) @@ -1288,10 +1288,10 @@ static BOOL freerdp_parse_username_ptr(const char* username, const char** user, const char* p = strchr(username, '\\'); - *user = NULL; + *user = nullptr; *userlen = 0; - *domain = NULL; + *domain = nullptr; *domainlen = 0; if (p) @@ -1307,7 +1307,7 @@ static BOOL freerdp_parse_username_ptr(const char* username, const char** user, { /* Do not break up the name for '@'; both credSSP and the * ClientInfo PDU expect 'user@corp.net' to be transmitted - * as username 'user@corp.net', domain empty (not NULL!). + * as username 'user@corp.net', domain empty (not nullptr!). */ *user = username; *userlen = strlen(username); @@ -1320,8 +1320,8 @@ static BOOL freerdp_parse_username_settings(const char* username, rdpSettings* s FreeRDP_Settings_Keys_String userID, FreeRDP_Settings_Keys_String domainID) { - const char* user = NULL; - const char* domain = NULL; + const char* user = nullptr; + const char* domain = nullptr; size_t userlen = 0; size_t domainlen = 0; @@ -1335,13 +1335,13 @@ static BOOL freerdp_parse_username_settings(const char* username, rdpSettings* s BOOL freerdp_parse_username(const char* username, char** puser, char** pdomain) { - const char* user = NULL; - const char* domain = NULL; + const char* user = nullptr; + const char* domain = nullptr; size_t userlen = 0; size_t domainlen = 0; - *puser = NULL; - *pdomain = NULL; + *puser = nullptr; + *pdomain = nullptr; const BOOL rc = freerdp_parse_username_ptr(username, &user, &userlen, &domain, &domainlen); if (!rc) @@ -1360,7 +1360,7 @@ BOOL freerdp_parse_username(const char* username, char** puser, char** pdomain) if (!*pdomain) { free(*puser); - *puser = NULL; + *puser = nullptr; return FALSE; } } @@ -1370,7 +1370,7 @@ BOOL freerdp_parse_username(const char* username, char** puser, char** pdomain) BOOL freerdp_parse_hostname(const char* hostname, char** host, int* port) { - char* p = NULL; + char* p = nullptr; p = strrchr(hostname, ':'); if (p) @@ -1564,7 +1564,7 @@ static int freerdp_detect_windows_style_command_line_syntax(int argc, char** arg int status = 0; DWORD flags = 0; int detect_status = 0; - const COMMAND_LINE_ARGUMENT_A* arg = NULL; + const COMMAND_LINE_ARGUMENT_A* arg = nullptr; COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)]; memcpy(largs, global_cmd_args, sizeof(global_cmd_args)); @@ -1579,8 +1579,8 @@ static int freerdp_detect_windows_style_command_line_syntax(int argc, char** arg *count = 0; detect_status = 0; CommandLineClearArgumentsA(largs); - status = CommandLineParseArgumentsA(argc, argv, largs, flags, NULL, - freerdp_detect_command_line_pre_filter, NULL); + status = CommandLineParseArgumentsA(argc, argv, largs, flags, nullptr, + freerdp_detect_command_line_pre_filter, nullptr); if (status < 0) return status; @@ -1593,7 +1593,7 @@ static int freerdp_detect_windows_style_command_line_syntax(int argc, char** arg continue; (*count)++; - } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); + } while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr); return detect_status; } @@ -1604,7 +1604,7 @@ static int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, int status = 0; DWORD flags = 0; int detect_status = 0; - const COMMAND_LINE_ARGUMENT_A* arg = NULL; + const COMMAND_LINE_ARGUMENT_A* arg = nullptr; COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)]; memcpy(largs, global_cmd_args, sizeof(global_cmd_args)); @@ -1620,8 +1620,8 @@ static int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, *count = 0; detect_status = 0; CommandLineClearArgumentsA(largs); - status = CommandLineParseArgumentsA(argc, argv, largs, flags, NULL, - freerdp_detect_command_line_pre_filter, NULL); + status = CommandLineParseArgumentsA(argc, argv, largs, flags, nullptr, + freerdp_detect_command_line_pre_filter, nullptr); if (status < 0) return status; @@ -1634,7 +1634,7 @@ static int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, continue; (*count)++; - } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); + } while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr); return detect_status; } @@ -1679,13 +1679,14 @@ static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* fla int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int status, int argc, char** argv) { - return freerdp_client_settings_command_line_status_print_ex(settings, status, argc, argv, NULL); + return freerdp_client_settings_command_line_status_print_ex(settings, status, argc, argv, + nullptr); } static void freerdp_client_print_keyboard_type_list(const char* msg, DWORD type) { size_t count = 0; - RDP_KEYBOARD_LAYOUT* layouts = NULL; + RDP_KEYBOARD_LAYOUT* layouts = nullptr; layouts = freerdp_keyboard_get_layouts(type, &count); printf("\n%s\n", msg); @@ -1787,7 +1788,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom) { - const COMMAND_LINE_ARGUMENT_A* arg = NULL; + const COMMAND_LINE_ARGUMENT_A* arg = nullptr; COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)]; memcpy(largs, global_cmd_args, sizeof(global_cmd_args)); @@ -1805,7 +1806,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, } else if (status == COMMAND_LINE_STATUS_PRINT) { - (void)CommandLineParseArgumentsA(argc, argv, largs, 0x112, NULL, NULL, NULL); + (void)CommandLineParseArgumentsA(argc, argv, largs, 0x112, nullptr, nullptr, nullptr); arg = CommandLineFindArgumentA(largs, "list"); WINPR_ASSERT(arg); @@ -1820,7 +1821,7 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, freerdp_client_print_keyboard_list(); else if (option_starts_with("kbd-lang", arg->Value)) { - const char* val = NULL; + const char* val = nullptr; if (option_starts_with("kbd-lang:", arg->Value)) val = &arg->Value[9]; else if (!option_equals("kbd-lang", arg->Value)) @@ -1848,11 +1849,11 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, if (opts) { const char* sub = strchr(arg->Value, ':') + 1; - const CmdLineSubOptions options[] = { - { "pkinit-anchors:", FreeRDP_PkinitAnchors, CMDLINE_SUBOPTION_STRING, - NULL }, - { "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, NULL } - }; + const CmdLineSubOptions options[] = { { "pkinit-anchors:", + FreeRDP_PkinitAnchors, + CMDLINE_SUBOPTION_STRING, nullptr }, + { "pkcs11-module:", FreeRDP_Pkcs11Module, + CMDLINE_SUBOPTION_STRING, nullptr } }; size_t count = 0; @@ -1968,8 +1969,8 @@ out: */ static BOOL parseSizeValue(const char* input, unsigned long* v1, unsigned long* v2) { - const char* xcharpos = NULL; - char* endPtr = NULL; + const char* xcharpos = nullptr; + char* endPtr = nullptr; unsigned long v = 0; errno = 0; v = strtoul(input, &endPtr, 10); @@ -2033,7 +2034,7 @@ const char* option_starts_with(const char* what, const char* val) const size_t wlen = strlen(what); if (_strnicmp(what, val, wlen) != 0) - return NULL; + return nullptr; return &val[wlen]; } @@ -2106,7 +2107,7 @@ static PARSE_CLIP_DIR_RESULT parse_clip_direciton_to_option(const char* value) static int parse_tls_ciphers(rdpSettings* settings, const char* Value) { - const char* ciphers = NULL; + const char* ciphers = nullptr; if (!Value) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; @@ -2170,7 +2171,7 @@ static int parse_tls_enforce(rdpSettings* settings, const char* Value) #endif }; - const struct map_t* found = NULL; + const struct map_t* found = nullptr; for (size_t x = 0; x < ARRAYSIZE(map); x++) { const struct map_t* cur = &map[x]; @@ -2489,7 +2490,7 @@ static int parse_host_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT if (!arg->Value) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, nullptr)) return COMMAND_LINE_ERROR_MEMORY; char* p = strchr(arg->Value, '['); @@ -2593,7 +2594,7 @@ static int parse_redirect_prefer_options(rdpSettings* settings, const COMMAND_LI mask = (mask & 0x07); value |= mask << (count * 3); count++; - } while (cur != NULL); + } while (cur != nullptr); if (!freerdp_settings_set_uint32(settings, FreeRDP_RedirectionPreferType, value)) return COMMAND_LINE_ERROR; @@ -2744,7 +2745,7 @@ static int parse_monitors_options(rdpSettings* settings, const COMMAND_LINE_ARGU if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { size_t count = 0; - UINT32* MonitorIds = NULL; + UINT32* MonitorIds = nullptr; char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count); if (!ptr) @@ -2753,7 +2754,7 @@ static int parse_monitors_options(rdpSettings* settings, const COMMAND_LINE_ARGU if (count > 16) count = 16; - if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, NULL, count)) + if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, nullptr, count)) { CommandLineParserFree(ptr); return FALSE; @@ -2782,7 +2783,7 @@ static int parse_dynamic_resolution_options(rdpSettings* settings, WINPR_ASSERT(settings); WINPR_ASSERT(arg); - const BOOL val = arg->Value != 0; + const BOOL val = arg->Value != nullptr; if (val && freerdp_settings_get_bool(settings, FreeRDP_SmartSizing)) { @@ -3546,14 +3547,14 @@ static int parse_reconnect_cookie_options(rdpSettings* settings, const COMMAND_L WINPR_ASSERT(settings); WINPR_ASSERT(arg); - BYTE* base64 = NULL; + BYTE* base64 = nullptr; size_t length = 0; if (!arg->Value) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; crypto_base64_decode((const char*)(arg->Value), strlen(arg->Value), &base64, &length); - if ((base64 != NULL) && (length == sizeof(ARC_SC_PRIVATE_PACKET))) + if ((base64 != nullptr) && (length == sizeof(ARC_SC_PRIVATE_PACKET))) { if (!freerdp_settings_set_pointer_len(settings, FreeRDP_ServerAutoReconnectCookie, base64, 1)) @@ -3650,11 +3651,11 @@ static int parse_smartcard_logon_options(rdpSettings* settings, const COMMAND_LI { "cert:", FreeRDP_SmartcardCertificate, CMDLINE_SUBOPTION_FILE, setSmartcardEmulation }, { "key:", FreeRDP_SmartcardPrivateKey, CMDLINE_SUBOPTION_FILE, setSmartcardEmulation }, - { "pin:", FreeRDP_Password, CMDLINE_SUBOPTION_STRING, NULL }, - { "csp:", FreeRDP_CspName, CMDLINE_SUBOPTION_STRING, NULL }, - { "reader:", FreeRDP_ReaderName, CMDLINE_SUBOPTION_STRING, NULL }, - { "card:", FreeRDP_CardName, CMDLINE_SUBOPTION_STRING, NULL }, - { "container:", FreeRDP_ContainerName, CMDLINE_SUBOPTION_STRING, NULL } + { "pin:", FreeRDP_Password, CMDLINE_SUBOPTION_STRING, nullptr }, + { "csp:", FreeRDP_CspName, CMDLINE_SUBOPTION_STRING, nullptr }, + { "reader:", FreeRDP_ReaderName, CMDLINE_SUBOPTION_STRING, nullptr }, + { "card:", FreeRDP_CardName, CMDLINE_SUBOPTION_STRING, nullptr }, + { "container:", FreeRDP_ContainerName, CMDLINE_SUBOPTION_STRING, nullptr } }; for (size_t x = 1; x < count; x++) @@ -3737,11 +3738,12 @@ static int parse_aad_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_ SSIZE_T id; int (*fkt)(rdpSettings* settings, const char* value); }; - const struct app_map amap[] = { { "tenantid:", FreeRDP_GatewayAvdAadtenantid, NULL }, - { "ad:", FreeRDP_GatewayAzureActiveDirectory, NULL }, - { "avd-access:", FreeRDP_GatewayAvdAccessAadFormat, NULL }, - { "avd-token:", FreeRDP_GatewayAvdAccessTokenFormat, NULL }, - { "avd-scope:", FreeRDP_GatewayAvdScope, NULL } + const struct app_map amap[] = { + { "tenantid:", FreeRDP_GatewayAvdAadtenantid, nullptr }, + { "ad:", FreeRDP_GatewayAzureActiveDirectory, nullptr }, + { "avd-access:", FreeRDP_GatewayAvdAccessAadFormat, nullptr }, + { "avd-token:", FreeRDP_GatewayAvdAccessTokenFormat, nullptr }, + { "avd-scope:", FreeRDP_GatewayAvdScope, nullptr } }; for (size_t x = 0; x < count; x++) @@ -3818,15 +3820,16 @@ static int parse_app_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_ SSIZE_T id; int (*fkt)(rdpSettings* settings, const char* value); }; - const struct app_map amap[] = { { "program:", FreeRDP_RemoteApplicationProgram, - parse_app_option_program }, - { "workdir:", FreeRDP_RemoteApplicationWorkingDir, NULL }, - { "name:", FreeRDP_RemoteApplicationName, NULL }, - { "icon:", FreeRDP_RemoteApplicationIcon, NULL }, - { "cmd:", FreeRDP_RemoteApplicationCmdLine, NULL }, - { "file:", FreeRDP_RemoteApplicationFile, NULL }, - { "guid:", FreeRDP_RemoteApplicationGuid, NULL }, - { "hidef:", FreeRDP_HiDefRemoteApp, NULL } }; + const struct app_map amap[] = { + { "program:", FreeRDP_RemoteApplicationProgram, parse_app_option_program }, + { "workdir:", FreeRDP_RemoteApplicationWorkingDir, nullptr }, + { "name:", FreeRDP_RemoteApplicationName, nullptr }, + { "icon:", FreeRDP_RemoteApplicationIcon, nullptr }, + { "cmd:", FreeRDP_RemoteApplicationCmdLine, nullptr }, + { "file:", FreeRDP_RemoteApplicationFile, nullptr }, + { "guid:", FreeRDP_RemoteApplicationGuid, nullptr }, + { "hidef:", FreeRDP_HiDefRemoteApp, nullptr } + }; for (size_t x = 0; x < count; x++) { BOOL handled = FALSE; @@ -3970,7 +3973,7 @@ static BOOL parse_gateway_host_option(rdpSettings* settings, const char* host) WINPR_ASSERT(settings); WINPR_ASSERT(host); - char* name = NULL; + char* name = nullptr; int port = -1; if (!freerdp_parse_hostname(host, &name, &port)) return FALSE; @@ -4090,7 +4093,7 @@ static char* unescape(const char* str) { char* copy = _strdup(str); if (!copy) - return NULL; + return nullptr; bool escaped = false; char* dst = copy; @@ -4122,7 +4125,7 @@ static char* unescape(const char* str) static BOOL parse_gateway_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_A* arg) { - char* argval = NULL; + char* argval = nullptr; BOOL rc = FALSE; WINPR_ASSERT(settings); @@ -4286,7 +4289,7 @@ static void fill_credential_strings(COMMAND_LINE_ARGUMENT_A* args) if (arg && ((arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT) != 0)) { const char* gwcreds[] = { "p:", "access-token:" }; - char* saveptr = NULL; + char* saveptr = nullptr; char* tok = strtok_s(arg->Value, ",", &saveptr); while (tok) { @@ -4299,7 +4302,7 @@ static void fill_credential_strings(COMMAND_LINE_ARGUMENT_A* args) FillMemory(val, strlen(val), '*'); } } - tok = strtok_s(NULL, ",", &saveptr); + tok = strtok_s(nullptr, ",", &saveptr); } } } @@ -4704,7 +4707,7 @@ static int parse_command_line(rdpSettings* settings, const COMMAND_LINE_ARGUMENT do { - BOOL enable = (arg->Value != NULL); + BOOL enable = (arg->Value != nullptr); if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)) continue; @@ -4975,7 +4978,7 @@ static int parse_command_line(rdpSettings* settings, const COMMAND_LINE_ARGUMENT } CommandLineSwitchCase(arg, "ipv4") { - if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) + if (arg->Value != nullptr && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 4)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4988,7 +4991,7 @@ static int parse_command_line(rdpSettings* settings, const COMMAND_LINE_ARGUMENT } CommandLineSwitchCase(arg, "ipv6") { - if (arg->Value != NULL && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) + if (arg->Value != nullptr && strncmp(arg->Value, str_force, ARRAYSIZE(str_force)) == 0) { if (!freerdp_settings_set_uint32(settings, FreeRDP_ForceIPvX, 6)) return fail_at(arg, COMMAND_LINE_ERROR); @@ -5500,7 +5503,7 @@ static int parse_command_line(rdpSettings* settings, const COMMAND_LINE_ARGUMENT } } CommandLineSwitchEnd(arg) - } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); + } while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr); return 0; } @@ -5538,14 +5541,14 @@ static int freerdp_client_settings_parse_command_line_arguments_int( COMMAND_LINE_ARGUMENT_A* largs, WINPR_ATTR_UNUSED size_t count, freerdp_command_line_handle_option_t handle_option, void* handle_userdata, bool isArgsFrom) { - char* user = NULL; + char* user = nullptr; int status = 0; BOOL ext = FALSE; BOOL assist = FALSE; DWORD flags = 0; BOOL promptForPassword = FALSE; BOOL compatibility = FALSE; - const COMMAND_LINE_ARGUMENT_A* arg = NULL; + const COMMAND_LINE_ARGUMENT_A* arg = nullptr; /* Command line detection fails if only a .rdp or .msrcIncident file * is supplied. Check this case first, only then try to detect @@ -5561,11 +5564,11 @@ static int freerdp_client_settings_parse_command_line_arguments_int( else compatibility = freerdp_client_detect_command_line(argc - 1, &argv[1], &flags); - if (!freerdp_settings_set_string(settings, FreeRDP_ProxyHostname, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_ProxyHostname, nullptr)) return -1; - if (!freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, nullptr)) return -1; - if (!freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, nullptr)) return -1; if (compatibility) @@ -5618,10 +5621,10 @@ static int freerdp_client_settings_parse_command_line_arguments_int( { if (!freerdp_settings_get_string(settings, FreeRDP_Domain) && user) { - if (!freerdp_settings_set_string(settings, FreeRDP_Username, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_Username, nullptr)) return COMMAND_LINE_ERROR; - if (!freerdp_settings_set_string(settings, FreeRDP_Domain, NULL)) + if (!freerdp_settings_set_string(settings, FreeRDP_Domain, nullptr)) return COMMAND_LINE_ERROR; if (!freerdp_parse_username_settings(user, settings, FreeRDP_Username, FreeRDP_Domain)) @@ -5707,7 +5710,7 @@ static void argv_free(int* pargc, char** pargv[]) const int argc = *pargc; char** argv = *pargv; *pargc = 0; - *pargv = NULL; + *pargv = nullptr; if (!argv) return; @@ -5740,7 +5743,7 @@ static BOOL argv_append(int* pargc, char** pargv[], char* what) static BOOL argv_append_dup(int* pargc, char** pargv[], const char* what) { - char* copy = NULL; + char* copy = nullptr; if (what) copy = _strdup(what); @@ -5767,7 +5770,7 @@ static BOOL args_from_fp(FILE* fp, int* aargc, char** aargv[], const char* file, goto fail; while (!feof(fp)) { - char* line = NULL; + char* line = nullptr; size_t size = 0; INT64 rc = GetLine(&line, &size, fp); if ((rc < 0) || !line) @@ -5814,7 +5817,7 @@ static BOOL args_from_env(const char* name, int* aargc, char** aargv[], const ch const char* cmd) { BOOL success = FALSE; - char* env = NULL; + char* env = nullptr; WINPR_ASSERT(aargc); WINPR_ASSERT(aargv); @@ -5853,13 +5856,13 @@ static BOOL args_from_env(const char* name, int* aargc, char** aargv[], const ch goto cleanup; { - char* context = NULL; + char* context = nullptr; char* tok = strtok_s(env, "\n", &context); while (tok) { if (!argv_append_dup(aargc, aargv, tok)) goto cleanup; - tok = strtok_s(NULL, "\n", &context); + tok = strtok_s(nullptr, "\n", &context); } } @@ -5875,7 +5878,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, char* oargv[], BOOL allowUnknown) { return freerdp_client_settings_parse_command_line_arguments_ex( - settings, oargc, oargv, allowUnknown, NULL, 0, NULL, NULL); + settings, oargc, oargv, allowUnknown, nullptr, 0, nullptr, nullptr); } int freerdp_client_settings_parse_command_line_arguments_ex( @@ -5887,7 +5890,7 @@ int freerdp_client_settings_parse_command_line_arguments_ex( char** argv = oargv; int res = -1; int aargc = 0; - char** aargv = NULL; + char** aargv = nullptr; bool isArgsFrom = false; if ((argc == 2) && option_starts_with("/args-from:", argv[1])) @@ -5943,13 +5946,14 @@ fail: static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data) { - PVIRTUALCHANNELENTRY entry = NULL; + PVIRTUALCHANNELENTRY entry = nullptr; PVIRTUALCHANNELENTRY pvce = freerdp_load_channel_addin_entry( - name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX); + name, nullptr, nullptr, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX); PVIRTUALCHANNELENTRYEX pvceex = WINPR_FUNC_PTR_CAST(pvce, PVIRTUALCHANNELENTRYEX); if (!pvceex) - entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC); + entry = + freerdp_load_channel_addin_entry(name, nullptr, nullptr, FREERDP_ADDIN_CHANNEL_STATIC); if (pvceex) { @@ -5982,46 +5986,46 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) { ChannelToLoad dynChannels[] = { #if defined(CHANNEL_AINPUT_CLIENT) - { FreeRDP_BOOL_UNUSED, AINPUT_CHANNEL_NAME, NULL }, /* always loaded */ + { FreeRDP_BOOL_UNUSED, AINPUT_CHANNEL_NAME, nullptr }, /* always loaded */ #endif #ifdef CHANNEL_AUDIN_CLIENT - { FreeRDP_AudioCapture, AUDIN_CHANNEL_NAME, NULL }, + { FreeRDP_AudioCapture, AUDIN_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_RDPSND_CLIENT - { FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, NULL }, + { FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_RDPEI_CLIENT - { FreeRDP_MultiTouchInput, RDPEI_CHANNEL_NAME, NULL }, + { FreeRDP_MultiTouchInput, RDPEI_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_RDPGFX_CLIENT - { FreeRDP_SupportGraphicsPipeline, RDPGFX_CHANNEL_NAME, NULL }, + { FreeRDP_SupportGraphicsPipeline, RDPGFX_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_ECHO_CLIENT - { FreeRDP_SupportEchoChannel, ECHO_CHANNEL_NAME, NULL }, + { FreeRDP_SupportEchoChannel, ECHO_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_SSHAGENT_CLIENT - { FreeRDP_SupportSSHAgentChannel, "sshagent", NULL }, + { FreeRDP_SupportSSHAgentChannel, "sshagent", nullptr }, #endif #ifdef CHANNEL_DISP_CLIENT - { FreeRDP_SupportDisplayControl, DISP_CHANNEL_NAME, NULL }, + { FreeRDP_SupportDisplayControl, DISP_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_GEOMETRY_CLIENT - { FreeRDP_SupportGeometryTracking, GEOMETRY_CHANNEL_NAME, NULL }, + { FreeRDP_SupportGeometryTracking, GEOMETRY_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_VIDEO_CLIENT - { FreeRDP_SupportVideoOptimized, VIDEO_CHANNEL_NAME, NULL }, + { FreeRDP_SupportVideoOptimized, VIDEO_CHANNEL_NAME, nullptr }, #endif #ifdef CHANNEL_RDPEAR_CLIENT - { FreeRDP_RemoteCredentialGuard, RDPEAR_CHANNEL_NAME, NULL }, + { FreeRDP_RemoteCredentialGuard, RDPEAR_CHANNEL_NAME, nullptr }, #endif }; ChannelToLoad staticChannels[] = { #if defined(CHANNEL_RDPSND_CLIENT) - { FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, NULL }, + { FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, nullptr }, #endif #if defined(CHANNEL_CLIPRDR_CLIENT) - { FreeRDP_RedirectClipboard, CLIPRDR_SVC_CHANNEL_NAME, NULL }, + { FreeRDP_RedirectClipboard, CLIPRDR_SVC_CHANNEL_NAME, nullptr }, #endif #if defined(CHANNEL_ENCOMSP_CLIENT) { FreeRDP_EncomspVirtualChannel, ENCOMSP_SVC_CHANNEL_NAME, settings }, @@ -6089,9 +6093,9 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) * Very similar to DevicesToRedirect, but can contain a * comma-separated list of drive letters to redirect. */ - char* value = NULL; - char* tok = NULL; - char* context = NULL; + char* value = nullptr; + char* tok = nullptr; + char* context = nullptr; value = _strdup(DrivesToRedirect); if (!value) @@ -6117,19 +6121,19 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) */ /* TODO: Need to properly escape labels and paths */ BOOL success = 0; - const char* name = NULL; + const char* name = nullptr; const char* drive = tok; - char* subcontext = NULL; + char* subcontext = nullptr; char* start = strtok_s(tok, "(", &subcontext); - char* end = strtok_s(NULL, ")", &subcontext); + char* end = strtok_s(nullptr, ")", &subcontext); if (start && end) name = end; - if (freerdp_path_valid(name, NULL) && freerdp_path_valid(drive, NULL)) + if (freerdp_path_valid(name, nullptr) && freerdp_path_valid(drive, nullptr)) { - success = freerdp_client_add_drive(settings, name, NULL); + success = freerdp_client_add_drive(settings, name, nullptr); if (success) - success = freerdp_client_add_drive(settings, drive, NULL); + success = freerdp_client_add_drive(settings, drive, nullptr); } else success = freerdp_client_add_drive(settings, drive, name); @@ -6140,7 +6144,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) return FALSE; } - tok = strtok_s(NULL, ";", &context); + tok = strtok_s(nullptr, ";", &context); } free(value); @@ -6202,7 +6206,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) { if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_SMARTCARD)) { - RDPDR_DEVICE* smartcard = freerdp_device_new(RDPDR_DTYP_SMARTCARD, 0, NULL); + RDPDR_DEVICE* smartcard = freerdp_device_new(RDPDR_DTYP_SMARTCARD, 0, nullptr); if (!smartcard) return FALSE; @@ -6219,7 +6223,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) { if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_PRINT)) { - RDPDR_DEVICE* printer = freerdp_device_new(RDPDR_DTYP_PRINT, 0, NULL); + RDPDR_DEVICE* printer = freerdp_device_new(RDPDR_DTYP_PRINT, 0, nullptr); if (!printer) return FALSE; diff --git a/client/common/cmdline.h b/client/common/cmdline.h index 40f653556..8b45dbcb0 100644 --- a/client/common/cmdline.h +++ b/client/common/cmdline.h @@ -25,78 +25,79 @@ #include static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = { - { "a", COMMAND_LINE_VALUE_REQUIRED, "[,]", NULL, NULL, -1, "addin", "Addin" }, + { "a", COMMAND_LINE_VALUE_REQUIRED, "[,]", nullptr, nullptr, -1, "addin", + "Addin" }, { "azure", COMMAND_LINE_VALUE_REQUIRED, "[tenantid:],[use-tenantid[:[on|off]],[ad:]" "[avd-access:],[avd-token:],[avd-scope:]", - NULL, NULL, -1, NULL, "AzureAD options" }, + nullptr, nullptr, -1, nullptr, "AzureAD options" }, { "action-script", COMMAND_LINE_VALUE_REQUIRED, "", "~/.config/freerdp/action.sh", - NULL, -1, NULL, "Action script" }, - { "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", + nullptr, -1, nullptr, "Action script" }, + { "admin", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, "console", "Admin (or console) session" }, - { "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, + { "aero", COMMAND_LINE_VALUE_BOOL, nullptr, nullptr, BoolValueFalse, -1, nullptr, "desktop composition" }, { "app", COMMAND_LINE_VALUE_REQUIRED, "program:[|<||alias>],cmd:,file:,guid:,icon:,name:<" "name>,workdir:,hidef:[on|off]", - NULL, NULL, -1, NULL, "Remote application program" }, + nullptr, nullptr, -1, nullptr, "Remote application program" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "app-cmd", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-cmd", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:cmd:] Remote application command-line parameters" }, - { "app-file", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-file", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:file:] File to open with remote application" }, - { "app-guid", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-guid", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:guid:] Remote application GUID" }, - { "app-icon", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-icon", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:icon:] Remote application icon for user interface" }, - { "app-name", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-name", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:name:] Remote application name for user interface" }, - { "app-workdir", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "app-workdir", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /app:workdir:] Remote application workspace path" }, #endif - { "assistance", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "assistance", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Remote assistance password" }, - { "auto-request-control", COMMAND_LINE_VALUE_FLAG, "", NULL, NULL, -1, NULL, + { "auto-request-control", COMMAND_LINE_VALUE_FLAG, "", nullptr, nullptr, -1, nullptr, "Automatically request remote assistance input control" }, - { "async-channels", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "async-channels", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Asynchronous channels (experimental)" }, - { "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "async-update", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Asynchronous update" }, - { "audio-mode", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "audio-mode", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Audio output mode" }, - { "auth-only", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "auth-only", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Authenticate only" }, - { "auth-pkg-list", COMMAND_LINE_VALUE_REQUIRED, "[[none],]", NULL, NULL, - -1, NULL, + { "auth-pkg-list", COMMAND_LINE_VALUE_REQUIRED, "[[none],]", nullptr, + nullptr, -1, nullptr, "Authentication package filter (comma-separated list, use '!' to disable). By default " "all methods are enabled. Use explicit 'none' as first argument to disable all methods, " "selectively enabling only the ones following." }, - { "authentication", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "authentication", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Authentication (experimental)" }, - { "auto-reconnect", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "auto-reconnect", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Automatic reconnection" }, - { "auto-reconnect-max-retries", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Automatic reconnection maximum retries, 0 for unlimited [0,1000]" }, + { "auto-reconnect-max-retries", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, + nullptr, "Automatic reconnection maximum retries, 0 for unlimited [0,1000]" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "bitmap-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "bitmap-cache", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "[DEPRECATED, use /cache:bitmap[:on|off]] bitmap cache" }, - { "persist-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "persist-cache", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "[DEPRECATED, use /cache:persist[:on|off]] persistent bitmap cache" }, - { "persist-cache-file", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "[DEPRECATED, use /cache:persist-file:] persistent bitmap cache file" }, + { "persist-cache-file", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, + nullptr, "[DEPRECATED, use /cache:persist-file:] persistent bitmap cache file" }, #endif - { "bpp", COMMAND_LINE_VALUE_REQUIRED, "", "16", NULL, -1, NULL, + { "bpp", COMMAND_LINE_VALUE_REQUIRED, "", "16", nullptr, -1, nullptr, "Session bpp (color depth)" }, - { "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL, -1, - NULL, "Print the build configuration" }, + { "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, nullptr, nullptr, + nullptr, -1, nullptr, "Print the build configuration" }, { "cache", COMMAND_LINE_VALUE_REQUIRED, "[bitmap[:on|off],codec[:rfx|nsc],glyph[:on|off],offscreen[:on|off],persist,persist-file:<" "filename>]", - NULL, NULL, -1, NULL, "" }, + nullptr, nullptr, -1, nullptr, "" }, { "cert", COMMAND_LINE_VALUE_REQUIRED, "[deny,ignore,name:,tofu,fingerprint::[,fingerprint::]]", - NULL, NULL, -1, NULL, + nullptr, nullptr, -1, nullptr, "Certificate accept options. Use with care!\n" " * deny ... Automatically abort connection if the certificate does not match, no " "user interaction.\n" @@ -108,82 +109,83 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = { " * fingerprints ... A list of certificate hashes that are accepted unconditionally for a " "connection" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "cert-deny", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, + { "cert-deny", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /cert:deny] Automatically abort connection for any certificate that can " "not be validated." }, - { "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, + { "cert-ignore", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /cert:ignore] Ignore certificate" }, - { "cert-name", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "cert-name", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /cert:name:] Certificate name" }, - { "cert-tofu", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, + { "cert-tofu", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /cert:tofu] Automatically accept certificate on first connect" }, #endif #ifdef _WIN32 - { "connect-child-session", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, "", + { "connect-child-session", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, "", "connect to child session (win32)" }, #endif - { "client-build-number", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "client-build-number", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Client Build Number sent to server (influences smartcard behaviour, see [MS-RDPESC])" }, - { "client-hostname", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "client-hostname", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Client Hostname to send to server" }, { "clipboard", COMMAND_LINE_VALUE_BOOL | COMMAND_LINE_VALUE_OPTIONAL, "[[use-selection:],[direction-to:[all|local|remote|off]],[files-to[:all|local|remote|" "off]]]", - BoolValueTrue, NULL, -1, NULL, + BoolValueTrue, nullptr, -1, nullptr, "Redirect clipboard:\n" " * use-selection: ... (X11) Specify which X selection to access. Default is " "CLIPBOARD. PRIMARY is the X-style middle-click selection.\n" " * direction-to:[all|local|remote|off] control enabled clipboard direction\n" " * files-to:[all|local|remote|off] control enabled file clipboard direction" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "[rfx|nsc|jpeg]", NULL, NULL, -1, NULL, + { "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "[rfx|nsc|jpeg]", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /cache:codec:[rfx|nsc|jpeg]] Bitmap codec cache" }, #endif - { "compression", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, "z", "compression" }, - { "compression-level", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "compression", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, "z", + "compression" }, + { "compression-level", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Compression level (0,1,2)" }, - { "credentials-delegation", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, - "credentials delegation" }, - { "d", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Domain" }, - { "decorations", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "credentials-delegation", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, + nullptr, "credentials delegation" }, + { "d", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Domain" }, + { "decorations", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Window decorations" }, - { "disp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Display control" }, - { "drive", COMMAND_LINE_VALUE_REQUIRED, ",", NULL, NULL, -1, NULL, + { "disp", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "Display control" }, + { "drive", COMMAND_LINE_VALUE_REQUIRED, ",", nullptr, nullptr, -1, nullptr, "Redirect directory as named share . Hotplug support is enabled with " "/drive:hotplug,*. This argument provides the same function as \"Drives that I plug in " "later\" option in MSTSC." }, - { "drives", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "drives", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Redirect all mount points as shares" }, - { "dump", COMMAND_LINE_VALUE_REQUIRED, ",file:[,nodelay]", NULL, NULL, -1, - NULL, "record or replay dump" }, - { "dvc", COMMAND_LINE_VALUE_REQUIRED, "[,]", NULL, NULL, -1, NULL, + { "dump", COMMAND_LINE_VALUE_REQUIRED, ",file:[,nodelay]", nullptr, + nullptr, -1, nullptr, "record or replay dump" }, + { "dvc", COMMAND_LINE_VALUE_REQUIRED, "[,]", nullptr, nullptr, -1, nullptr, "Dynamic virtual channel" }, - { "dynamic-resolution", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "dynamic-resolution", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Send resolution updates when the window is resized" }, - { "echo", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "echo", "Echo channel" }, - { "encryption", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "echo", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, "echo", "Echo channel" }, + { "encryption", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Encryption (experimental)" }, - { "encryption-methods", COMMAND_LINE_VALUE_REQUIRED, "[40,][56,][128,][FIPS]", NULL, NULL, -1, - NULL, "RDP standard security encryption methods" }, - { "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, + { "encryption-methods", COMMAND_LINE_VALUE_REQUIRED, "[40,][56,][128,][FIPS]", nullptr, nullptr, + -1, nullptr, "RDP standard security encryption methods" }, + { "f", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "Fullscreen mode (++ toggles fullscreen)" }, - { "fipsmode", COMMAND_LINE_VALUE_BOOL, NULL, NULL, NULL, -1, NULL, "FIPS mode" }, + { "fipsmode", COMMAND_LINE_VALUE_BOOL, nullptr, nullptr, nullptr, -1, nullptr, "FIPS mode" }, { "floatbar", COMMAND_LINE_VALUE_OPTIONAL, - "sticky:[on|off],default:[visible|hidden],show:[always|fullscreen|window]", NULL, NULL, -1, - NULL, + "sticky:[on|off],default:[visible|hidden],show:[always|fullscreen|window]", nullptr, nullptr, + -1, nullptr, "floatbar is disabled by default (when enabled defaults to sticky in fullscreen mode)" }, - { "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "fonts", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "smooth fonts (ClearType)" }, - { "force-console-callbacks", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, - "Use default callbacks (console) for certificate/credential/..." }, - { "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "force-console-callbacks", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, + nullptr, "Use default callbacks (console) for certificate/credential/..." }, + { "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "Number of frame acknowledgement" }, - { "args-from", COMMAND_LINE_VALUE_REQUIRED, "|stdin|fd:|env:", NULL, NULL, - -1, NULL, + { "args-from", COMMAND_LINE_VALUE_REQUIRED, "|stdin|fd:|env:", nullptr, + nullptr, -1, nullptr, "Read command line from a file, stdin or file descriptor. This argument can not be combined " "with any other. " "Provide one argument per line." }, - { "from-stdin", COMMAND_LINE_VALUE_OPTIONAL, "force", NULL, NULL, -1, NULL, + { "from-stdin", COMMAND_LINE_VALUE_OPTIONAL, "force", nullptr, nullptr, -1, nullptr, "Read credentials from stdin. With the prompt is done before connection, otherwise " "on server request." }, { "gateway", COMMAND_LINE_VALUE_REQUIRED, @@ -191,83 +193,85 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = { "direct|detect],access-token:<" "token>,type:[rpc|http[,no-websockets][,extauth-sspi-ntlm]|auto[,no-websockets][,extauth-" "sspi-ntlm]]|arm,url:,bearer:", - NULL, NULL, -1, "gw", "Gateway Hostname" }, + nullptr, nullptr, -1, "gw", "Gateway Hostname" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "g", COMMAND_LINE_VALUE_REQUIRED, "[:]", NULL, NULL, -1, NULL, + { "g", COMMAND_LINE_VALUE_REQUIRED, "[:]", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /gateway:g:] Gateway Hostname" }, - { "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "[direct|detect]", NULL, NULL, -1, "gum", - "[DEPRECATED, use /gateway:usage-method:] Gateway usage method" }, - { "gd", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "[direct|detect]", nullptr, nullptr, -1, + "gum", "[DEPRECATED, use /gateway:usage-method:] Gateway usage method" }, + { "gd", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /gateway:d:] Gateway domain" }, #endif - { "gdi", COMMAND_LINE_VALUE_REQUIRED, "sw|hw", NULL, NULL, -1, NULL, "GDI rendering" }, - { "geometry", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, + { "gdi", COMMAND_LINE_VALUE_REQUIRED, "sw|hw", nullptr, nullptr, -1, nullptr, "GDI rendering" }, + { "geometry", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, "Geometry tracking channel" }, - { "gestures", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "gestures", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Consume multitouch input locally" }, #ifdef WITH_GFX_H264 { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[[progressive[:on|off]|RFX[:on|off]|AVC420[:on|off]AVC444[:on|off]],mask:,small-" "cache[:on|off],thin-client[:on|off],progressive[:on|" "off],frame-ack[:on|off]]", - NULL, NULL, -1, NULL, "RDP8 graphics pipeline" }, + nullptr, nullptr, -1, nullptr, "RDP8 graphics pipeline" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "[[AVC420|AVC444],mask:]", NULL, NULL, -1, - NULL, "[DEPRECATED, use /gfx:avc420] RDP8.1 graphics pipeline using H264 codec" }, + { "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "[[AVC420|AVC444],mask:]", nullptr, nullptr, + -1, nullptr, "[DEPRECATED, use /gfx:avc420] RDP8.1 graphics pipeline using H264 codec" }, #endif #else { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[progressive[:on|off]|RFX[:on|off]|AVC420[:on|off]AVC444[:on|off]],mask:,small-cache[" ":on|off],thin-client[:on|off],progressive[:on|off]]", - NULL, NULL, -1, NULL, "RDP8 graphics pipeline" }, + nullptr, nullptr, -1, nullptr, "RDP8 graphics pipeline" }, #endif #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "gfx-progressive", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "[DEPRECATED, use /gfx:progressive] RDP8 graphics pipeline using progressive codec" }, - { "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "[DEPRECATED, use /gfx:small-cache] RDP8 graphics pipeline using small cache mode" }, - { "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "[DEPRECATED, use /gfx:thin-client] RDP8 graphics pipeline using thin client mode" }, - { "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "glyph-cache", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "[DEPRECATED, use /cache:glyph[:on|off]] Glyph cache (experimental)" }, #endif #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "gp", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "gp", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /gateway:p:] Gateway password" }, #endif - { "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "grab-keyboard", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Grab keyboard focus, forward all keys to remote" }, - { "grab-mouse", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "grab-mouse", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Grab mouse focus, forward all events to remote" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) { "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http[,no-websockets][,extauth-sspi-ntlm]|auto[,no-websockets][,extauth-sspi-ntlm]]", - NULL, NULL, -1, NULL, "[DEPRECATED, use /gateway:type:] Gateway transport type" }, - { "gu", COMMAND_LINE_VALUE_REQUIRED, "[[\\]|[@]]", NULL, NULL, -1, - NULL, "[DEPRECATED, use /gateway:u:] Gateway username" }, - { "gat", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + nullptr, nullptr, -1, nullptr, + "[DEPRECATED, use /gateway:type:] Gateway transport type" }, + { "gu", COMMAND_LINE_VALUE_REQUIRED, "[[\\]|[@]]", nullptr, nullptr, + -1, nullptr, "[DEPRECATED, use /gateway:u:] Gateway username" }, + { "gat", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /gateway:access-token:] Gateway Access Token" }, #endif - { "h", COMMAND_LINE_VALUE_REQUIRED, "", "768", NULL, -1, NULL, "Height" }, - { "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + { "h", COMMAND_LINE_VALUE_REQUIRED, "", "768", nullptr, -1, nullptr, "Height" }, + { "heartbeat", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueTrue, nullptr, -1, nullptr, "Support heartbeat PDUs" }, - { "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", + { "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, nullptr, nullptr, nullptr, -1, "?", "Print help" }, - { "home-drive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, + { "home-drive", COMMAND_LINE_VALUE_BOOL, nullptr, BoolValueFalse, nullptr, -1, nullptr, "Redirect user home as share" }, - { "ipv4", COMMAND_LINE_VALUE_OPTIONAL, "[:force]", NULL, NULL, -1, "4", + { "ipv4", COMMAND_LINE_VALUE_OPTIONAL, "[:force]", nullptr, nullptr, -1, "4", "Prefer IPv4 A record over IPv6 AAAA record" }, - { "ipv6", COMMAND_LINE_VALUE_OPTIONAL, "[:force]", NULL, NULL, -1, "6", + { "ipv6", COMMAND_LINE_VALUE_OPTIONAL, "[:force]", nullptr, nullptr, -1, "6", "Prefer IPv6 AAAA record over IPv4 A record" }, #if defined(WITH_JPEG) - { "jpeg", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "JPEG codec support" }, - { "jpeg-quality", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "jpeg", COMMAND_LINE_VALUE_FLAG, nullptr, nullptr, nullptr, -1, nullptr, + "JPEG codec support" }, + { "jpeg-quality", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "JPEG quality" }, #endif { "kbd", COMMAND_LINE_VALUE_REQUIRED, "[layout:[0x|],lang:<0x>,fn-key:,type:,subtype:,unicode[:" "on|off],remap:=,remap:=,pipe:]", - NULL, NULL, -1, NULL, + nullptr, nullptr, -1, nullptr, "Keyboard related options:\n" " * layout: set the keybouard layout announced to the server\n" " * lang: set the keyboard language identifier sent to the server\n" @@ -277,24 +281,24 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = { "'a' and 's' on a US keyboard: /kbd:remap:0x1e=0x1f,remap:0x1f=0x1e\n" " * pipe: Name of a named pipe that can be used to type text into the RDP session\n" }, #if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE) - { "kbd-lang", COMMAND_LINE_VALUE_REQUIRED, "0x", NULL, NULL, -1, NULL, + { "kbd-lang", COMMAND_LINE_VALUE_REQUIRED, "0x", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use / kbd:lang:] Keyboard active language identifier" }, - { "kbd-fn-key", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "kbd-fn-key", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /kbd:fn-key:] Function key value" }, - { "kbd-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, - "[DEPRECATED, use /list:kbd] List keyboard layouts" }, - { "kbd-scancode-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, - "[DEPRECATED, use list:kbd-scancode] List keyboard RDP scancodes" }, - { "kbd-lang-list", COMMAND_LINE_VALUE_OPTIONAL | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, - "[DEPRECATED, use /list:kbd-lang] List keyboard languages" }, + { "kbd-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, nullptr, nullptr, nullptr, -1, + nullptr, "[DEPRECATED, use /list:kbd] List keyboard layouts" }, + { "kbd-scancode-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, nullptr, nullptr, nullptr, + -1, nullptr, "[DEPRECATED, use list:kbd-scancode] List keyboard RDP scancodes" }, + { "kbd-lang-list", COMMAND_LINE_VALUE_OPTIONAL | COMMAND_LINE_PRINT, nullptr, nullptr, nullptr, + -1, nullptr, "[DEPRECATED, use /list:kbd-lang] List keyboard languages" }, { "kbd-remap", COMMAND_LINE_VALUE_REQUIRED, - "[DEPRECATED, use /kbd:remap] List of =,... pairs to remap scancodes", NULL, NULL, - -1, NULL, "Keyboard scancode remapping" }, - { "kbd-subtype", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + "[DEPRECATED, use /kbd:remap] List of =,... pairs to remap scancodes", nullptr, + nullptr, -1, nullptr, "Keyboard scancode remapping" }, + { "kbd-subtype", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /kbd:subtype]Keyboard subtype" }, - { "kbd-type", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, + { "kbd-type", COMMAND_LINE_VALUE_REQUIRED, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /kbd:type] Keyboard type" }, - { "kbd-unicode", COMMAND_LINE_VALUE_FLAG, "", NULL, NULL, -1, NULL, + { "kbd-unicode", COMMAND_LINE_VALUE_FLAG, "", nullptr, nullptr, -1, nullptr, "[DEPRECATED, use /kbd:unicode[:on|off]] Send unicode symbols, e.g. use the local " "keyboard map. ATTENTION: Does not work with every " "RDP server!" }, @@ -302,181 +306,186 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = { { "kerberos", COMMAND_LINE_VALUE_REQUIRED, "[kdc-url:,lifetime: