[warnings] integer cast and checks
This commit is contained in:
parent
ceae258e37
commit
cc626276d0
@ -174,7 +174,7 @@ static DWORD WINAPI audin_alsa_thread_func(LPVOID arg)
|
|||||||
|
|
||||||
if (err == -EPIPE)
|
if (err == -EPIPE)
|
||||||
{
|
{
|
||||||
snd_pcm_recover(capture_handle, err, 0);
|
snd_pcm_recover(capture_handle, (int)err, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (err < 0)
|
else if (err < 0)
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
|
|
||||||
define_channel_client("rdpdr")
|
define_channel_client("rdpdr")
|
||||||
|
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
check_function_exists(getmntent_r FREERDP_HAVE_GETMNTENT_R)
|
||||||
|
if (FREERDP_HAVE_GETMNTENT_R)
|
||||||
|
add_definitions(-DFREERDP_HAVE_GETMNTENT_R)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(${MODULE_PREFIX}_SRCS
|
set(${MODULE_PREFIX}_SRCS
|
||||||
irp.c
|
irp.c
|
||||||
irp.h
|
irp.h
|
||||||
|
@ -834,9 +834,24 @@ static UINT handle_platform_mounts_bsd(wLog* log, hotplug_dev* dev_array, size_t
|
|||||||
|
|
||||||
#if defined(__LINUX__) || defined(__linux__)
|
#if defined(__LINUX__) || defined(__linux__)
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
|
static struct mntent* getmntent_x(FILE* f, struct mntent* buffer, char* pathbuffer,
|
||||||
|
size_t pathbuffersize)
|
||||||
|
{
|
||||||
|
#if defined(FREERDP_HAVE_GETMNTENT_R)
|
||||||
|
return getmntent_r(f, buffer, pathbuffer, pathbuffersize);
|
||||||
|
#else
|
||||||
|
(void)buffer;
|
||||||
|
(void)pathbuffer;
|
||||||
|
(void)pathbuffersize;
|
||||||
|
return getmntent(f);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size_t* size)
|
static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size_t* size)
|
||||||
{
|
{
|
||||||
FILE* f = NULL;
|
FILE* f = NULL;
|
||||||
|
struct mntent mnt = { 0 };
|
||||||
|
char pathbuffer[PATH_MAX] = { 0 };
|
||||||
struct mntent* ent = NULL;
|
struct mntent* ent = NULL;
|
||||||
f = winpr_fopen("/proc/mounts", "r");
|
f = winpr_fopen("/proc/mounts", "r");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
@ -844,7 +859,7 @@ static UINT handle_platform_mounts_linux(wLog* log, hotplug_dev* dev_array, size
|
|||||||
WLog_Print(log, WLOG_ERROR, "fopen failed!");
|
WLog_Print(log, WLOG_ERROR, "fopen failed!");
|
||||||
return ERROR_OPEN_FAILED;
|
return ERROR_OPEN_FAILED;
|
||||||
}
|
}
|
||||||
while ((ent = getmntent(f)) != NULL)
|
while ((ent = getmntent_x(f, &mnt, pathbuffer, sizeof(pathbuffer))) != NULL)
|
||||||
{
|
{
|
||||||
handle_mountpoint(dev_array, size, ent->mnt_dir);
|
handle_mountpoint(dev_array, size, ent->mnt_dir);
|
||||||
}
|
}
|
||||||
|
@ -772,13 +772,11 @@ static UINT rdpgfx_send_cache_import_offer_pdu(RdpgfxClientContext* context,
|
|||||||
wStream* s = NULL;
|
wStream* s = NULL;
|
||||||
RDPGFX_HEADER header;
|
RDPGFX_HEADER header;
|
||||||
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
GENERIC_CHANNEL_CALLBACK* callback = NULL;
|
||||||
WINPR_ASSERT(context);
|
|
||||||
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
|
|
||||||
|
|
||||||
if (!context || !pdu)
|
if (!context || !pdu)
|
||||||
return ERROR_BAD_ARGUMENTS;
|
return ERROR_BAD_ARGUMENTS;
|
||||||
|
|
||||||
gfx = (RDPGFX_PLUGIN*)context->handle;
|
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
|
||||||
|
|
||||||
if (!gfx || !gfx->base.listener_callback)
|
if (!gfx || !gfx->base.listener_callback)
|
||||||
return ERROR_BAD_CONFIGURATION;
|
return ERROR_BAD_CONFIGURATION;
|
||||||
|
@ -111,8 +111,8 @@ static int rdpsnd_alsa_set_hw_params(rdpsndAlsaPlugin* alsa)
|
|||||||
* It is also possible for the buffer size to not be an integer multiple of the period size.
|
* It is also possible for the buffer size to not be an integer multiple of the period size.
|
||||||
*/
|
*/
|
||||||
int interrupts_per_sec_near = 50;
|
int interrupts_per_sec_near = 50;
|
||||||
int bytes_per_sec =
|
const size_t bytes_per_sec =
|
||||||
(alsa->actual_rate * alsa->aformat.wBitsPerSample / 8 * alsa->actual_channels);
|
(1ull * alsa->actual_rate * alsa->aformat.wBitsPerSample / 8 * alsa->actual_channels);
|
||||||
alsa->buffer_size = buffer_size_max;
|
alsa->buffer_size = buffer_size_max;
|
||||||
alsa->period_size = (bytes_per_sec / interrupts_per_sec_near);
|
alsa->period_size = (bytes_per_sec / interrupts_per_sec_near);
|
||||||
|
|
||||||
@ -423,12 +423,11 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
|
|||||||
{
|
{
|
||||||
UINT latency = 0;
|
UINT latency = 0;
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
int frame_size = 0;
|
|
||||||
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
|
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
|
||||||
WINPR_ASSERT(alsa);
|
WINPR_ASSERT(alsa);
|
||||||
WINPR_ASSERT(data || (size == 0));
|
WINPR_ASSERT(data || (size == 0));
|
||||||
frame_size = alsa->actual_channels * alsa->aformat.wBitsPerSample / 8;
|
const size_t frame_size = 1ull * alsa->actual_channels * alsa->aformat.wBitsPerSample / 8;
|
||||||
if (frame_size <= 0)
|
if (frame_size == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (offset < size)
|
while (offset < size)
|
||||||
@ -437,7 +436,7 @@ static UINT rdpsnd_alsa_play(rdpsndDevicePlugin* device, const BYTE* data, size_
|
|||||||
snd_pcm_writei(alsa->pcm_handle, &data[offset], (size - offset) / frame_size);
|
snd_pcm_writei(alsa->pcm_handle, &data[offset], (size - offset) / frame_size);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
status = snd_pcm_recover(alsa->pcm_handle, status, 0);
|
status = snd_pcm_recover(alsa->pcm_handle, (int)status, 0);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ static BOOL rdpsnd_oss_set_format(rdpsndDevicePlugin* device, const AUDIO_FORMAT
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = format->nSamplesPerSec;
|
tmp = (int)format->nSamplesPerSec;
|
||||||
|
|
||||||
if (ioctl(oss->pcm_handle, SNDCTL_DSP_SPEED, &tmp) == -1)
|
if (ioctl(oss->pcm_handle, SNDCTL_DSP_SPEED, &tmp) == -1)
|
||||||
{
|
{
|
||||||
@ -321,15 +321,14 @@ static UINT32 rdpsnd_oss_get_volume(rdpsndDevicePlugin* device)
|
|||||||
|
|
||||||
static BOOL rdpsnd_oss_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
static BOOL rdpsnd_oss_set_volume(rdpsndDevicePlugin* device, UINT32 value)
|
||||||
{
|
{
|
||||||
int left = 0;
|
|
||||||
int right = 0;
|
|
||||||
rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device;
|
rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device;
|
||||||
|
WINPR_ASSERT(oss);
|
||||||
|
|
||||||
if (device == NULL || oss->mixer_handle == -1)
|
if (device == NULL || oss->mixer_handle == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
left = (((value & 0xFFFF) * 100) / 0xFFFF);
|
unsigned left = (((value & 0xFFFF) * 100) / 0xFFFF);
|
||||||
right = ((((value >> 16) & 0xFFFF) * 100) / 0xFFFF);
|
unsigned right = ((((value >> 16) & 0xFFFF) * 100) / 0xFFFF);
|
||||||
|
|
||||||
if (left < 0)
|
if (left < 0)
|
||||||
left = 0;
|
left = 0;
|
||||||
@ -425,7 +424,7 @@ static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, const ADDIN_A
|
|||||||
return CHANNEL_RC_NULL_DATA;
|
return CHANNEL_RC_NULL_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
oss->dev_unit = val;
|
oss->dev_unit = (int)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oss->dev_unit < 0 || *eptr != '\0')
|
if (oss->dev_unit < 0 || *eptr != '\0')
|
||||||
|
@ -696,7 +696,7 @@ static UINT rdpsnd_pulse_parse_addin_args(rdpsndDevicePlugin* device, const ADDI
|
|||||||
if ((errno != 0) || (val > INT32_MAX))
|
if ((errno != 0) || (val > INT32_MAX))
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
|
|
||||||
pulse->reconnect_delay_seconds = val;
|
pulse->reconnect_delay_seconds = (time_t)val;
|
||||||
}
|
}
|
||||||
CommandLineSwitchEnd(arg)
|
CommandLineSwitchEnd(arg)
|
||||||
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
||||||
|
@ -302,6 +302,8 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
|
|||||||
WINPR_ASSERT(rdpsnd->device);
|
WINPR_ASSERT(rdpsnd->device);
|
||||||
ret = IFCALLRESULT(CHANNEL_RC_OK, rdpsnd->device->ServerFormatAnnounce, rdpsnd->device,
|
ret = IFCALLRESULT(CHANNEL_RC_OK, rdpsnd->device->ServerFormatAnnounce, rdpsnd->device,
|
||||||
rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
|
rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
|
||||||
|
if (ret != CHANNEL_RC_OK)
|
||||||
|
goto out_fail;
|
||||||
|
|
||||||
rdpsnd_select_supported_audio_formats(rdpsnd);
|
rdpsnd_select_supported_audio_formats(rdpsnd);
|
||||||
WLog_Print(rdpsnd->log, WLOG_DEBUG, "%s Server Audio Formats",
|
WLog_Print(rdpsnd->log, WLOG_DEBUG, "%s Server Audio Formats",
|
||||||
|
Loading…
Reference in New Issue
Block a user