diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 252d639e3..58453af61 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -170,10 +170,10 @@ static void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) xf_lock_x11(xfc, FALSE); - if (xbitmap->pixmap != NULL) + if (xbitmap->pixmap != 0) { XFreePixmap(xfc->display, xbitmap->pixmap); - xbitmap->pixmap = NULL; + xbitmap->pixmap = 0; } if (xbitmap->image) diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 841eb8dcd..d2d3f073e 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -77,7 +77,7 @@ int xf_list_monitors(xfContext* xfc) for (i = 0; i < nmonitors; i++) { - printf(" %s [%d] %hdx%hd\t+%hd+%hd\n", + printf(" %s [%d] %dx%d\t+%d+%d\n", monitors[i].primary ? "*" : " ", i, monitors[i].width, monitors[i].height, monitors[i].x, monitors[i].y); diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index ed2ca6920..a249a6d38 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -473,7 +473,7 @@ static BOOL http_response_parse_header_field(HttpResponse* response, const char* errno = 0; val = _strtoui64(value, NULL, 0); - if ((errno != 0) || (val < 0) || (val > INT32_MAX)) + if ((errno != 0) || (val > INT32_MAX)) return FALSE; response->ContentLength = val; diff --git a/libfreerdp/primitives/prim_YUV_ssse3.c b/libfreerdp/primitives/prim_YUV_ssse3.c index 7b713dcdc..504954508 100644 --- a/libfreerdp/primitives/prim_YUV_ssse3.c +++ b/libfreerdp/primitives/prim_YUV_ssse3.c @@ -318,7 +318,7 @@ static pstatus_t ssse3_YUV444ToRGB_8u_P3AC4R(const BYTE** pSrc, const UINT32* sr #define BGRX_Y_FACTORS _mm_set_epi8(0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9, 0, 27, 92, 9) #define BGRX_U_FACTORS _mm_set_epi8(0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127, 0, -29, -99, 127) #define BGRX_V_FACTORS _mm_set_epi8(0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12, 0, 127, -116, -12) -#define CONST128_FACTORS _mm_set1_epi8(128) +#define CONST128_FACTORS _mm_set1_epi8(-128) #define Y_SHIFT 7 #define U_SHIFT 8 @@ -435,7 +435,7 @@ static INLINE void ssse3_RGBToYUV420_BGRX_UV( /* pack the 16 words into bytes */ x0 = _mm_packs_epi16(x0, x1); /* add 128 */ - x0 = _mm_add_epi8(x0, vector128); + x0 = _mm_sub_epi8(x0, vector128); /* the lower 8 bytes go to the u plane */ _mm_storel_pi(udst++, _mm_castsi128_ps(x0)); /* the upper 8 bytes go to the v plane */ @@ -566,7 +566,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW( _mm_maddubs_epi16(xe2, u_factors)), U_SHIFT); const __m128i ue2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe3, u_factors), _mm_maddubs_epi16(xe4, u_factors)), U_SHIFT); - ue = _mm_add_epi8(_mm_packs_epi16(ue1, ue2), vector128); + ue = _mm_sub_epi8(_mm_packs_epi16(ue1, ue2), vector128); } if (b1Odd) @@ -575,7 +575,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW( _mm_maddubs_epi16(xo2, u_factors)), U_SHIFT); const __m128i uo2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xo3, u_factors), _mm_maddubs_epi16(xo4, u_factors)), U_SHIFT); - uo = _mm_add_epi8(_mm_packs_epi16(uo1, uo2), vector128); + uo = _mm_sub_epi8(_mm_packs_epi16(uo1, uo2), vector128); } /* Now we need the following storage distribution: @@ -633,7 +633,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW( _mm_maddubs_epi16(xe2, v_factors)), V_SHIFT); const __m128i ve2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe3, v_factors), _mm_maddubs_epi16(xe4, v_factors)), V_SHIFT); - ve = _mm_add_epi8(_mm_packs_epi16(ve1, ve2), vector128); + ve = _mm_sub_epi8(_mm_packs_epi16(ve1, ve2), vector128); } if (b1Odd) @@ -642,7 +642,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW( _mm_maddubs_epi16(xo2, v_factors)), V_SHIFT); const __m128i vo2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xo3, v_factors), _mm_maddubs_epi16(xo4, v_factors)), V_SHIFT); - vo = _mm_add_epi8(_mm_packs_epi16(vo1, vo2), vector128); + vo = _mm_sub_epi8(_mm_packs_epi16(vo1, vo2), vector128); } /* Now we need the following storage distribution: @@ -827,7 +827,7 @@ static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW( const __m128i ue2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe3, u_factors), _mm_maddubs_epi16(xe4, u_factors)), U_SHIFT); const __m128i ueavg = _mm_hadd_epi16(ue1, ue2); - ue = _mm_add_epi8(_mm_packs_epi16(ue1, ue2), vector128); + ue = _mm_sub_epi8(_mm_packs_epi16(ue1, ue2), vector128); uavg = ueavg; } { @@ -837,11 +837,11 @@ static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW( const __m128i uo2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xo3, u_factors), _mm_maddubs_epi16(xo4, u_factors)), U_SHIFT); const __m128i uoavg = _mm_hadd_epi16(uo1, uo2); - uo = _mm_add_epi8(_mm_packs_epi16(uo1, uo2), vector128); + uo = _mm_sub_epi8(_mm_packs_epi16(uo1, uo2), vector128); uavg = _mm_add_epi16(uavg, uoavg); uavg = _mm_srai_epi16(uavg, 2); uavg = _mm_packs_epi16(uavg, uoavg); - uavg = _mm_add_epi8(uavg, vector128); + uavg = _mm_sub_epi8(uavg, vector128); } /* Now we need the following storage distribution: * 2x 2y -> uLumaDst @@ -904,7 +904,7 @@ static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW( const __m128i ve2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe3, v_factors), _mm_maddubs_epi16(xe4, v_factors)), V_SHIFT); const __m128i veavg = _mm_hadd_epi16(ve1, ve2); - ve = _mm_add_epi8(_mm_packs_epi16(ve1, ve2), vector128); + ve = _mm_sub_epi8(_mm_packs_epi16(ve1, ve2), vector128); vavg = veavg; } { @@ -914,11 +914,11 @@ static INLINE void ssse3_RGBToAVC444YUVv2_BGRX_DOUBLE_ROW( const __m128i vo2 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xo3, v_factors), _mm_maddubs_epi16(xo4, v_factors)), V_SHIFT); const __m128i voavg = _mm_hadd_epi16(vo1, vo2); - vo = _mm_add_epi8(_mm_packs_epi16(vo1, vo2), vector128); + vo = _mm_sub_epi8(_mm_packs_epi16(vo1, vo2), vector128); vavg = _mm_add_epi16(vavg, voavg); vavg = _mm_srai_epi16(vavg, 2); vavg = _mm_packs_epi16(vavg, voavg); - vavg = _mm_add_epi8(vavg, vector128); + vavg = _mm_sub_epi8(vavg, vector128); } /* Now we need the following storage distribution: * 2x 2y -> vLumaDst diff --git a/libfreerdp/primitives/test/TestPrimitivesYUV.c b/libfreerdp/primitives/test/TestPrimitivesYUV.c index 7d686592b..7ec2fbb54 100644 --- a/libfreerdp/primitives/test/TestPrimitivesYUV.c +++ b/libfreerdp/primitives/test/TestPrimitivesYUV.c @@ -635,7 +635,7 @@ static BOOL check_for_mismatches(const BYTE* planeA, const BYTE* planeB, UINT32 const BYTE a = planeA[x]; const BYTE b = planeB[x]; - if (fabsf(a - b) > 2.0f) + if (fabsf((float)a - (float)b) > 2.0f) { rc = TRUE; fprintf(stderr, "[%08x] %02x != %02x\n", diff --git a/winpr/libwinpr/utils/test/TestStream.c b/winpr/libwinpr/utils/test/TestStream.c index 2ee04c48e..b6ba85670 100644 --- a/winpr/libwinpr/utils/test/TestStream.c +++ b/winpr/libwinpr/utils/test/TestStream.c @@ -32,7 +32,7 @@ static BOOL TestStream_Verify(wStream* s, int mincap, int len, size_t pos) } if (Stream_GetPosition(s) != pos) { - printf("stream has unexpected position (%"PRIuz" instead of %d)\n", + printf("stream has unexpected position (%"PRIuz" instead of %"PRIuz")\n", Stream_GetPosition(s), pos); return FALSE; } @@ -56,7 +56,7 @@ static BOOL TestStream_Verify(wStream* s, int mincap, int len, size_t pos) } if (Stream_GetRemainingLength(s) != len - pos) { - printf("stream remaining length (%"PRIuz" instead of %d)\n", + printf("stream remaining length (%"PRIuz" instead of %"PRIuz")\n", Stream_GetRemainingLength(s), len - pos); return FALSE; }