Merge pull request #10543 from akallabeth/wfixes

[codec,dsp] fix ffmpeg warnings
This commit is contained in:
akallabeth 2024-09-02 14:30:22 +02:00 committed by GitHub
commit 654e107ade
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 243 additions and 149 deletions

View File

@ -773,22 +773,23 @@ static BOOL freerdp_dsp_channel_mix(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
BOOL freerdp_dsp_ffmpeg_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
const AUDIO_FORMAT* WINPR_RESTRICT format,
const BYTE* WINPR_RESTRICT data, size_t length,
const BYTE* WINPR_RESTRICT sdata, size_t length,
wStream* WINPR_RESTRICT out)
{
AUDIO_FORMAT fmt = { 0 };
if (!context || !format || !data || !out || !context->common.encoder)
if (!context || !format || !sdata || !out || !context->common.encoder)
return FALSE;
if (!context || !data || !out)
if (!context || !sdata || !out)
return FALSE;
/* https://github.com/FreeRDP/FreeRDP/issues/7607
*
* we get noisy data with channel transformation, so do it ourselves.
*/
if (!freerdp_dsp_channel_mix(context, data, length, format, &data, &length, &fmt))
const BYTE* data = NULL;
if (!freerdp_dsp_channel_mix(context, sdata, length, format, &data, &length, &fmt))
return FALSE;
/* Create input frame */

View File

@ -33,11 +33,17 @@
// C23 related macros
#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define WINPR_FALLTHROUGH (void)0; [[fallthrough]];
#define WINPR_FALLTHROUGH \
(void)0; \
[[fallthrough]];
#elif defined(__clang__)
#define WINPR_FALLTHROUGH (void)0; __attribute__((fallthrough));
#define WINPR_FALLTHROUGH \
(void)0; \
__attribute__((fallthrough));
#elif defined(__GNUC__) && (__GNUC__ >= 7)
#define WINPR_FALLTHROUGH (void)0; __attribute__((fallthrough));
#define WINPR_FALLTHROUGH \
(void)0; \
__attribute__((fallthrough));
#else
#define WINPR_FALLTHROUGH (void)0;
#endif
@ -103,8 +109,7 @@ typedef LONG_PTR SSIZE_T;
#define VOID void
#endif
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
WINPR_PRAGMA_DIAG_PUSH WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
#if !defined(_WIN32) && !defined(__MINGW32__)
@ -122,44 +127,63 @@ WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
#endif
#ifdef WINPR_HAVE_STDINT_H
typedef int8_t __int8;
typedef uint8_t __uint8;
typedef int16_t __int16;
typedef uint16_t __uint16;
typedef int32_t __int32;
typedef uint32_t __uint32;
typedef int64_t __int64;
typedef uint64_t __uint64;
typedef int8_t __int8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint8_t __uint8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int16_t __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint16_t __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int32_t __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint32_t __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int64_t __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint64_t __uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#if UCHAR_MAX == 0xFF
typedef signed char __int8;
typedef unsigned char __uint8;
typedef signed char __int8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned char __uint8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "8-bit type not configured"
#endif
#if USHRT_MAX == 0xFFFF
typedef short __int16;
typedef unsigned short __uint16;
typedef short __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned short __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif UINT_MAX == 0xFFFF
typedef int __int16;
typedef unsigned int __uint16;
typedef int __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned int __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#error "16-bit type not configured"
#endif
#if UINT_MAX == 0xFFFFFFFF
typedef int __int32;
typedef unsigned int __uint32;
typedef int __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned int __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif ULONG_MAX == 0xFFFFFFFF
typedef long __int32;
typedef unsigned long __uint32;
typedef long __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "32-bit type not configured"
#endif
#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
typedef long __int64;
typedef unsigned long __uint64;
typedef long __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long __uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif ULLONG_MAX == 0xFFFFFFFFFFFFFFFF
typedef long long __int64;
typedef unsigned long long __uint64;
typedef long long __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long long
__uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "64-bit type not configured"
#endif
@ -167,34 +191,43 @@ typedef unsigned long long __uint64;
#ifdef WINPR_HAVE_STDINT_H
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 int64_t
#define __uint3264 uint64_t
#define __int3264 int64_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 uint64_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define __int3264 int32_t
#define __uint3264 uint32_t
#define __int3264 int32_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 uint32_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#else
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 __int64
#define __uint3264 __uint64
#define __int3264 __int64 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 __uint64 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define __int3264 __int32
#define __uint3264 __uint32
#define __int3264 __int32 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 __uint32 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#endif /* WINPR_HAVE_STDINT_H */
typedef void *PVOID, *LPVOID, *PVOID64, *LPVOID64;
#ifndef XMD_H /* X11/Xmd.h typedef collision with BOOL */
#ifndef __OBJC__ /* objc.h typedef collision with BOOL */
#ifndef __APPLE__
typedef __int32 BOOL;
typedef __int32 BOOL; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else /* __APPLE__ */
#include <TargetConditionals.h>
/* ensure compatibility with objc libraries */
#if (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0) && defined(__LP64__)) || (defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0))
#if (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0) && defined(__LP64__)) || \
(defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0))
typedef bool BOOL;
#else
typedef signed char BOOL;
@ -214,7 +247,8 @@ typedef BOOL* PBOOL, *LPBOOL;
#endif
#ifndef XMD_H /* X11/Xmd.h typedef collision with BYTE */
typedef __uint8 BYTE;
typedef __uint8 BYTE; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif /* XMD_H */
typedef BYTE byte, *PBYTE, *LPBYTE;
typedef BYTE BOOLEAN, PBOOLEAN;
@ -223,58 +257,103 @@ typedef BYTE BOOLEAN, PBOOLEAN;
typedef char CHAR;
typedef unsigned char UCHAR;
#else
typedef __int8 CHAR;
typedef __uint8 UCHAR;
typedef __int8 CHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint8 UCHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef CHAR CCHAR, *PCHAR, *LPCH, *PCH, *PSTR, *LPSTR;
typedef const CHAR *LPCCH, *PCCH, *LPCSTR, *PCSTR;
typedef UCHAR* PUCHAR;
typedef __uint16 WCHAR;
typedef __uint16 WCHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef WCHAR UNICODE, *PWCHAR, *LPWCH, *PWCH, *BSTR, *LMSTR, *LPWSTR, *PWSTR;
typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
typedef __int16 SHORT, *PSHORT;
typedef __int32 INT, *PINT, *LPINT;
typedef __int32 LONG, *PLONG, *LPLONG;
typedef __int64 LONGLONG, *PLONGLONG;
typedef __int16 SHORT, *PSHORT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 UINT, *PUINT, *LPUINT;
typedef __uint16 USHORT, *PUSHORT;
typedef __uint32 ULONG, *PULONG;
typedef __uint64 ULONGLONG, *PULONGLONG;
typedef __int32 INT, *PINT,
*LPINT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int32 LONG, *PLONG,
*LPLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int64 LONGLONG,
*PLONGLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 UINT, *PUINT,
*LPUINT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 USHORT,
*PUSHORT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 ULONG, *PULONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 ULONGLONG,
*PULONGLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#ifndef XMD_H /* X11/Xmd.h typedef collisions */
typedef __int8 INT8;
typedef __int16 INT16;
typedef __int32 INT32;
typedef __int64 INT64;
typedef __int8 INT8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int16 INT16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int32 INT32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int64 INT64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef INT8* PINT8;
typedef INT16* PINT16;
typedef INT32* PINT32;
typedef INT64* PINT64;
typedef __int32 LONG32, *PLONG32;
typedef __int32 LONG32,
*PLONG32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#ifndef LONG64 /* X11/Xmd.h uses/defines LONG64 */
typedef __int64 LONG64, *PLONG64;
typedef __int64 LONG64,
*PLONG64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef __uint8 UINT8, *PUINT8;
typedef __uint16 UINT16, *PUINT16;
typedef __uint32 UINT32, *PUINT32;
typedef __uint64 UINT64, *PUINT64;
typedef __uint64 ULONG64, *PULONG64;
typedef __uint8 UINT8, *PUINT8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 WORD, *PWORD, *LPWORD;
typedef __uint32 DWORD, DWORD32, *PDWORD, *LPDWORD, *PDWORD32;
typedef __uint64 DWORD64, DWORDLONG, QWORD, *PDWORD64, *PDWORDLONG, *PQWORD;
typedef __uint16 UINT16,
*PUINT16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int3264 INT_PTR, *PINT_PTR;
typedef __uint3264 UINT_PTR, *PUINT_PTR;
typedef __int3264 LONG_PTR, *PLONG_PTR;
typedef __uint3264 ULONG_PTR, *PULONG_PTR;
typedef __uint3264 DWORD_PTR, *PDWORD_PTR;
typedef __uint32 UINT32,
*PUINT32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 UINT64,
*PUINT64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 ULONG64,
*PULONG64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 WORD, *PWORD,
*LPWORD; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 DWORD, DWORD32, *PDWORD, *LPDWORD,
*PDWORD32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 DWORD64, DWORDLONG, QWORD, *PDWORD64, *PDWORDLONG,
*PQWORD; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int3264 INT_PTR,
*PINT_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 UINT_PTR,
*PUINT_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int3264 LONG_PTR,
*PLONG_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 ULONG_PTR,
*PULONG_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 DWORD_PTR,
*PDWORD_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
@ -333,9 +412,11 @@ typedef GUID IID;
typedef IID* REFIID;
#ifdef UNICODE
#define _T(x) L ## x
#define _T(x) L##x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define _T(x) x
#define _T(x) x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#ifdef UNICODE
@ -486,7 +567,12 @@ typedef struct tagDEC
typedef DECIMAL* LPDECIMAL;
#define DECIMAL_NEG ((BYTE)0x80)
#define DECIMAL_SETZERO(dec) { (dec).Lo64 = 0; (dec).Hi32 = 0; (dec).signscale = 0; }
#define DECIMAL_SETZERO(dec) \
{ \
(dec).Lo64 = 0; \
(dec).Hi32 = 0; \
(dec).signscale = 0; \
}
typedef DWORD LCID;
typedef PDWORD PLCID;
@ -502,13 +588,17 @@ typedef LONG NTSTATUS;
typedef NTSTATUS* PNTSTATUS;
#endif
#ifndef _LPCVOID_DEFINED
#define _LPCVOID_DEFINED
#ifndef _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const VOID* LPCVOID;
#endif
#ifndef _LPCBYTE_DEFINED
#define _LPCBYTE_DEFINED
#ifndef _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const BYTE* LPCBYTE;
#endif
@ -593,7 +683,6 @@ typedef const BYTE* LPCBYTE;
#define PRIXz "zX"
#endif
#include <winpr/user.h>
#ifndef _WIN32

View File

@ -41,8 +41,8 @@
_Pragma("clang diagnostic ignored \"-Wunused-const-variable\"")
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY \
_Pragma("clang diagnostic ignored \"-Wformat-security\"")
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC \
_Pragma("clang diagnostic ignored \"-Wmismatched-dealloc\"")
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC /* not supported \
_Pragma("clang diagnostic ignored \"-Wmismatched-dealloc\"") */
#define WINPR_PRAGMA_DIAG_POP _Pragma("clang diagnostic pop")
#define WINPR_PRAGMA_UNROLL_LOOP _Pragma("clang loop vectorize_width(8) interleave_count(8)")
#elif defined(__GNUC__)
@ -65,8 +65,12 @@
_Pragma("GCC diagnostic ignored \"-Wunused-const-variable\"")
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY \
_Pragma("GCC diagnostic ignored \"-Wformat-security\"")
#if __GNUC__ >= 11
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC \
_Pragma("GCC diagnostic ignored \"-Wmismatched-dealloc\"")
#else
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
#endif
#define WINPR_PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
#define WINPR_PRAGMA_UNROLL_LOOP _Pragma("GCC unroll 8") _Pragma("GCC ivdep")
#else