Skip to content

Commit d0b2e60

Browse files
committed
Merge pull request opencv#10514 from alalek:build_warnings
2 parents 8e1f31f + 59c6661 commit d0b2e60

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

modules/imgcodecs/src/grfmt_pam.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ bool PAMDecoder::readData( Mat& img )
487487
bool res = false, funcout;
488488
PaletteEntry palette[256];
489489
const struct pam_format *fmt = NULL;
490-
struct channel_layout layout;
490+
struct channel_layout layout = { 0, 0, 0, 0 }; // normalized to 1-channel grey format
491491

492492
/* setting buffer to max data size so scaling up is possible */
493493
AutoBuffer<uchar> _src(src_elems_per_row * 2);
@@ -506,9 +506,7 @@ bool PAMDecoder::readData( Mat& img )
506506
layout.bchan = 0;
507507
layout.gchan = 1;
508508
layout.rchan = 2;
509-
} else
510-
layout.bchan = layout.gchan = layout.rchan = 0;
511-
layout.graychan = 0;
509+
}
512510
}
513511

514512
CV_TRY

modules/imgproc/src/thresh.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,14 +1483,14 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
14831483
imaxval = saturate_cast<ushort>(imaxval);
14841484

14851485
int ushrt_min = 0;
1486-
if (ithresh < ushrt_min || ithresh >= USHRT_MAX)
1486+
if (ithresh < ushrt_min || ithresh >= (int)USHRT_MAX)
14871487
{
14881488
if (type == THRESH_BINARY || type == THRESH_BINARY_INV ||
14891489
((type == THRESH_TRUNC || type == THRESH_TOZERO_INV) && ithresh < ushrt_min) ||
1490-
(type == THRESH_TOZERO && ithresh >= USHRT_MAX))
1490+
(type == THRESH_TOZERO && ithresh >= (int)USHRT_MAX))
14911491
{
1492-
int v = type == THRESH_BINARY ? (ithresh >= USHRT_MAX ? 0 : imaxval) :
1493-
type == THRESH_BINARY_INV ? (ithresh >= USHRT_MAX ? imaxval : 0) :
1492+
int v = type == THRESH_BINARY ? (ithresh >= (int)USHRT_MAX ? 0 : imaxval) :
1493+
type == THRESH_BINARY_INV ? (ithresh >= (int)USHRT_MAX ? imaxval : 0) :
14941494
/*type == THRESH_TRUNC ? imaxval :*/ 0;
14951495
dst.setTo(v);
14961496
}

modules/python/bindings/CMakeLists.txt

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,42 @@ ocv_list_filterout(opencv_hdrs "modules/.*_inl\\\\.h*")
3838
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.details\\\\.h*")
3939
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker\\\\.hpp") # Conditional compilation
4040

41-
set(cv2_generated_hdrs
41+
set(cv2_generated_files
4242
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
4343
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h"
4444
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h"
4545
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
4646
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h"
47-
)
48-
49-
set(cv2_generated_files ${cv2_generated_hdrs}
5047
"${OPENCV_PYTHON_SIGNATURES_FILE}"
5148
)
5249

5350
string(REPLACE ";" "\n" opencv_hdrs_ "${opencv_hdrs}")
5451
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs_}")
5552
add_custom_command(
5653
OUTPUT ${cv2_generated_files}
57-
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/headers.txt"
58-
DEPENDS ${PYTHON_SOURCE_DIR}/src2/gen2.py
59-
DEPENDS ${PYTHON_SOURCE_DIR}/src2/hdr_parser.py
60-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
61-
DEPENDS ${opencv_hdrs}
54+
COMMAND "${PYTHON_DEFAULT_EXECUTABLE}" "${PYTHON_SOURCE_DIR}/src2/gen2.py" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/headers.txt"
55+
DEPENDS "${PYTHON_SOURCE_DIR}/src2/gen2.py"
56+
"${PYTHON_SOURCE_DIR}/src2/hdr_parser.py"
57+
# not a real build dependency (file(WRITE) result): ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
58+
${opencv_hdrs}
6259
COMMENT "Generate files for Python bindings and documentation"
6360
)
6461

6562
add_custom_target(gen_opencv_python_source DEPENDS ${cv2_generated_files})
6663

6764
set(cv2_custom_hdr "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_custom_headers.h")
68-
file(WRITE ${cv2_custom_hdr} "//user-defined headers\n")
65+
set(cv2_custom_hdr_str "//user-defined headers\n")
6966
foreach(uh ${opencv_userdef_hdrs})
70-
file(APPEND ${cv2_custom_hdr} "#include \"${uh}\"\n")
67+
set(cv2_custom_hdr_str "${cv2_custom_hdr_str}#include \"${uh}\"\n")
7168
endforeach(uh)
69+
if(EXISTS "${cv2_custom_hdr}")
70+
file(READ "${cv2_custom_hdr}" __content)
71+
else()
72+
set(__content "")
73+
endif()
74+
if("${__content}" STREQUAL "${cv2_custom_hdr_str}")
75+
# Up-to-date
76+
else()
77+
file(WRITE "${cv2_custom_hdr}" "${cv2_custom_hdr_str}")
78+
endif()
79+
unset(__content)

0 commit comments

Comments
 (0)