Skip to content

Commit

Permalink
Fixed number of warnings. Fixed mingw64 build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kamaev committed Jun 12, 2012
1 parent 02e3afa commit c5aba33
Show file tree
Hide file tree
Showing 110 changed files with 2,393 additions and 2,528 deletions.
3 changes: 2 additions & 1 deletion 3rdparty/libjasper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ if(MSVC)
add_definitions(-DJAS_WIN_MSVC_BUILD)
endif()

ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow
/wd4013 /wd4018 /wd4715 /wd4244 /wd4101 /wd4267)

if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
Expand Down
5 changes: 3 additions & 2 deletions 3rdparty/libtiff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ if(WIN32)
list(APPEND lib_srcs tif_win32.c)
endif(WIN32)

ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wcast-align)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311)

if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/zlib/zconf.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ typedef uLong FAR uLongf;
#endif

#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 0
#endif

#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
Expand Down
32 changes: 16 additions & 16 deletions apps/haartraining/cvhaartraining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2191,15 +2191,15 @@ void cvCreateCascadeClassifier( const char* dirname,
{
char xml_path[1024];
int len = (int)strlen(dirname);
CvHaarClassifierCascade* cascade = 0;
CvHaarClassifierCascade* cascade1 = 0;
strcpy( xml_path, dirname );
if( xml_path[len-1] == '\\' || xml_path[len-1] == '/' )
len--;
strcpy( xml_path + len, ".xml" );
cascade = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
if( cascade )
cvSave( xml_path, cascade );
cvReleaseHaarClassifierCascade( &cascade );
cascade1 = cvLoadHaarClassifierCascade( dirname, cvSize(winwidth,winheight) );
if( cascade1 )
cvSave( xml_path, cascade1 );
cvReleaseHaarClassifierCascade( &cascade1 );
}
}
else
Expand Down Expand Up @@ -2502,7 +2502,6 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
{
CvTreeCascadeNode* single_cluster;
CvTreeCascadeNode* multiple_clusters;
CvSplit* cur_split;
int single_num;

icvSetNumSamples( training_data, poscount + negcount );
Expand Down Expand Up @@ -2675,18 +2674,19 @@ void cvCreateTreeCascadeClassifier( const char* dirname,
} /* try different number of clusters */
cvReleaseMat( &vals );

CV_CALL( cur_split = (CvSplit*) cvAlloc( sizeof( *cur_split ) ) );
CV_ZERO_OBJ( cur_split );
CvSplit* curSplit;
CV_CALL( curSplit = (CvSplit*) cvAlloc( sizeof( *curSplit ) ) );
CV_ZERO_OBJ( curSplit );

if( last_split ) last_split->next = cur_split;
else first_split = cur_split;
last_split = cur_split;
if( last_split ) last_split->next = curSplit;
else first_split = curSplit;
last_split = curSplit;

cur_split->single_cluster = single_cluster;
cur_split->multiple_clusters = multiple_clusters;
cur_split->num_clusters = best_clusters;
cur_split->parent = parent;
cur_split->single_multiple_ratio = (float) single_num / best_num;
curSplit->single_cluster = single_cluster;
curSplit->multiple_clusters = multiple_clusters;
curSplit->num_clusters = best_clusters;
curSplit->parent = parent;
curSplit->single_multiple_ratio = (float) single_num / best_num;
}

if( parent ) parent = parent->next_same_level;
Expand Down
5 changes: 1 addition & 4 deletions apps/haartraining/cvsamples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )
int i00, i10, i01, i11;
i00 = i10 = i01 = i11 = (int) fill_value;

double i = fill_value;

/* linear interpolation using 2x2 neighborhood */
if( isrc_x >= 0 && isrc_x <= src_size.width &&
isrc_y >= 0 && isrc_y <= src_size.height )
Expand All @@ -349,9 +347,8 @@ static void cvWarpPerspective( CvArr* src, CvArr* dst, double quad[4][2] )

