[c23,channels] replace NULL with nullptr

This commit is contained in:
Armin Novak
2026-02-26 13:17:51 +01:00
parent b1d401a84e
commit 2c0c55dc46
107 changed files with 2292 additions and 2243 deletions

View File

@@ -85,7 +85,7 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand
int error = 0;
SSIZE_T s = 0;
UINT32 channels = alsa->aformat.nChannels;
snd_pcm_hw_params_t* hw_params = NULL;
snd_pcm_hw_params_t* hw_params = nullptr;
snd_pcm_format_t format =
audin_alsa_format(alsa->aformat.wFormatTag, alsa->aformat.wBitsPerSample);
@@ -98,7 +98,8 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand
snd_pcm_hw_params_any(capture_handle, hw_params);
snd_pcm_hw_params_set_access(capture_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
snd_pcm_hw_params_set_format(capture_handle, hw_params, format);
snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &alsa->aformat.nSamplesPerSec, NULL);
snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &alsa->aformat.nSamplesPerSec,
nullptr);
snd_pcm_hw_params_set_channels_near(capture_handle, hw_params, &channels);
snd_pcm_hw_params(capture_handle, hw_params);
snd_pcm_hw_params_free(hw_params);
@@ -116,14 +117,14 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand
static DWORD WINAPI audin_alsa_thread_func(LPVOID arg)
{
DWORD error = CHANNEL_RC_OK;
BYTE* buffer = NULL;
BYTE* buffer = nullptr;
AudinALSADevice* alsa = (AudinALSADevice*)arg;
WINPR_ASSERT(alsa);
WLog_Print(alsa->log, WLOG_DEBUG, "in");
snd_pcm_t* capture_handle = NULL;
snd_pcm_t* capture_handle = nullptr;
const int rc = snd_pcm_open(&capture_handle, alsa->device_name, SND_PCM_STREAM_CAPTURE, 0);
if (rc < 0)
{
@@ -295,13 +296,13 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us
alsa->receive = receive;
alsa->user_data = user_data;
if (!(alsa->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(alsa->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
{
WLog_Print(alsa->log, WLOG_ERROR, "CreateEvent failed!");
goto error_out;
}
if (!(alsa->thread = CreateThread(NULL, 0, audin_alsa_thread_func, alsa, 0, NULL)))
if (!(alsa->thread = CreateThread(nullptr, 0, audin_alsa_thread_func, alsa, 0, nullptr)))
{
WLog_Print(alsa->log, WLOG_ERROR, "CreateThread failed!");
goto error_out;
@@ -310,7 +311,7 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us
return CHANNEL_RC_OK;
error_out:
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
alsa->stopEvent = nullptr;
return ERROR_INTERNAL_ERROR;
}
@@ -340,13 +341,13 @@ static UINT audin_alsa_close(IAudinDevice* device)
}
(void)CloseHandle(alsa->stopEvent);
alsa->stopEvent = NULL;
alsa->stopEvent = nullptr;
(void)CloseHandle(alsa->thread);
alsa->thread = NULL;
alsa->thread = nullptr;
}
alsa->receive = NULL;
alsa->user_data = NULL;
alsa->receive = nullptr;
alsa->user_data = nullptr;
return error;
}
@@ -359,15 +360,17 @@ static UINT audin_alsa_parse_addin_args(AudinALSADevice* device, const ADDIN_ARG
{
int status = 0;
DWORD flags = 0;
const COMMAND_LINE_ARGUMENT_A* arg = NULL;
const COMMAND_LINE_ARGUMENT_A* arg = nullptr;
AudinALSADevice* alsa = device;
COMMAND_LINE_ARGUMENT_A audin_alsa_args[] = { { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } };
COMMAND_LINE_ARGUMENT_A audin_alsa_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_alsa_args, flags, alsa, NULL,
NULL);
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_alsa_args, flags, alsa,
nullptr, nullptr);
if (status < 0)
return ERROR_INVALID_PARAMETER;
@@ -390,7 +393,7 @@ static UINT audin_alsa_parse_addin_args(AudinALSADevice* device, const ADDIN_ARG
}
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}
@@ -403,8 +406,8 @@ static UINT audin_alsa_parse_addin_args(AudinALSADevice* device, const ADDIN_ARG
FREERDP_ENTRY_POINT(UINT VCAPITYPE alsa_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;
AudinALSADevice* alsa = NULL;
const ADDIN_ARGV* args = nullptr;
AudinALSADevice* alsa = nullptr;
UINT error = 0;
alsa = (AudinALSADevice*)calloc(1, sizeof(AudinALSADevice));

View File

@@ -115,7 +115,7 @@ static UINT audin_channel_write_and_free(AUDIN_CHANNEL_CALLBACK* callback, wStre
Stream_SealLength(out);
WINPR_ASSERT(Stream_Length(out) <= UINT32_MAX);
const UINT error = callback->channel->Write(callback->channel, (ULONG)Stream_Length(out),
Stream_Buffer(out), NULL);
Stream_Buffer(out), nullptr);
if (freeStream)
Stream_Free(out, TRUE);
@@ -151,7 +151,7 @@ static UINT audin_process_version(AUDIN_PLUGIN* audin, AUDIN_CHANNEL_CALLBACK* c
}
audin->version = ServerVersion;
wStream* out = Stream_New(NULL, 5);
wStream* out = Stream_New(nullptr, 5);
if (!out)
{
@@ -176,7 +176,7 @@ static UINT audin_send_incoming_data_pdu(AUDIN_CHANNEL_CALLBACK* callback)
if (!callback || !callback->channel || !callback->channel->Write)
return ERROR_INTERNAL_ERROR;
return callback->channel->Write(callback->channel, 1, out_data, NULL);
return callback->channel->Write(callback->channel, 1, out_data, nullptr);
}
/**
@@ -207,7 +207,7 @@ static UINT audin_process_formats(AUDIN_PLUGIN* audin, AUDIN_CHANNEL_CALLBACK* c
Stream_Seek_UINT32(s); /* cbSizeFormatsPacket */
audin->format = NULL;
audin->format = nullptr;
audio_formats_free(callback->formats, callback->formats_count);
callback->formats_count = 0;
@@ -219,7 +219,7 @@ static UINT audin_process_formats(AUDIN_PLUGIN* audin, AUDIN_CHANNEL_CALLBACK* c
return ERROR_INVALID_DATA;
}
wStream* out = Stream_New(NULL, 9);
wStream* out = Stream_New(nullptr, 9);
if (!out)
{
@@ -285,9 +285,9 @@ out:
if (error != CHANNEL_RC_OK)
{
audin->format = NULL;
audin->format = nullptr;
audio_formats_free(callback->formats, NumFormats);
callback->formats = NULL;
callback->formats = nullptr;
}
Stream_Free(out, TRUE);
@@ -305,7 +305,7 @@ static UINT audin_send_format_change_pdu(AUDIN_PLUGIN* audin, AUDIN_CHANNEL_CALL
WINPR_ASSERT(audin);
WINPR_ASSERT(callback);
wStream* out = Stream_New(NULL, 5);
wStream* out = Stream_New(nullptr, 5);
if (!out)
{
@@ -329,7 +329,7 @@ static UINT audin_send_open_reply_pdu(AUDIN_PLUGIN* audin, AUDIN_CHANNEL_CALLBAC
WINPR_ASSERT(audin);
WINPR_ASSERT(callback);
wStream* out = Stream_New(NULL, 5);
wStream* out = Stream_New(nullptr, 5);
if (!out)
{
@@ -633,7 +633,7 @@ static UINT audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
WLog_Print(audin->log, WLOG_ERROR, "Close failed with errorcode %" PRIu32 "", error);
}
audin->format = NULL;
audin->format = nullptr;
audio_formats_free(callback->formats, callback->formats_count);
free(callback);
return error;
@@ -749,7 +749,7 @@ static UINT audin_plugin_terminated(IWTSPlugin* pPlugin)
// don't stop on error
}
audin->device = NULL;
audin->device = nullptr;
}
freerdp_dsp_context_free(audin->dsp_context);
@@ -819,10 +819,11 @@ static UINT audin_load_device_plugin(AUDIN_PLUGIN* audin, const char* name, cons
FREERDP_AUDIN_DEVICE_ENTRY_POINTS entryPoints = WINPR_C_ARRAY_INIT;
UINT error = ERROR_INTERNAL_ERROR;
PVIRTUALCHANNELENTRY pvce = freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME, name, NULL, 0);
PVIRTUALCHANNELENTRY pvce =
freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME, name, nullptr, 0);
PFREERDP_AUDIN_DEVICE_ENTRY entry = WINPR_FUNC_PTR_CAST(pvce, PFREERDP_AUDIN_DEVICE_ENTRY);
if (entry == NULL)
if (entry == nullptr)
{
WLog_Print(audin->log, WLOG_ERROR,
"freerdp_load_channel_addin_entry did not return any function pointers for %s ",
@@ -891,12 +892,15 @@ static UINT audin_set_device_name(AUDIN_PLUGIN* audin, const char* device_name)
BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
{
COMMAND_LINE_ARGUMENT_A audin_args[] = {
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", nullptr, nullptr, -1, nullptr,
"subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", nullptr, nullptr, -1, nullptr,
"format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", nullptr, nullptr, -1, nullptr, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", nullptr, nullptr, -1, nullptr,
"channel" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
if (!args || args->argc == 1)
@@ -904,8 +908,8 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
const DWORD flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
const int status =
CommandLineParseArgumentsA(args->argc, args->argv, audin_args, flags, audin, NULL, NULL);
const int status = CommandLineParseArgumentsA(args->argc, args->argv, audin_args, flags, audin,
nullptr, nullptr);
if (status != 0)
return FALSE;
@@ -940,7 +944,7 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
}
CommandLineSwitchCase(arg, "format")
{
unsigned long val = strtoul(arg->Value, NULL, 0);
unsigned long val = strtoul(arg->Value, nullptr, 0);
if ((errno != 0) || (val > UINT16_MAX))
return FALSE;
@@ -949,7 +953,7 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
}
CommandLineSwitchCase(arg, "rate")
{
unsigned long val = strtoul(arg->Value, NULL, 0);
unsigned long val = strtoul(arg->Value, nullptr, 0);
if ((errno != 0) || (val == 0) || (val > UINT32_MAX))
return FALSE;
@@ -958,7 +962,7 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
}
CommandLineSwitchCase(arg, "channel")
{
unsigned long val = strtoul(arg->Value, NULL, 0);
unsigned long val = strtoul(arg->Value, nullptr, 0);
if ((errno != 0) || (val <= UINT16_MAX))
audin->fixed_format->nChannels = (UINT16)val;
@@ -967,7 +971,7 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
{
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return TRUE;
}
@@ -1010,14 +1014,14 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* p
#if defined(WITH_SNDIO)
{ "sndio", "default" },
#endif
{ NULL, NULL }
{ nullptr, nullptr }
};
struct SubsystemEntry* entry = &entries[0];
WINPR_ASSERT(pEntryPoints);
WINPR_ASSERT(pEntryPoints->GetPlugin);
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, AUDIN_CHANNEL_NAME);
if (audin != NULL)
if (audin != nullptr)
return CHANNEL_RC_ALREADY_INITIALIZED;
audin = (AUDIN_PLUGIN*)calloc(1, sizeof(AUDIN_PLUGIN));
@@ -1029,7 +1033,7 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* p
}
audin->log = WLog_Get(TAG);
audin->data = Stream_New(NULL, 4096);
audin->data = Stream_New(nullptr, 4096);
audin->fixed_format = audio_format_new();
if (!audin->fixed_format)
@@ -1045,8 +1049,8 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* p
audin->attached = TRUE;
audin->iface.Initialize = audin_plugin_initialize;
audin->iface.Connected = NULL;
audin->iface.Disconnected = NULL;
audin->iface.Connected = nullptr;
audin->iface.Disconnected = nullptr;
audin->iface.Terminated = audin_plugin_terminated;
audin->iface.Attached = audin_plugin_attached;
audin->iface.Detached = audin_plugin_detached;
@@ -1101,7 +1105,7 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* p
}
}
if (audin->device == NULL)
if (audin->device == nullptr)
{
/* If we have no audin device do not register plugin but still return OK or the client will
* just disconnect due to a missing microphone. */

View File

@@ -99,7 +99,7 @@ static BOOL audin_ios_format_supported(IAudinDevice *device, const AUDIO_FORMAT
AudinIosDevice *ios = (AudinIosDevice *)device;
AudioFormatID req_fmt = 0;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return FALSE;
req_fmt = audin_ios_get_format(format);
@@ -120,7 +120,7 @@ static UINT audin_ios_set_format(IAudinDevice *device, const AUDIO_FORMAT *forma
{
AudinIosDevice *ios = (AudinIosDevice *)device;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return ERROR_INVALID_PARAMETER;
ios->FramesPerPacket = FramesPerPacket;
@@ -164,7 +164,7 @@ static void ios_audio_queue_input_cb(void *aqData, AudioQueueRef inAQ, AudioQueu
if (buffer_size > 0)
error = ios->receive(&ios->format, buffer, buffer_size, ios->user_data);
AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL);
AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, nullptr);
if (error)
{
@@ -180,7 +180,7 @@ static UINT audin_ios_close(IAudinDevice *device)
OSStatus devStat;
AudinIosDevice *ios = (AudinIosDevice *)device;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if (ios->isOpen)
@@ -208,11 +208,11 @@ static UINT audin_ios_close(IAudinDevice *device)
winpr_strerror(errCode, errString, sizeof(errString)), errCode);
}
ios->audioQueue = NULL;
ios->audioQueue = nullptr;
}
ios->receive = NULL;
ios->user_data = NULL;
ios->receive = nullptr;
ios->user_data = nullptr;
return errCode;
}
@@ -225,7 +225,7 @@ static UINT audin_ios_open(IAudinDevice *device, AudinReceive receive, void *use
ios->receive = receive;
ios->user_data = user_data;
devStat = AudioQueueNewInput(&(ios->audioFormat), ios_audio_queue_input_cb, ios, NULL,
devStat = AudioQueueNewInput(&(ios->audioFormat), ios_audio_queue_input_cb, ios, nullptr,
kCFRunLoopCommonModes, 0, &(ios->audioQueue));
if (devStat != 0)
@@ -250,7 +250,7 @@ static UINT audin_ios_open(IAudinDevice *device, AudinReceive receive, void *use
goto err_out;
}
devStat = AudioQueueEnqueueBuffer(ios->audioQueue, ios->audioBuffers[index], 0, NULL);
devStat = AudioQueueEnqueueBuffer(ios->audioQueue, ios->audioBuffers[index], 0, nullptr);
if (devStat != 0)
{
@@ -261,7 +261,7 @@ static UINT audin_ios_open(IAudinDevice *device, AudinReceive receive, void *use
}
}
devStat = AudioQueueStart(ios->audioQueue, NULL);
devStat = AudioQueueStart(ios->audioQueue, nullptr);
if (devStat != 0)
{
@@ -283,7 +283,7 @@ static UINT audin_ios_free(IAudinDevice *device)
AudinIosDevice *ios = (AudinIosDevice *)device;
int error;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if ((error = audin_ios_close(device)))

View File

@@ -115,7 +115,7 @@ static BOOL audin_mac_format_supported(IAudinDevice *device, const AUDIO_FORMAT
if (!mac->isAuthorized)
return FALSE;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return FALSE;
if (format->nChannels != 2)
@@ -142,7 +142,7 @@ static UINT audin_mac_set_format(IAudinDevice *device, const AUDIO_FORMAT *forma
if (!mac->isAuthorized)
return ERROR_INTERNAL_ERROR;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return ERROR_INVALID_PARAMETER;
mac->FramesPerPacket = FramesPerPacket;
@@ -186,7 +186,7 @@ static void mac_audio_queue_input_cb(void *aqData, AudioQueueRef inAQ, AudioQueu
if (buffer_size > 0)
error = mac->receive(&mac->format, buffer, buffer_size, mac->user_data);
AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL);
AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, nullptr);
if (error)
{
@@ -205,7 +205,7 @@ static UINT audin_mac_close(IAudinDevice *device)
if (!mac->isAuthorized)
return ERROR_INTERNAL_ERROR;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if (mac->isOpen)
@@ -233,11 +233,11 @@ static UINT audin_mac_close(IAudinDevice *device)
winpr_strerror(errCode, errString, sizeof(errString)), errCode);
}
mac->audioQueue = NULL;
mac->audioQueue = nullptr;
}
mac->receive = NULL;
mac->user_data = NULL;
mac->receive = nullptr;
mac->user_data = nullptr;
return errCode;
}
@@ -253,7 +253,7 @@ static UINT audin_mac_open(IAudinDevice *device, AudinReceive receive, void *use
mac->receive = receive;
mac->user_data = user_data;
devStat = AudioQueueNewInput(&(mac->audioFormat), mac_audio_queue_input_cb, mac, NULL,
devStat = AudioQueueNewInput(&(mac->audioFormat), mac_audio_queue_input_cb, mac, nullptr,
kCFRunLoopCommonModes, 0, &(mac->audioQueue));
if (devStat != 0)
@@ -278,7 +278,7 @@ static UINT audin_mac_open(IAudinDevice *device, AudinReceive receive, void *use
goto err_out;
}
devStat = AudioQueueEnqueueBuffer(mac->audioQueue, mac->audioBuffers[index], 0, NULL);
devStat = AudioQueueEnqueueBuffer(mac->audioQueue, mac->audioBuffers[index], 0, nullptr);
if (devStat != 0)
{
@@ -289,7 +289,7 @@ static UINT audin_mac_open(IAudinDevice *device, AudinReceive receive, void *use
}
}
devStat = AudioQueueStart(mac->audioQueue, NULL);
devStat = AudioQueueStart(mac->audioQueue, nullptr);
if (devStat != 0)
{
@@ -311,7 +311,7 @@ static UINT audin_mac_free(IAudinDevice *device)
AudinMacDevice *mac = (AudinMacDevice *)device;
int error;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if ((error = audin_mac_close(device)))
@@ -331,9 +331,11 @@ static UINT audin_mac_parse_addin_args(AudinMacDevice *device, const ADDIN_ARGV
char *str_num, *eptr;
DWORD flags;
const COMMAND_LINE_ARGUMENT_A *arg;
COMMAND_LINE_ARGUMENT_A audin_mac_args[] = { { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } };
COMMAND_LINE_ARGUMENT_A audin_mac_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
AudinMacDevice *mac = (AudinMacDevice *)device;
@@ -342,8 +344,8 @@ static UINT audin_mac_parse_addin_args(AudinMacDevice *device, const ADDIN_ARGV
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status =
CommandLineParseArgumentsA(args->argc, args->argv, audin_mac_args, flags, mac, NULL, NULL);
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_mac_args, flags, mac, nullptr,
nullptr);
if (status < 0)
return ERROR_INVALID_PARAMETER;
@@ -375,7 +377,7 @@ static UINT audin_mac_parse_addin_args(AudinMacDevice *device, const ADDIN_ARGV
free(str_num);
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}

View File

@@ -232,9 +232,9 @@ UINT audin_opensles_close(IAudinDevice* device)
WLog_Print(opensles->log, WLOG_DEBUG, "device=%p", (void*)device);
android_CloseRecDevice(opensles->stream);
opensles->receive = NULL;
opensles->user_data = NULL;
opensles->stream = NULL;
opensles->receive = nullptr;
opensles->user_data = nullptr;
opensles->stream = nullptr;
return CHANNEL_RC_OK;
}
@@ -250,16 +250,16 @@ static UINT audin_opensles_parse_addin_args(AudinOpenSLESDevice* device, const A
const COMMAND_LINE_ARGUMENT_A* arg;
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*)device;
COMMAND_LINE_ARGUMENT_A audin_opensles_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL,
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, args=%p", (void*)device, (void*)args);
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_opensles_args, flags,
opensles, NULL, NULL);
opensles, nullptr, nullptr);
if (status < 0)
return status;
@@ -282,7 +282,7 @@ static UINT audin_opensles_parse_addin_args(AudinOpenSLESDevice* device, const A
}
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}

View File

@@ -73,7 +73,7 @@ static SLresult openSLCreateEngine(OPENSL_STREAM* p)
{
SLresult result;
// create engine
result = slCreateEngine(&(p->engineObject), 0, NULL, 0, NULL, NULL);
result = slCreateEngine(&(p->engineObject), 0, nullptr, 0, nullptr, nullptr);
if (result != SL_RESULT_SUCCESS)
goto engine_end;
@@ -96,7 +96,7 @@ static SLresult openSLCreateEngine(OPENSL_STREAM* p)
if (result != SL_RESULT_SUCCESS)
{
p->deviceVolume = NULL;
p->deviceVolume = nullptr;
result = SL_RESULT_SUCCESS;
}
@@ -171,8 +171,8 @@ static SLresult openSLRecOpen(OPENSL_STREAM* p)
// configure audio source
SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT,
SL_DEFAULTDEVICEID_AUDIOINPUT, NULL };
SLDataSource audioSrc = { &loc_dev, NULL };
SL_DEFAULTDEVICEID_AUDIOINPUT, nullptr };
SLDataSource audioSrc = { &loc_dev, nullptr };
// configure audio sink
int speakers;
@@ -259,20 +259,20 @@ static SLresult openSLRecOpen(OPENSL_STREAM* p)
static void openSLDestroyEngine(OPENSL_STREAM* p)
{
// destroy audio recorder object, and invalidate all associated interfaces
if (p->recorderObject != NULL)
if (p->recorderObject != nullptr)
{
(*p->recorderObject)->Destroy(p->recorderObject);
p->recorderObject = NULL;
p->recorderRecord = NULL;
p->recorderBufferQueue = NULL;
p->recorderObject = nullptr;
p->recorderRecord = nullptr;
p->recorderBufferQueue = nullptr;
}
// destroy engine object, and invalidate all associated interfaces
if (p->engineObject != NULL)
if (p->engineObject != nullptr)
{
(*p->engineObject)->Destroy(p->engineObject);
p->engineObject = NULL;
p->engineEngine = NULL;
p->engineObject = nullptr;
p->engineEngine = nullptr;
}
}
@@ -292,7 +292,7 @@ static queue_element* opensles_queue_element_new(size_t size)
return q;
fail:
free(q);
return NULL;
return nullptr;
}
static void opensles_queue_element_free(void* obj)
@@ -312,12 +312,12 @@ OPENSL_STREAM* android_OpenRecDevice(void* context, opensl_receive_t receive, in
OPENSL_STREAM* p;
if (!context || !receive)
return NULL;
return nullptr;
p = (OPENSL_STREAM*)calloc(1, sizeof(OPENSL_STREAM));
if (!p)
return NULL;
return nullptr;
p->context = context;
p->receive = receive;
@@ -348,13 +348,13 @@ OPENSL_STREAM* android_OpenRecDevice(void* context, opensl_receive_t receive, in
return p;
fail:
android_CloseRecDevice(p);
return NULL;
return nullptr;
}
// close the android audio device
void android_CloseRecDevice(OPENSL_STREAM* p)
{
if (p == NULL)
if (p == nullptr)
return;
opensles_queue_element_free(p->next);

View File

@@ -100,7 +100,7 @@ static UINT32 audin_oss_get_format(const AUDIO_FORMAT* format)
static BOOL audin_oss_format_supported(IAudinDevice* device, const AUDIO_FORMAT* format)
{
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return FALSE;
switch (format->wFormatTag)
@@ -130,7 +130,7 @@ static UINT audin_oss_set_format(IAudinDevice* device, const AUDIO_FORMAT* forma
{
AudinOSSDevice* oss = (AudinOSSDevice*)device;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return ERROR_INVALID_PARAMETER;
oss->FramesPerPacket = FramesPerPacket;
@@ -142,14 +142,14 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
{
char dev_name[PATH_MAX] = "/dev/dsp";
int pcm_handle = -1;
BYTE* buffer = NULL;
BYTE* buffer = nullptr;
unsigned long tmp = 0;
size_t buffer_size = 0;
AudinOSSDevice* oss = (AudinOSSDevice*)arg;
UINT error = 0;
DWORD status = 0;
if (oss == NULL)
if (oss == nullptr)
{
error = ERROR_INVALID_PARAMETER;
goto err_out;
@@ -192,7 +192,7 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
(1ull * oss->FramesPerPacket * oss->format.nChannels * (oss->format.wBitsPerSample / 8ull));
buffer = (BYTE*)calloc((buffer_size + sizeof(void*)), sizeof(BYTE));
if (NULL == buffer)
if (nullptr == buffer)
{
OSS_LOG_ERR("malloc() fail", errno);
error = ERROR_NOT_ENOUGH_MEMORY;
@@ -260,17 +260,17 @@ static UINT audin_oss_open(IAudinDevice* device, AudinReceive receive, void* use
oss->receive = receive;
oss->user_data = user_data;
if (!(oss->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(oss->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
{
WLog_ERR(TAG, "CreateEvent failed!");
return ERROR_INTERNAL_ERROR;
}
if (!(oss->thread = CreateThread(NULL, 0, audin_oss_thread_func, oss, 0, NULL)))
if (!(oss->thread = CreateThread(nullptr, 0, audin_oss_thread_func, oss, 0, nullptr)))
{
WLog_ERR(TAG, "CreateThread failed!");
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
oss->stopEvent = nullptr;
return ERROR_INTERNAL_ERROR;
}
@@ -287,10 +287,10 @@ static UINT audin_oss_close(IAudinDevice* device)
UINT error = 0;
AudinOSSDevice* oss = (AudinOSSDevice*)device;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if (oss->stopEvent != NULL)
if (oss->stopEvent != nullptr)
{
(void)SetEvent(oss->stopEvent);
@@ -302,13 +302,13 @@ static UINT audin_oss_close(IAudinDevice* device)
}
(void)CloseHandle(oss->stopEvent);
oss->stopEvent = NULL;
oss->stopEvent = nullptr;
(void)CloseHandle(oss->thread);
oss->thread = NULL;
oss->thread = nullptr;
}
oss->receive = NULL;
oss->user_data = NULL;
oss->receive = nullptr;
oss->user_data = nullptr;
return CHANNEL_RC_OK;
}
@@ -322,7 +322,7 @@ static UINT audin_oss_free(IAudinDevice* device)
AudinOSSDevice* oss = (AudinOSSDevice*)device;
UINT error = 0;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if ((error = audin_oss_close(device)))
@@ -342,19 +342,21 @@ static UINT audin_oss_free(IAudinDevice* device)
static UINT audin_oss_parse_addin_args(AudinOSSDevice* device, const ADDIN_ARGV* args)
{
int status = 0;
char* str_num = NULL;
char* eptr = NULL;
char* str_num = nullptr;
char* eptr = nullptr;
DWORD flags = 0;
const COMMAND_LINE_ARGUMENT_A* arg = NULL;
const COMMAND_LINE_ARGUMENT_A* arg = nullptr;
AudinOSSDevice* oss = device;
COMMAND_LINE_ARGUMENT_A audin_oss_args[] = { { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } };
COMMAND_LINE_ARGUMENT_A audin_oss_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status =
CommandLineParseArgumentsA(args->argc, args->argv, audin_oss_args, flags, oss, NULL, NULL);
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_oss_args, flags, oss, nullptr,
nullptr);
if (status < 0)
return ERROR_INVALID_PARAMETER;
@@ -395,7 +397,7 @@ static UINT audin_oss_parse_addin_args(AudinOSSDevice* device, const ADDIN_ARGV*
free(str_num);
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}
@@ -408,8 +410,8 @@ static UINT audin_oss_parse_addin_args(AudinOSSDevice* device, const ADDIN_ARGV*
FREERDP_ENTRY_POINT(UINT VCAPITYPE oss_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;
AudinOSSDevice* oss = NULL;
const ADDIN_ARGV* args = nullptr;
AudinOSSDevice* oss = nullptr;
UINT error = 0;
oss = (AudinOSSDevice*)calloc(1, sizeof(AudinOSSDevice));

View File

@@ -139,7 +139,7 @@ static UINT audin_pulse_connect(IAudinDevice* device)
if (!pulse->context)
return ERROR_INVALID_PARAMETER;
if (pa_context_connect(pulse->context, NULL, PA_CONTEXT_NOFLAGS, NULL))
if (pa_context_connect(pulse->context, nullptr, PA_CONTEXT_NOFLAGS, nullptr))
{
WLog_Print(pulse->log, WLOG_ERROR, "pa_context_connect failed (%d)",
pa_context_errno(pulse->context));
@@ -200,13 +200,13 @@ static UINT audin_pulse_free(IAudinDevice* device)
{
pa_context_disconnect(pulse->context);
pa_context_unref(pulse->context);
pulse->context = NULL;
pulse->context = nullptr;
}
if (pulse->mainloop)
{
pa_threaded_mainloop_free(pulse->mainloop);
pulse->mainloop = NULL;
pulse->mainloop = nullptr;
}
free(pulse->device_name);
@@ -324,7 +324,7 @@ static void audin_pulse_stream_state_callback(pa_stream* stream, void* userdata)
static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length, void* userdata)
{
const void* data = NULL;
const void* data = nullptr;
AudinPulseDevice* pulse = (AudinPulseDevice*)userdata;
UINT error = CHANNEL_RC_OK;
pa_stream_peek(stream, &data, &length);
@@ -353,12 +353,12 @@ static UINT audin_pulse_close(IAudinDevice* device)
pa_threaded_mainloop_lock(pulse->mainloop);
pa_stream_disconnect(pulse->stream);
pa_stream_unref(pulse->stream);
pulse->stream = NULL;
pulse->stream = nullptr;
pa_threaded_mainloop_unlock(pulse->mainloop);
}
pulse->receive = NULL;
pulse->user_data = NULL;
pulse->receive = nullptr;
pulse->user_data = nullptr;
return CHANNEL_RC_OK;
}
@@ -385,7 +385,7 @@ static UINT audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
pulse->receive = receive;
pulse->user_data = user_data;
pa_threaded_mainloop_lock(pulse->mainloop);
pulse->stream = pa_stream_new(pulse->context, pulse->stream_name, &pulse->sample_spec, NULL);
pulse->stream = pa_stream_new(pulse->context, pulse->stream_name, &pulse->sample_spec, nullptr);
if (!pulse->stream)
{
@@ -456,27 +456,27 @@ static UINT audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
static UINT audin_pulse_parse_addin_args(AudinPulseDevice* pulse, const ADDIN_ARGV* args)
{
COMMAND_LINE_ARGUMENT_A audin_pulse_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL,
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ "client_name", COMMAND_LINE_VALUE_REQUIRED, "<client_name>", NULL, NULL, -1, NULL,
"name of pulse client" },
{ "stream_name", COMMAND_LINE_VALUE_REQUIRED, "<stream_name>", NULL, NULL, -1, NULL,
"name of pulse stream" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
{ "client_name", COMMAND_LINE_VALUE_REQUIRED, "<client_name>", nullptr, nullptr, -1,
nullptr, "name of pulse client" },
{ "stream_name", COMMAND_LINE_VALUE_REQUIRED, "<stream_name>", nullptr, nullptr, -1,
nullptr, "name of pulse stream" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
const DWORD flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
const int status = CommandLineParseArgumentsA(args->argc, args->argv, audin_pulse_args, flags,
pulse, NULL, NULL);
pulse, nullptr, nullptr);
if (status < 0)
return ERROR_INVALID_PARAMETER;
const COMMAND_LINE_ARGUMENT_A* arg = audin_pulse_args;
const char* client_name = NULL;
const char* stream_name = NULL;
const char* client_name = nullptr;
const char* stream_name = nullptr;
do
{
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
@@ -493,7 +493,7 @@ static UINT audin_pulse_parse_addin_args(AudinPulseDevice* pulse, const ADDIN_AR
}
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
if (!client_name)
client_name = freerdp_getApplicationDetailsString();
@@ -516,8 +516,8 @@ static UINT audin_pulse_parse_addin_args(AudinPulseDevice* pulse, const ADDIN_AR
FREERDP_ENTRY_POINT(UINT VCAPITYPE pulse_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;
AudinPulseDevice* pulse = NULL;
const ADDIN_ARGV* args = nullptr;
AudinPulseDevice* pulse = nullptr;
UINT error = 0;
pulse = (AudinPulseDevice*)calloc(1, sizeof(AudinPulseDevice));

View File

@@ -49,7 +49,7 @@ typedef struct
static BOOL audin_sndio_format_supported(IAudinDevice* device, const AUDIO_FORMAT* format)
{
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return FALSE;
return (format->wFormatTag == WAVE_FORMAT_PCM);
@@ -65,7 +65,7 @@ static UINT audin_sndio_set_format(IAudinDevice* device, AUDIO_FORMAT* format,
{
AudinSndioDevice* sndio = (AudinSndioDevice*)device;
if (device == NULL || format == NULL)
if (device == nullptr || format == nullptr)
return ERROR_INVALID_PARAMETER;
if (format->wFormatTag != WAVE_FORMAT_PCM)
@@ -81,20 +81,20 @@ static void* audin_sndio_thread_func(void* arg)
{
struct sio_hdl* hdl;
struct sio_par par;
BYTE* buffer = NULL;
BYTE* buffer = nullptr;
size_t n, nbytes;
AudinSndioDevice* sndio = (AudinSndioDevice*)arg;
UINT error = 0;
DWORD status;
if (arg == NULL)
if (arg == nullptr)
{
error = ERROR_INVALID_PARAMETER;
goto err_out;
}
hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
if (hdl == NULL)
if (hdl == nullptr)
{
WLog_ERR(TAG, "could not open audio device");
error = ERROR_INTERNAL_ERROR;
@@ -129,7 +129,7 @@ static void* audin_sndio_thread_func(void* arg)
(sndio->FramesPerPacket * sndio->format.nChannels * (sndio->format.wBitsPerSample / 8));
buffer = (BYTE*)calloc((nbytes + sizeof(void*)), sizeof(BYTE));
if (buffer == NULL)
if (buffer == nullptr)
{
error = ERROR_NOT_ENOUGH_MEMORY;
goto err_out;
@@ -168,10 +168,10 @@ static void* audin_sndio_thread_func(void* arg)
}
err_out:
if (error && sndio->rdpcontext)
if (error && sndio && sndio->rdpcontext)
setChannelError(sndio->rdpcontext, error, "audin_sndio_thread_func reported an error");
if (hdl != NULL)
if (hdl != nullptr)
{
WLog_INFO(TAG, "sio_close");
sio_stop(hdl);
@@ -180,7 +180,7 @@ err_out:
free(buffer);
ExitThread(0);
return NULL;
return nullptr;
}
/**
@@ -194,18 +194,18 @@ static UINT audin_sndio_open(IAudinDevice* device, AudinReceive receive, void* u
sndio->receive = receive;
sndio->user_data = user_data;
if (!(sndio->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(sndio->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
{
WLog_ERR(TAG, "CreateEvent failed");
return ERROR_INTERNAL_ERROR;
}
if (!(sndio->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)audin_sndio_thread_func,
sndio, 0, NULL)))
if (!(sndio->thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)audin_sndio_thread_func,
sndio, 0, nullptr)))
{
WLog_ERR(TAG, "CreateThread failed");
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
sndio->stopEvent = nullptr;
return ERROR_INTERNAL_ERROR;
}
@@ -222,10 +222,10 @@ static UINT audin_sndio_close(IAudinDevice* device)
UINT error;
AudinSndioDevice* sndio = (AudinSndioDevice*)device;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if (sndio->stopEvent != NULL)
if (sndio->stopEvent != nullptr)
{
(void)SetEvent(sndio->stopEvent);
@@ -237,13 +237,13 @@ static UINT audin_sndio_close(IAudinDevice* device)
}
(void)CloseHandle(sndio->stopEvent);
sndio->stopEvent = NULL;
sndio->stopEvent = nullptr;
(void)CloseHandle(sndio->thread);
sndio->thread = NULL;
sndio->thread = nullptr;
}
sndio->receive = NULL;
sndio->user_data = NULL;
sndio->receive = nullptr;
sndio->user_data = nullptr;
return CHANNEL_RC_OK;
}
@@ -258,7 +258,7 @@ static UINT audin_sndio_free(IAudinDevice* device)
AudinSndioDevice* sndio = (AudinSndioDevice*)device;
int error;
if (device == NULL)
if (device == nullptr)
return ERROR_INVALID_PARAMETER;
if ((error = audin_sndio_close(device)))
@@ -282,11 +282,12 @@ static UINT audin_sndio_parse_addin_args(AudinSndioDevice* device, ADDIN_ARGV* a
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
AudinSndioDevice* sndio = (AudinSndioDevice*)device;
COMMAND_LINE_ARGUMENT_A audin_sndio_args[] = { { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } };
COMMAND_LINE_ARGUMENT_A audin_sndio_args[] = { { nullptr, 0, nullptr, nullptr, nullptr, -1,
nullptr, nullptr } };
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, (const char**)args->argv, audin_sndio_args,
flags, sndio, NULL, NULL);
flags, sndio, nullptr, nullptr);
if (status < 0)
return ERROR_INVALID_PARAMETER;
@@ -299,7 +300,7 @@ static UINT audin_sndio_parse_addin_args(AudinSndioDevice* device, ADDIN_ARGV* a
continue;
CommandLineSwitchStart(arg) CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}
@@ -317,7 +318,7 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE sndio_freerdp_audin_client_subsystem_entry(
UINT ret = CHANNEL_RC_OK;
sndio = (AudinSndioDevice*)calloc(1, sizeof(AudinSndioDevice));
if (sndio == NULL)
if (sndio == nullptr)
return CHANNEL_RC_NO_MEMORY;
sndio->device.Open = audin_sndio_open;

View File

@@ -161,7 +161,7 @@ static BOOL test_format_supported(const PWAVEFORMATEX pwfx)
return FALSE;
}
rc = waveInOpen(NULL, WAVE_MAPPER, pwfx, 0, 0,
rc = waveInOpen(nullptr, WAVE_MAPPER, pwfx, 0, 0,
WAVE_FORMAT_QUERY | WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE);
return (rc == MMSYSERR_NOERROR);
}
@@ -169,7 +169,7 @@ static BOOL test_format_supported(const PWAVEFORMATEX pwfx)
static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
{
AudinWinmmDevice* winmm = (AudinWinmmDevice*)arg;
char* buffer = NULL;
char* buffer = nullptr;
int size = 0;
WAVEHDR waveHdr[4] = WINPR_C_ARRAY_INIT;
DWORD status = 0;
@@ -252,7 +252,7 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
{
}
winmm->hWaveIn = NULL;
winmm->hWaveIn = nullptr;
return 0;
}
@@ -306,10 +306,10 @@ static UINT audin_winmm_close(IAudinDevice* device)
(void)CloseHandle(winmm->thread);
(void)CloseHandle(winmm->stopEvent);
winmm->thread = NULL;
winmm->stopEvent = NULL;
winmm->receive = NULL;
winmm->user_data = NULL;
winmm->thread = nullptr;
winmm->stopEvent = nullptr;
winmm->receive = nullptr;
winmm->user_data = nullptr;
return error;
}
@@ -427,17 +427,17 @@ static UINT audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u
winmm->receive = receive;
winmm->user_data = user_data;
if (!(winmm->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(winmm->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
{
WLog_Print(winmm->log, WLOG_ERROR, "CreateEvent failed!");
return ERROR_INTERNAL_ERROR;
}
if (!(winmm->thread = CreateThread(NULL, 0, audin_winmm_thread_func, winmm, 0, NULL)))
if (!(winmm->thread = CreateThread(nullptr, 0, audin_winmm_thread_func, winmm, 0, nullptr)))
{
WLog_Print(winmm->log, WLOG_ERROR, "CreateThread failed!");
(void)CloseHandle(winmm->stopEvent);
winmm->stopEvent = NULL;
winmm->stopEvent = nullptr;
return ERROR_INTERNAL_ERROR;
}
@@ -455,14 +455,16 @@ static UINT audin_winmm_parse_addin_args(AudinWinmmDevice* device, const ADDIN_A
DWORD flags;
const COMMAND_LINE_ARGUMENT_A* arg;
AudinWinmmDevice* winmm = (AudinWinmmDevice*)device;
COMMAND_LINE_ARGUMENT_A audin_winmm_args[] = { { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL } };
COMMAND_LINE_ARGUMENT_A audin_winmm_args[] = {
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", nullptr, nullptr, -1, nullptr,
"audio device name" },
{ nullptr, 0, nullptr, nullptr, nullptr, -1, nullptr, nullptr }
};
flags =
COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv, audin_winmm_args, flags, winmm,
NULL, NULL);
nullptr, nullptr);
arg = audin_winmm_args;
do
@@ -481,7 +483,7 @@ static UINT audin_winmm_parse_addin_args(AudinWinmmDevice* device, const ADDIN_A
}
}
CommandLineSwitchEnd(arg)
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
} while ((arg = CommandLineFindNextArgumentA(arg)) != nullptr);
return CHANNEL_RC_OK;
}

View File

@@ -274,12 +274,12 @@ static UINT audin_server_recv_format_change(audin_server_context* context, wStre
static DWORD WINAPI audin_server_thread_func(LPVOID arg)
{
wStream* s = NULL;
void* buffer = NULL;
wStream* s = nullptr;
void* buffer = nullptr;
DWORD nCount = 0;
HANDLE events[8] = WINPR_C_ARRAY_INIT;
BOOL ready = FALSE;
HANDLE ChannelEvent = NULL;
HANDLE ChannelEvent = nullptr;
DWORD BytesReturned = 0;
audin_server* audin = (audin_server*)arg;
UINT error = CHANNEL_RC_OK;
@@ -337,7 +337,7 @@ static DWORD WINAPI audin_server_thread_func(LPVOID arg)
break;
}
s = Stream_New(NULL, 4096);
s = Stream_New(nullptr, 4096);
if (!s)
{
@@ -378,7 +378,7 @@ static DWORD WINAPI audin_server_thread_func(LPVOID arg)
Stream_SetPosition(s, 0);
if (!WTSVirtualChannelRead(audin->audin_channel, 0, NULL, 0, &BytesReturned))
if (!WTSVirtualChannelRead(audin->audin_channel, 0, nullptr, 0, &BytesReturned))
{
WLog_Print(audin->log, WLOG_ERROR, "WTSVirtualChannelRead failed!");
error = ERROR_INTERNAL_ERROR;
@@ -444,7 +444,7 @@ out_capacity:
Stream_Free(s, TRUE);
out:
(void)WTSVirtualChannelClose(audin->audin_channel);
audin->audin_channel = NULL;
audin->audin_channel = nullptr;
if (error && audin->context.rdpcontext)
setChannelError(audin->context.rdpcontext, error,
@@ -461,7 +461,7 @@ static BOOL audin_server_open(audin_server_context* context)
WINPR_ASSERT(audin);
if (!audin->thread)
{
PULONG pSessionId = NULL;
PULONG pSessionId = nullptr;
DWORD BytesReturned = 0;
audin->SessionId = WTS_CURRENT_SESSION;
UINT32 channelId = 0;
@@ -492,18 +492,18 @@ static BOOL audin_server_open(audin_server_context* context)
return FALSE;
}
if (!(audin->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
if (!(audin->stopEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr)))
{
WLog_Print(audin->log, WLOG_ERROR, "CreateEvent failed!");
return FALSE;
}
if (!(audin->thread =
CreateThread(NULL, 0, audin_server_thread_func, (void*)audin, 0, NULL)))
CreateThread(nullptr, 0, audin_server_thread_func, (void*)audin, 0, nullptr)))
{
WLog_Print(audin->log, WLOG_ERROR, "CreateThread failed!");
(void)CloseHandle(audin->stopEvent);
audin->stopEvent = NULL;
audin->stopEvent = nullptr;
return FALSE;
}
@@ -519,7 +519,7 @@ static BOOL audin_server_is_open(audin_server_context* context)
audin_server* audin = (audin_server*)context;
WINPR_ASSERT(audin);
return audin->thread != NULL;
return audin->thread != nullptr;
}
static BOOL audin_server_close(audin_server_context* context)
@@ -540,17 +540,17 @@ static BOOL audin_server_close(audin_server_context* context)
(void)CloseHandle(audin->thread);
(void)CloseHandle(audin->stopEvent);
audin->thread = NULL;
audin->stopEvent = NULL;
audin->thread = nullptr;
audin->stopEvent = nullptr;
}
if (audin->audin_channel)
{
(void)WTSVirtualChannelClose(audin->audin_channel);
audin->audin_channel = NULL;
audin->audin_channel = nullptr;
}
audin->audin_negotiated_format = NULL;
audin->audin_negotiated_format = nullptr;
return TRUE;
}
@@ -560,11 +560,11 @@ static wStream* audin_server_packet_new(wLog* log, size_t size, BYTE MessageId)
WINPR_ASSERT(log);
/* Allocate what we need plus header bytes */
wStream* s = Stream_New(NULL, size + SNDIN_HEADER_SIZE);
wStream* s = Stream_New(nullptr, size + SNDIN_HEADER_SIZE);
if (!s)
{
WLog_Print(log, WLOG_ERROR, "Stream_New failed!");
return NULL;
return nullptr;
}
Stream_Write_UINT8(s, MessageId);
@@ -839,7 +839,7 @@ audin_server_context* audin_server_context_new(HANDLE vcm)
if (!audin)
{
WLog_ERR(AUDIN_TAG, "calloc failed!");
return NULL;
return nullptr;
}
audin->log = WLog_Get(AUDIN_TAG);
audin->context.vcm = vcm;
@@ -872,7 +872,7 @@ void audin_server_context_free(audin_server_context* context)
audin_server_close(context);
audio_formats_free(audin->audin_server_formats, audin->audin_n_server_formats);
audin->audin_server_formats = NULL;
audin->audin_server_formats = nullptr;
free(audin);
}
@@ -884,8 +884,8 @@ BOOL audin_server_set_formats(audin_server_context* context, SSIZE_T count,
audio_formats_free(audin->audin_server_formats, audin->audin_n_server_formats);
audin->audin_n_server_formats = 0;
audin->audin_server_formats = NULL;
audin->audin_negotiated_format = NULL;
audin->audin_server_formats = nullptr;
audin->audin_negotiated_format = nullptr;
if (count < 0)
{