[warnings] fix various compiler warnings
This commit is contained in:
parent
94c57c3ce2
commit
9e71b423cd
@ -97,7 +97,7 @@ static BOOL freerdp_client_print_codepages(const char* arg)
|
||||
for (size_t x = 0; x < count; x++)
|
||||
{
|
||||
const RDP_CODEPAGE* page = &pages[x];
|
||||
char buffer[520] = { 0 };
|
||||
char buffer[2048] = { 0 };
|
||||
|
||||
if (strnlen(page->subLanguageSymbol, ARRAYSIZE(page->subLanguageSymbol)) > 0)
|
||||
_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol,
|
||||
|
@ -575,7 +575,7 @@ owned by rdpRdp */
|
||||
WINPR_DEPRECATED_VAR("use freerdp_shall_disconnect_context instead",
|
||||
FREERDP_API BOOL freerdp_shall_disconnect(freerdp* instance));
|
||||
|
||||
FREERDP_API BOOL freerdp_shall_disconnect_context(rdpContext* context);
|
||||
FREERDP_API BOOL freerdp_shall_disconnect_context(const rdpContext* context);
|
||||
FREERDP_API BOOL freerdp_disconnect(freerdp* instance);
|
||||
|
||||
WINPR_DEPRECATED_VAR("use freerdp_disconnect_before_reconnect_context instead",
|
||||
|
@ -47,7 +47,7 @@ struct S_FREERDP_DSP_CONTEXT
|
||||
UINT32 bufferedSamples;
|
||||
|
||||
enum AVCodecID id;
|
||||
AVCodec* codec;
|
||||
const AVCodec* codec;
|
||||
AVCodecContext* context;
|
||||
AVFrame* frame;
|
||||
AVFrame* resampled;
|
||||
@ -275,7 +275,7 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context)
|
||||
const int64_t layout = av_get_default_channel_layout(format->nChannels);
|
||||
context->context->channel_layout = layout;
|
||||
#endif
|
||||
context->context->sample_rate = format->nSamplesPerSec;
|
||||
context->context->sample_rate = (int)format->nSamplesPerSec;
|
||||
context->context->block_align = format->nBlockAlign;
|
||||
context->context->bit_rate = format->nAvgBytesPerSec * 8;
|
||||
context->context->sample_fmt = ffmpeg_sample_format(format);
|
||||
@ -323,7 +323,8 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context)
|
||||
context->frame->channel_layout = layout;
|
||||
context->frame->channels = format->nChannels;
|
||||
#endif
|
||||
context->frame->sample_rate = format->nSamplesPerSec;
|
||||
WINPR_ASSERT(format->nSamplesPerSec <= INT_MAX);
|
||||
context->frame->sample_rate = (int)format->nSamplesPerSec;
|
||||
context->frame->format = AV_SAMPLE_FMT_S16;
|
||||
|
||||
if (context->common.encoder)
|
||||
@ -334,7 +335,9 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context)
|
||||
else
|
||||
{
|
||||
context->resampled->format = AV_SAMPLE_FMT_S16;
|
||||
context->resampled->sample_rate = format->nSamplesPerSec;
|
||||
|
||||
WINPR_ASSERT(format->nSamplesPerSec <= INT_MAX);
|
||||
context->resampled->sample_rate = (int)format->nSamplesPerSec;
|
||||
}
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
|
||||
@ -488,10 +491,11 @@ static BOOL ffmpeg_encode_frame(AVCodecContext* WINPR_RESTRICT context, AVFrame*
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!Stream_EnsureRemainingCapacity(out, packet->size))
|
||||
WINPR_ASSERT(packet->size >= 0);
|
||||
if (!Stream_EnsureRemainingCapacity(out, (size_t)packet->size))
|
||||
return FALSE;
|
||||
|
||||
Stream_Write(out, packet->data, packet->size);
|
||||
Stream_Write(out, packet->data, (size_t)packet->size);
|
||||
av_packet_unref(packet);
|
||||
}
|
||||
|
||||
@ -503,21 +507,24 @@ static BOOL ffmpeg_fill_frame(AVFrame* WINPR_RESTRICT frame,
|
||||
const BYTE* WINPR_RESTRICT data, size_t size)
|
||||
{
|
||||
int ret = 0;
|
||||
int bpp = 0;
|
||||
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(57, 28, 100)
|
||||
frame->channels = inputFormat->nChannels;
|
||||
frame->channel_layout = av_get_default_channel_layout(frame->channels);
|
||||
#else
|
||||
av_channel_layout_default(&frame->ch_layout, inputFormat->nChannels);
|
||||
#endif
|
||||
frame->sample_rate = inputFormat->nSamplesPerSec;
|
||||
WINPR_ASSERT(inputFormat->nSamplesPerSec <= INT_MAX);
|
||||
frame->sample_rate = (int)inputFormat->nSamplesPerSec;
|
||||
frame->format = ffmpeg_sample_format(inputFormat);
|
||||
|
||||
bpp = av_get_bytes_per_sample(frame->format);
|
||||
frame->nb_samples = size / inputFormat->nChannels / bpp;
|
||||
const int bpp = av_get_bytes_per_sample(frame->format);
|
||||
WINPR_ASSERT(bpp >= 0);
|
||||
WINPR_ASSERT(size <= INT_MAX);
|
||||
const size_t nb_samples = size / inputFormat->nChannels / (size_t)bpp;
|
||||
frame->nb_samples = (int)nb_samples;
|
||||
|
||||
if ((ret = avcodec_fill_audio_frame(frame, inputFormat->nChannels, frame->format, data, size,
|
||||
1)) < 0)
|
||||
if ((ret = avcodec_fill_audio_frame(frame, inputFormat->nChannels, frame->format, data,
|
||||
(int)size, 1)) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during audio frame fill %s [%d]", err, ret);
|
||||
@ -602,11 +609,13 @@ static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVPacket* pkt, AVFrame* frame
|
||||
{
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
|
||||
const size_t nrchannels = resampled->ch_layout.nb_channels;
|
||||
WINPR_ASSERT(resampled->ch_layout.nb_channels >= 0);
|
||||
const size_t nrchannels = (size_t)resampled->ch_layout.nb_channels;
|
||||
#else
|
||||
const size_t nrchannels = resampled->channels;
|
||||
#endif
|
||||
const size_t data_size = nrchannels * resampled->nb_samples * 2;
|
||||
WINPR_ASSERT(resampled->nb_samples >= 0);
|
||||
const size_t data_size = nrchannels * (size_t)resampled->nb_samples * 2ull;
|
||||
if (!Stream_EnsureRemainingCapacity(out, data_size))
|
||||
return FALSE;
|
||||
Stream_Write(out, resampled->data[0], data_size);
|
||||
@ -810,9 +819,9 @@ BOOL freerdp_dsp_ffmpeg_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
inSamples = context->context->frame_size - (int)context->bufferedSamples;
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
|
||||
const size_t nrchannels = context->context->ch_layout.nb_channels;
|
||||
const int nrchannels = context->context->ch_layout.nb_channels;
|
||||
#else
|
||||
const size_t nrchannels = context->context->channels;
|
||||
const int nrchannels = context->context->channels;
|
||||
#endif
|
||||
const int rc =
|
||||
av_samples_copy(context->buffered->extended_data, context->resampled->extended_data,
|
||||
@ -850,7 +859,9 @@ BOOL freerdp_dsp_ffmpeg_decode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
av_init_packet(context->packet);
|
||||
#endif
|
||||
context->packet->data = (uint8_t*)data;
|
||||
context->packet->size = length;
|
||||
|
||||
WINPR_ASSERT(length <= INT_MAX);
|
||||
context->packet->size = (int)length;
|
||||
return ffmpeg_decode(context->context, context->packet, context->frame, context->rcontext,
|
||||
context->resampled, out);
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ BOOL freerdp_shall_disconnect(freerdp* instance)
|
||||
return freerdp_shall_disconnect_context(instance->context);
|
||||
}
|
||||
|
||||
BOOL freerdp_shall_disconnect_context(rdpContext* context)
|
||||
BOOL freerdp_shall_disconnect_context(const rdpContext* context)
|
||||
{
|
||||
if (!context)
|
||||
return FALSE;
|
||||
@ -1047,12 +1047,13 @@ void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, const char
|
||||
const char* file, int line)
|
||||
{
|
||||
WINPR_ASSERT(context);
|
||||
WINPR_ASSERT(line >= 0);
|
||||
|
||||
if (lastError)
|
||||
{
|
||||
if (WLog_IsLevelActive(context->log, WLOG_ERROR))
|
||||
{
|
||||
WLog_PrintMessage(context->log, WLOG_MESSAGE_TEXT, WLOG_ERROR, line, file, fkt,
|
||||
WLog_PrintMessage(context->log, WLOG_MESSAGE_TEXT, WLOG_ERROR, (size_t)line, file, fkt,
|
||||
"%s [0x%08" PRIX32 "]", freerdp_get_last_error_name(lastError),
|
||||
lastError);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ HANDLE utils_get_abort_event(rdpRdp* rdp)
|
||||
return rdp->abortEvent;
|
||||
}
|
||||
|
||||
BOOL utils_abort_event_is_set(rdpRdp* rdp)
|
||||
BOOL utils_abort_event_is_set(const rdpRdp* rdp)
|
||||
{
|
||||
DWORD status = 0;
|
||||
WINPR_ASSERT(rdp);
|
||||
|
@ -46,7 +46,7 @@ auth_status utils_authenticate_gateway(freerdp* instance, rdp_auth_reason reason
|
||||
auth_status utils_authenticate(freerdp* instance, rdp_auth_reason reason, BOOL override);
|
||||
|
||||
HANDLE utils_get_abort_event(rdpRdp* rdp);
|
||||
BOOL utils_abort_event_is_set(rdpRdp* rdp);
|
||||
BOOL utils_abort_event_is_set(const rdpRdp* rdp);
|
||||
BOOL utils_reset_abort(rdpRdp* rdp);
|
||||
BOOL utils_abort_connect(rdpRdp* rdp);
|
||||
BOOL utils_sync_credentials(rdpSettings* settings, BOOL toGateway);
|
||||
|
@ -56,7 +56,7 @@ static BOOL CALLBACK g_ReaderNameWInit(PINIT_ONCE InitOnce, PVOID Parameter, PVO
|
||||
|
||||
struct smartcard_emulation_context
|
||||
{
|
||||
rdpSettings* settings;
|
||||
const rdpSettings* settings;
|
||||
DWORD log_default_level;
|
||||
wLog* log;
|
||||
wHashTable* contexts;
|
||||
@ -1363,8 +1363,7 @@ LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
|
||||
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
|
||||
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
|
||||
|
||||
freerdp* inst =
|
||||
freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
|
||||
const freerdp* inst = freerdp_settings_get_pointer(smartcard->settings, FreeRDP_instance);
|
||||
WINPR_ASSERT(inst);
|
||||
|
||||
status = SCARD_E_TIMEOUT;
|
||||
@ -1446,8 +1445,7 @@ LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
|
||||
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
|
||||
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
|
||||
|
||||
freerdp* inst =
|
||||
freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
|
||||
const freerdp* inst = freerdp_settings_get_pointer(smartcard->settings, FreeRDP_instance);
|
||||
WINPR_ASSERT(inst);
|
||||
|
||||
status = SCARD_E_TIMEOUT;
|
||||
|
Loading…
Reference in New Issue
Block a user