double i0 = i00 + (i10 - i00)*delta_x;
double i1 = i01 + (i11 - i01)*delta_x;
i = i0 + (i1 - i0)*delta_y;

((uchar*)(dst_data + y * dst_step))[x] = (uchar) i;
((uchar*)(dst_data + y * dst_step))[x] = (uchar) (i0 + (i1 - i0)*delta_y);
}
x_min += k_left;
x_max += k_right;
Expand Down
11 changes: 6 additions & 5 deletions apps/haartraining/performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main( int argc, char* argv[] )
totaltime = 0.0;
if( info != NULL )
{
int x, y, width, height;
int x, y;
IplImage* img;
int hits, missed, falseAlarms;
int totalHits, totalMissed, totalFalseAlarms;
Expand Down Expand Up @@ -249,11 +249,12 @@ int main( int argc, char* argv[] )
ref = (ObjectPos*) cvAlloc( refcount * sizeof( *ref ) );
for( i = 0; i < refcount; i++ )
{
error = (fscanf( info, "%d %d %d %d", &x, &y, &width, &height ) != 4);
int w, h;
error = (fscanf( info, "%d %d %d %d", &x, &y, &w, &h ) != 4);
if( error ) break;
ref[i].x = 0.5F * width + x;
ref[i].y = 0.5F * height + y;
ref[i].width = sqrtf( 0.5F * (width * width + height * height) );
ref[i].x = 0.5F * w + x;
ref[i].y = 0.5F * h + y;
ref[i].width = sqrtf( 0.5F * (w * w + h * h) );
ref[i].found = 0;
ref[i].neghbors = 0;
}
Expand Down
20 changes: 16 additions & 4 deletions cmake/OpenCVCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if(MINGW)
endif()

if(MSVC)
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "^ *| * $" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
if(CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS_INIT)
# override cmake default exception handling option
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Expand Down Expand Up @@ -72,10 +74,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wundef)
add_extra_compiler_option(-Winit-self)
add_extra_compiler_option(-Wpointer-arith)
#add_extra_compiler_option(-Wcast-align)
#add_extra_compiler_option(-Wstrict-aliasing=2)
#add_extra_compiler_option(-Wshadow)
#add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wshadow)

if(ENABLE_NOISY_WARNINGS)
add_extra_compiler_option(-Wcast-align)
add_extra_compiler_option(-Wstrict-aliasing=2)
else()
add_extra_compiler_option(-Wno-narrowing)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
#add_extra_compiler_option(-Wno-unnamed-type-template-args)
endif()

# The -Wno-long-long is required in 64bit systems when including sytem headers.
if(X86_64)
Expand Down Expand Up @@ -259,6 +267,10 @@ if(MSVC)
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")

if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
endif()

# allow extern "C" functions throw exceptions
foreach(flags CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
string(REPLACE "/EHsc-" "/EHs" ${flags} "${${flags}}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/OpenCVFindXimea.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(WIN32)
# Try to find the XIMEA API path in registry.
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)

if(XIMEA_PATH)
if(EXISTS XIMEA_PATH)
set(XIMEA_FOUND 1)

# set LIB folders
Expand Down
4 changes: 0 additions & 4 deletions modules/calib3d/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
#ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__

#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif

#ifdef HAVE_CVCONFIG_H
#include "cvconfig.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion modules/contrib/src/basicretinafilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
{
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001);
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001f);
//std::cout<<"BasicRetinaFilter::inputFrame[IDpixel]=%f, X0=%f, outputFrame[IDpixel]=%f\n", inputFrame[IDpixel], X0, outputFrame[IDpixel]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/contrib/src/colormap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "precomp.hpp"
#include <iostream>

#if defined _MSC_VER && _MSC_VER >= 1400
#ifdef _MSC_VER
#pragma warning( disable: 4305 )
#endif

Expand Down
Loading

0 comments on commit c5aba33

Please sign in to comment.