[warnings] fix Wcast-qual
This commit is contained in:
parent
51b179b9c7
commit
f529345d84
@ -149,7 +149,7 @@ static UINT ecam_dev_sample_captured_callback(CameraDevice* dev, int streamIndex
|
||||
}
|
||||
else /* passthrough */
|
||||
{
|
||||
encodedSample = (BYTE*)sample;
|
||||
encodedSample = WINPR_CAST_CONST_PTR_AWAY(sample, BYTE*);
|
||||
encodedSize = size;
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,9 @@ static BOOL ecam_encoder_compress_h264(CameraDeviceStream* stream, const BYTE* s
|
||||
return FALSE;
|
||||
|
||||
/* convert from source format to YUV420P */
|
||||
if (av_image_fill_pointers(srcSlice, pixFormat, (int)size.height, (BYTE*)srcData,
|
||||
stream->srcLineSizes) < 0)
|
||||
BYTE* ptr = WINPR_CAST_CONST_PTR_AWAY(srcData, BYTE*);
|
||||
if (av_image_fill_pointers(srcSlice, pixFormat, (int)size.height, ptr, stream->srcLineSizes) <
|
||||
0)
|
||||
return FALSE;
|
||||
|
||||
const BYTE* cSrcSlice[4] = { srcSlice[0], srcSlice[1], srcSlice[2], srcSlice[3] };
|
||||
|
@ -386,7 +386,7 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
|
||||
av_init_packet(&pkt);
|
||||
#endif
|
||||
pkt.data = (BYTE*)data;
|
||||
pkt.data = WINPR_CAST_CONST_PTR_AWAY(data, BYTE*);
|
||||
pkt.size = data_size;
|
||||
|
||||
if (extensions & TSMM_SAMPLE_EXT_CLEANPOINT)
|
||||
@ -441,9 +441,11 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
av_image_fill_arrays(frame->data, frame->linesize, mdecoder->decoded_data,
|
||||
mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width,
|
||||
mdecoder->codec_context->height, 1);
|
||||
av_image_copy(frame->data, frame->linesize, (const uint8_t**)mdecoder->frame->data,
|
||||
mdecoder->frame->linesize, mdecoder->codec_context->pix_fmt,
|
||||
mdecoder->codec_context->width, mdecoder->codec_context->height);
|
||||
|
||||
const uint8_t* const* ptr = (const uint8_t* const*)mdecoder->frame->data;
|
||||
av_image_copy(frame->data, frame->linesize, ptr, mdecoder->frame->linesize,
|
||||
mdecoder->codec_context->pix_fmt, mdecoder->codec_context->width,
|
||||
mdecoder->codec_context->height);
|
||||
av_free(frame);
|
||||
}
|
||||
|
||||
@ -530,7 +532,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
av_init_packet(&pkt);
|
||||
#endif
|
||||
|
||||
pkt.data = (BYTE*)src;
|
||||
pkt.data = WINPR_CAST_CONST_PTR_AWAY(src, BYTE*);
|
||||
pkt.size = src_size;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 101)
|
||||
len = avcodec_decode_audio4(mdecoder->codec_context, decoded_frame, &got_frame, &pkt);
|
||||
|
@ -254,12 +254,12 @@ static void tsmf_print_guid(const BYTE* guid)
|
||||
#ifdef WITH_DEBUG_TSMF
|
||||
char guidString[37];
|
||||
|
||||
snprintf(guidString, sizeof(guidString),
|
||||
"%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "-%02" PRIX8 "%02" PRIX8 "-%02" PRIX8
|
||||
"%02" PRIX8 "-%02" PRIX8 "%02" PRIX8 "-%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "%02" PRIX8
|
||||
"%02" PRIX8 "%02" PRIX8 "",
|
||||
guid[3], guid[2], guid[1], guid[0], guid[5], guid[4], guid[7], guid[6], guid[8],
|
||||
guid[9], guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
|
||||
(void)snprintf(guidString, sizeof(guidString),
|
||||
"%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "-%02" PRIX8 "%02" PRIX8
|
||||
"-%02" PRIX8 "%02" PRIX8 "-%02" PRIX8 "%02" PRIX8 "-%02" PRIX8 "%02" PRIX8
|
||||
"%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "%02" PRIX8 "",
|
||||
guid[3], guid[2], guid[1], guid[0], guid[5], guid[4], guid[7], guid[6], guid[8],
|
||||
guid[9], guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
|
||||
|
||||
WLog_INFO(TAG, "%s", guidString);
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
#include <freerdp/config.h>
|
||||
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/library.h>
|
||||
#include <winpr/assert.h>
|
||||
|
||||
@ -380,9 +381,9 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
pic.iStride[0] = (int)iStride[0];
|
||||
pic.iStride[1] = (int)iStride[1];
|
||||
pic.iStride[2] = (int)iStride[2];
|
||||
pic.pData[0] = (unsigned char*)pYUVData[0];
|
||||
pic.pData[1] = (unsigned char*)pYUVData[1];
|
||||
pic.pData[2] = (unsigned char*)pYUVData[2];
|
||||
pic.pData[0] = WINPR_CAST_CONST_PTR_AWAY(pYUVData[0], BYTE*);
|
||||
pic.pData[1] = WINPR_CAST_CONST_PTR_AWAY(pYUVData[1], BYTE*);
|
||||
pic.pData[2] = WINPR_CAST_CONST_PTR_AWAY(pYUVData[2], BYTE*);
|
||||
|
||||
WINPR_ASSERT((*sys->pEncoder)->EncodeFrame);
|
||||
status = (*sys->pEncoder)->EncodeFrame(sys->pEncoder, &pic, &info);
|
||||
|
@ -1114,7 +1114,8 @@ int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param)
|
||||
|
||||
char* freerdp_get_param_string(const rdpSettings* settings, int id)
|
||||
{
|
||||
return (char*)freerdp_settings_get_string(settings, (FreeRDP_Settings_Keys_String)id);
|
||||
const char* str = freerdp_settings_get_string(settings, (FreeRDP_Settings_Keys_String)id);
|
||||
return WINPR_CAST_CONST_PTR_AWAY(str, char*);
|
||||
}
|
||||
|
||||
int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
|
||||
|
@ -246,7 +246,7 @@ int ringbuffer_peek(const RingBuffer* rb, DataChunk chunks[2], size_t sz)
|
||||
size_t toRead = 0;
|
||||
int chunkIndex = 0;
|
||||
int status = 0;
|
||||
DEBUG_RINGBUFFER("ringbuffer_peek(%p): sz: %" PRIdz "", (void*)rb, sz);
|
||||
DEBUG_RINGBUFFER("ringbuffer_peek(%p): sz: %" PRIdz "", (const void*)rb, sz);
|
||||
|
||||
if (sz < 1)
|
||||
return 0;
|
||||
|
@ -315,7 +315,7 @@ typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
|
||||
typedef ULONG_PTR SCARDHANDLE;
|
||||
typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
|
||||
|
||||
#define SCARD_AUTOALLOCATE (DWORD)(-1)
|
||||
#define SCARD_AUTOALLOCATE UINT32_MAX
|
||||
|
||||
#define SCARD_SCOPE_USER 0
|
||||
#define SCARD_SCOPE_TERMINAL 1
|
||||
|
@ -543,7 +543,7 @@ static int winpr_ConvertUTF8toUTF16(const uint8_t* src, int cchSrc, uint16_t* ds
|
||||
ConversionResult result = sourceIllegal;
|
||||
|
||||
if (cchSrc == -1)
|
||||
cchSrc = strlen((char*)src) + 1;
|
||||
cchSrc = (int)strnlen((const char*)src, INT32_MAX - 1) + 1;
|
||||
|
||||
srcBeg = src;
|
||||
srcEnd = &src[cchSrc];
|
||||
@ -585,7 +585,7 @@ static int winpr_ConvertUTF16toUTF8(const uint16_t* src, int cchSrc, uint8_t* ds
|
||||
ConversionResult result = sourceIllegal;
|
||||
|
||||
if (cchSrc == -1)
|
||||
cchSrc = _wcslen((uint16_t*)src) + 1;
|
||||
cchSrc = (int)_wcsnlen((const WCHAR*)src, INT32_MAX - 1) + 1;
|
||||
|
||||
srcBeg = src;
|
||||
srcEnd = &src[cchSrc];
|
||||
|
@ -644,7 +644,7 @@ static void* winpr_convert_to_jpeg(const void* data, size_t size, UINT32 width,
|
||||
|
||||
/* libjpeg is not const correct, we must cast here to avoid issues
|
||||
* with newer C compilers type check errors */
|
||||
JSAMPLE* coffset = (JSAMPLE*)&cdata[offset];
|
||||
JSAMPLE* coffset = WINPR_CAST_CONST_PTR_AWAY(&cdata[offset], JSAMPLE*);
|
||||
if (jpeg_write_scanlines(&cinfo, &coffset, 1) != 1)
|
||||
goto fail;
|
||||
}
|
||||
@ -946,7 +946,7 @@ static void* winpr_read_png_from_buffer(const void* data, size_t SrcSize, size_t
|
||||
if (!info_ptr)
|
||||
goto fail;
|
||||
|
||||
memory_reader_state.buffer = (png_bytep)data;
|
||||
memory_reader_state.buffer = WINPR_CAST_CONST_PTR_AWAY(data, png_bytep);
|
||||
memory_reader_state.bufsize = SrcSize;
|
||||
memory_reader_state.current_pos = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user