Fixed Android build warnings and few warnings in specific cnfigurations

This commit is contained in:
Andrey Kamaev 2012-06-13 13:19:43 +00:00
parent 9dac223039
commit 7cccc93bdf
7 changed files with 87 additions and 81 deletions

View File

@ -25,7 +25,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow)
set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}

View File

@ -119,11 +119,11 @@ endif()
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
target_link_libraries(tbb c m dl)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"

View File

@ -48,12 +48,21 @@ set(OCV_COMPILER_FAIL_REGEX
)
MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
if(NOT DEFINED ${RESULT})
if("_${LANG}_" MATCHES "_CXX_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
FILE(WRITE "${_fname}" "int main() { return 0; }\n")
else()
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
endif()
elseif("_${LANG}_" MATCHES "_C_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
if("${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
FILE(WRITE "${_fname}" "int main(void) { return 0; }\n")
else()
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
endif()
else()
unset(_fname)
endif()
@ -82,6 +91,7 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
else()
SET(${RESULT} 0)
endif()
endif()
ENDMACRO()
macro(ocv_check_flag_support lang flag varname)

View File

@ -1127,9 +1127,9 @@ CVAPI(void) cvSetRemove( CvSet* set_header, int index );
/* Returns a set element by index. If the element doesn't belong to the set,
NULL is returned */
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
{
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, index );
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, idx );
return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
}

View File

@ -225,9 +225,9 @@ void Mat::create(int d, const int* _sizes, int _type)
}catch(...)
{
allocator = 0;
size_t total = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(total + (int)sizeof(*refcount));
refcount = (int*)(data + total);
size_t totalSize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(totalSize + (int)sizeof(*refcount));
refcount = (int*)(data + totalSize);
*refcount = 1;
}
#else

View File

@ -126,8 +126,6 @@ static dc1394error_t adaptBufferStereoLocal(dc1394video_frame_t *in, dc1394video
static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t *in,
dc1394video_frame_t *out, dc1394stereo_method_t method)
{
dc1394error_t err;
if((in->color_coding == DC1394_COLOR_CODING_RAW16) ||
(in->color_coding == DC1394_COLOR_CODING_MONO16) ||
(in->color_coding == DC1394_COLOR_CODING_YUV422))
@ -136,14 +134,14 @@ static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t
{
case DC1394_STEREO_METHOD_INTERLACED:
err = adaptBufferStereoLocal(in, out);
adaptBufferStereoLocal(in, out);
//FIXED by AB:
// dc1394_deinterlace_stereo(in->image, out->image, in->size[0], in->size[1]);
dc1394_deinterlace_stereo(in->image, out->image, out->size[0], out->size[1]);
break;
case DC1394_STEREO_METHOD_FIELD:
err = adaptBufferStereoLocal(in, out);
adaptBufferStereoLocal(in, out);
memcpy(out->image, in->image, out->image_bytes);
break;
}

View File

@ -1396,7 +1396,7 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
const int threadsNum, int *kLevels, int **processingLevels)
{
int rootFilterDim, sumPartFiltersDim, i, numLevels, dbx, dby, numDotProducts;
int averNumDotProd, j, minValue, argMin, lambda, maxValue, k;
int j, minValue, argMin, lambda, maxValue, k;
int *dotProd, *weights, *disp;
if (H == NULL || all_F == NULL)
{
@ -1430,8 +1430,6 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
(H->pyramid[i]->sizeY + dby) * sumPartFiltersDim;
numDotProducts += dotProd[i];
}
// Average number of dot products that would be performed at the best
averNumDotProd = numDotProducts / threadsNum;
// Allocation memory for saving dot product number performed by each thread
weights = (int *)malloc(sizeof(int) * threadsNum);
// Allocation memory for saving dispertion