From 8472efd791dba6cd53ff5f73fe3ceb874856b454 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com> Date: Mon, 25 May 2026 08:39:58 +0300 Subject: [PATCH] Merge pull request #29120 from asmorkalov:as/png_warning_check Libpng warning fix on Windows #29120 CI warning: ``` Warning: C:\GHA-OCV-3\_work\opencv\opencv\opencv\3rdparty\libpng\pngread.c(4114,21): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\GHA-OCV-3\_work\opencv\opencv\build\3rdparty\libpng\libpng.vcxproj] Warning: C:\GHA-OCV-3\_work\opencv\opencv\opencv\3rdparty\libpng\pngwrite.c(2033,21): warning C4146: unary minus operator applied to unsigned type, result still unsigned [C:\GHA-OCV-3\_work\opencv\opencv\build\3rdparty\libpng\libpng.vcxproj] ``` ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- 3rdparty/libpng/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index f6f39a17ed..728a40c305 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -278,6 +278,7 @@ endif(PNG_HARDWARE_OPTIMIZATIONS) if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + ocv_warnings_disable(CMAKE_C_FLAGS /wd4146) endif(MSVC) add_library(${PNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs})