From 13a16eb79cbb8c3d4e7240f77bfed5b431c39cb1 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Sun, 10 Mar 2024 17:33:11 -0700 Subject: [PATCH] Fix various warnings in filters and headers (#1241) Bug: #1003 --- src/common/ffmpeg.h | 4 ---- src/filters/hq/c/hq_shared.h | 24 ++++++++++++------------ src/sdl/filters.cpp | 4 ---- src/wx/config/user-input.cpp | 2 +- src/wx/strutils.h | 3 --- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/common/ffmpeg.h b/src/common/ffmpeg.h index c236ac76..614ce180 100644 --- a/src/common/ffmpeg.h +++ b/src/common/ffmpeg.h @@ -3,10 +3,6 @@ // simplified interface for recording audio and/or video from emulator -// required for ffmpeg -#define __STDC_LIMIT_MACROS -#define __STDC_CONSTANT_MACROS - extern "C" { /* From: http://redino.net/blog/2013/12/uint64_c-defined-including-libavformatavformat-h-vs-2008/ */ diff --git a/src/filters/hq/c/hq_shared.h b/src/filters/hq/c/hq_shared.h index 2b031cef..f27db9d9 100644 --- a/src/filters/hq/c/hq_shared.h +++ b/src/filters/hq/c/hq_shared.h @@ -81,7 +81,7 @@ inline bool Diff(unsigned int YUV1, unsigned int YUV2) // hq3x, hq4x #define Interp2_32(pc, c1, c2, c3) \ (*((unsigned int *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&0x00FF00) * 2) + ((c2)&0x00FF00) + ((c3)&0x00FF00)) & 0x0003FC00) + \ (((((c1)&0xFF00FF) * 2) + ((c2)&0xFF00FF) + ((c3)&0xFF00FF)) & 0x03FC03FC)) >> \ @@ -99,7 +99,7 @@ inline bool Diff(unsigned int YUV1, unsigned int YUV2) // hq3x, not used by hq4x #define Interp4_32(pc, c1, c2, c3) \ (*((unsigned int *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&0x00FF00) * 2) + ((((c2)&0x00FF00) + ((c3)&0x00FF00)) * 7)) & \ 0x000FF000) + \ @@ -119,7 +119,7 @@ inline bool Diff(unsigned int YUV1, unsigned int YUV2) // hq4x #define Interp6_32(pc, c1, c2, c3) \ (*((unsigned int *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&0x00FF00) * 5) + (((c2)&0x00FF00) * 2) + ((c3)&0x00FF00)) & \ 0x0007F800) + \ @@ -131,7 +131,7 @@ inline bool Diff(unsigned int YUV1, unsigned int YUV2) // hq4x #define Interp7_32(pc, c1, c2, c3) \ (*((unsigned int *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&0x00FF00) * 6) + ((c2)&0x00FF00) + ((c3)&0x00FF00)) & 0x0007F800) + \ (((((c1)&0xFF00FF) * 6) + ((c2)&0xFF00FF) + ((c3)&0xFF00FF)) & 0x07F807F8)) >> \ @@ -155,7 +155,7 @@ inline unsigned int RGBtoYUV_32(unsigned int c) unsigned char r, g, b; b = c & 0x0000FF; g = (c & 0x00FF00) >> 8; - r = c >> 16; + r = (unsigned char)(c >> 16); return ((r + g + b) << 14) + ((r - b + 512) << 4) + ((2 * g - r - b) >> 3) + 128; // unoptimized: @@ -185,7 +185,7 @@ inline unsigned int RGBtoYUV_32(unsigned int c) // hq3x, hq4x #define Interp2_16(pc, c1, c2, c3) \ (*((unsigned short *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&GMASK) * 2) + ((c2)&GMASK) + ((c3)&GMASK)) & GSHIFT2MASK) + \ (((((c1)&RBMASK) * 2) + ((c2)&RBMASK) + ((c3)&RBMASK)) & RBSHIFT2MASK)) >> \ @@ -203,7 +203,7 @@ inline unsigned int RGBtoYUV_32(unsigned int c) // hq3x, not used by hq4x #define Interp4_16(pc, c1, c2, c3) \ (*((unsigned short *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&GMASK) * 2) + ((((c2)&GMASK) + ((c3)&GMASK)) * 7)) & GSHIFT4MASK) + \ (((((c1)&RBMASK) * 2) + ((((c2)&RBMASK) + ((c3)&RBMASK)) * 7)) & \ @@ -222,7 +222,7 @@ inline unsigned int RGBtoYUV_32(unsigned int c) // hq4x #define Interp6_16(pc, c1, c2, c3) \ (*((unsigned short *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&GMASK) * 5) + (((c2)&GMASK) * 2) + ((c3)&GMASK)) & GSHIFT3MASK) + \ (((((c1)&RBMASK) * 5) + (((c2)&RBMASK) * 2) + ((c3)&RBMASK)) & \ @@ -233,7 +233,7 @@ inline unsigned int RGBtoYUV_32(unsigned int c) // hq4x #define Interp7_16(pc, c1, c2, c3) \ (*((unsigned short *)(pc)) = \ - (((c1) == (c2)) == (c3)) \ + (((c1) == (c2)) && ((c2) == (c3))) \ ? c1 \ : ((((((c1)&GMASK) * 6) + ((c2)&GMASK) + ((c3)&GMASK)) & GSHIFT3MASK) + \ (((((c1)&RBMASK) * 6) + ((c2)&RBMASK) + ((c3)&RBMASK)) & RBSHIFT3MASK)) >> \ @@ -260,9 +260,9 @@ inline unsigned int RGBtoYUV_16(unsigned short c) g = (c & 0x03E0) >> 2; b = (c & 0x001F) << 3; #else - r = (c & 0xF800) >> 8; - g = (c & 0x07E0) >> 3; - b = (c & 0x001F) << 3; + r = (unsigned char)((c & 0xF800) >> 8); + g = (unsigned char)((c & 0x07E0) >> 3); + b = (unsigned char)((c & 0x001F) << 3); #endif return ((r + g + b) << 14) + ((r - b + 512) << 4) + ((2 * g - r - b) >> 3) + 128; diff --git a/src/sdl/filters.cpp b/src/sdl/filters.cpp index 6489bbe4..7c9d4952 100644 --- a/src/sdl/filters.cpp +++ b/src/sdl/filters.cpp @@ -16,10 +16,6 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#if (defined _MSC_VER) -#define C_CORE -#endif - #include "filters.h" #include "../filters/interframe.hpp" diff --git a/src/wx/config/user-input.cpp b/src/wx/config/user-input.cpp index 33ea5627..da7cb3cc 100644 --- a/src/wx/config/user-input.cpp +++ b/src/wx/config/user-input.cpp @@ -254,7 +254,7 @@ UserInput StringToUserInput(const wxString& string) { // This is weird, but keycode events are sent as "uppercase", but the // accelerator parsing always considers them "lowercase", so we force // an uppercase conversion here. - int key = accel.GetKeyCode(); + key = accel.GetKeyCode(); if (key < WXK_START && wxIslower(key)) { key = wxToupper(key); } diff --git a/src/wx/strutils.h b/src/wx/strutils.h index 6e006710..79a63b52 100644 --- a/src/wx/strutils.h +++ b/src/wx/strutils.h @@ -1,9 +1,6 @@ #ifndef STRUTILS_H #define STRUTILS_H -#define __STDC_LIMIT_MACROS -#define __STDC_CONSTANT_MACROS - #include #include