Fixed mingw build warnings

This commit is contained in:
Andrey Kamaev 2012-06-20 17:57:26 +00:00
parent 988c405f79
commit e94e5866a1
11 changed files with 166 additions and 131 deletions

View File

@ -24,7 +24,7 @@ CvParams::CvParams() : name( "params" ) {}
void CvParams::printDefaults() const
{ cout << "--" << name << "--" << endl; }
void CvParams::printAttrs() const {}
bool CvParams::scanAttr( const String prmName, const String val ) { return false; }
bool CvParams::scanAttr( const String, const String ) { return false; }
//---------------------------- FeatureParams --------------------------------------

View File

@ -88,8 +88,8 @@ struct CV_EXPORTS CvFeatureTrackerParams
enum { SIFT = 0, SURF = 1, OPTICAL_FLOW = 2 };
CvFeatureTrackerParams(int featureType = 0, int windowSize = 0)
{
featureType = 0;
windowSize = 0;
feature_type = featureType;
window_size = windowSize;
}
int feature_type; // Feature type to use

View File

@ -12,6 +12,7 @@
* Adapted for FLANN by Marius Muja
*/
#include "defines.h"
#include <stdexcept>
#include <ostream>
#include <typeinfo>
@ -95,6 +96,16 @@ struct big_any_policy : typed_base_any_policy<T>
virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
};
template<> inline void big_any_policy<flann_centers_init_t>::print(std::ostream& out, void* const* src)
{
out << int(*reinterpret_cast<flann_centers_init_t const*>(*src));
}
template<> inline void big_any_policy<flann_algorithm_t>::print(std::ostream& out, void* const* src)
{
out << int(*reinterpret_cast<flann_algorithm_t const*>(*src));
}
template<typename T>
struct choose_policy
{

View File

@ -1,7 +1,3 @@
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#ifndef _OPENCV_FLANN_PRECOMP_HPP_
#define _OPENCV_FLANN_PRECOMP_HPP_

View File

@ -542,8 +542,6 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
};
bool result = false;
fileWrapper fw;
int _channels = img.channels();
int channels = _channels > 1 ? 3 : 1;
int width = img.cols, height = img.rows;
vector<uchar> out_buf(1 << 12);
@ -580,6 +578,9 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
{
cinfo.image_width = width;
cinfo.image_height = height;
int _channels = img.channels();
int channels = _channels > 1 ? 3 : 1;
cinfo.input_components = channels;
cinfo.in_color_space = channels > 1 ? JCS_RGB : JCS_GRAYSCALE;

View File

@ -519,7 +519,7 @@ int CV_MLBaseTest::read_params( CvFileStorage* _fs )
return cvtest::TS::OK;;
}
void CV_MLBaseTest::run( int start_from )
void CV_MLBaseTest::run( int )
{
string filename = ts->get_data_path();
filename += get_validation_filename();
@ -527,7 +527,6 @@ void CV_MLBaseTest::run( int start_from )
read_params( *validationFS );
int code = cvtest::TS::OK;
start_from = 0;
for (int i = 0; i < test_case_count; i++)
{
int temp_code = run_test_case( i );
@ -713,7 +712,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
return cvtest::TS::OK;
}
float CV_MLBaseTest::get_error( int testCaseIdx, int type, vector<float> *resp )
float CV_MLBaseTest::get_error( int /*testCaseIdx*/, int type, vector<float> *resp )
{
float err = 0;
if( !modelName.compare(CV_NBAYES) )
@ -721,8 +720,8 @@ float CV_MLBaseTest::get_error( int testCaseIdx, int type, vector<float> *resp )
else if( !modelName.compare(CV_KNEAREST) )
{
assert( 0 );
testCaseIdx = 0;
/*int k = 2;
/*testCaseIdx = 0;
int k = 2;
validationFS.getFirstTopLevelNode()["validation"][modelName][dataSetNames[testCaseIdx]]["model_params"]["k"] >> k;
err = knearest->calc_error( &data, k, type, resp );*/
}

View File

@ -181,7 +181,7 @@ public:
datastart = data = (uchar*)PyArray_DATA(o);
}
void deallocate(int* refcount, uchar* datastart, uchar* data)
void deallocate(int* refcount, uchar*, uchar*)
{
PyEnsureGIL gil;
if( !refcount )
@ -349,6 +349,7 @@ static PyObject* pyopencv_from(bool value)
static bool pyopencv_to(PyObject* obj, bool& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
int _val = PyObject_IsTrue(obj);
@ -365,6 +366,7 @@ static PyObject* pyopencv_from(size_t value)
static bool pyopencv_to(PyObject* obj, size_t& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
value = (int)PyLong_AsUnsignedLong(obj);
@ -376,8 +378,19 @@ static PyObject* pyopencv_from(int value)
return PyInt_FromLong(value);
}
static PyObject* pyopencv_from(cvflann_flann_algorithm_t value)
{
return PyInt_FromLong(int(value));
}
static PyObject* pyopencv_from(cvflann_flann_distance_t value)
{
return PyInt_FromLong(int(value));
}
static bool pyopencv_to(PyObject* obj, int& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
value = (int)PyInt_AsLong(obj);
@ -391,6 +404,7 @@ static PyObject* pyopencv_from(uchar value)
static bool pyopencv_to(PyObject* obj, uchar& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
int ivalue = (int)PyInt_AsLong(obj);
@ -405,6 +419,7 @@ static PyObject* pyopencv_from(double value)
static bool pyopencv_to(PyObject* obj, double& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyInt_CheckExact(obj))
@ -421,6 +436,7 @@ static PyObject* pyopencv_from(float value)
static bool pyopencv_to(PyObject* obj, float& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyInt_CheckExact(obj))
@ -442,6 +458,7 @@ static PyObject* pyopencv_from(const string& value)
static bool pyopencv_to(PyObject* obj, string& value, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
char* str = PyString_AsString(obj);
@ -453,6 +470,7 @@ static bool pyopencv_to(PyObject* obj, string& value, const char* name = "<unkno
static inline bool pyopencv_to(PyObject* obj, Size& sz, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
return PyArg_ParseTuple(obj, "ii", &sz.width, &sz.height) > 0;
@ -465,6 +483,7 @@ static inline PyObject* pyopencv_from(const Size& sz)
static inline bool pyopencv_to(PyObject* obj, Rect& r, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
return PyArg_ParseTuple(obj, "iiii", &r.x, &r.y, &r.width, &r.height) > 0;
@ -477,6 +496,7 @@ static inline PyObject* pyopencv_from(const Rect& r)
static inline bool pyopencv_to(PyObject* obj, Range& r, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyObject_Size(obj) == 0)
@ -494,6 +514,7 @@ static inline PyObject* pyopencv_from(const Range& r)
static inline bool pyopencv_to(PyObject* obj, CvSlice& r, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyObject_Size(obj) == 0)
@ -511,6 +532,7 @@ static inline PyObject* pyopencv_from(const CvSlice& r)
static inline bool pyopencv_to(PyObject* obj, Point& p, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyComplex_CheckExact(obj))
@ -525,6 +547,7 @@ static inline bool pyopencv_to(PyObject* obj, Point& p, const char* name = "<unk
static inline bool pyopencv_to(PyObject* obj, Point2f& p, const char* name = "<unknown>")
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(PyComplex_CheckExact(obj))
@ -549,6 +572,7 @@ static inline PyObject* pyopencv_from(const Point2f& p)
static inline bool pyopencv_to(PyObject* obj, Vec3d& v, const char* name = "<unknown>")
{
(void)name;
if(!obj)
return true;
return PyArg_ParseTuple(obj, "ddd", &v[0], &v[1], &v[2]) > 0;
@ -792,6 +816,7 @@ template<> struct pyopencvVecConverter<string>
static inline bool pyopencv_to(PyObject *obj, CvTermCriteria& dst, const char *name="<unknown>")
{
(void)name;
if(!obj)
return true;
return PyArg_ParseTuple(obj, "iid", &dst.type, &dst.max_iter, &dst.epsilon) > 0;
@ -804,6 +829,7 @@ static inline PyObject* pyopencv_from(const CvTermCriteria& src)
static inline bool pyopencv_to(PyObject *obj, TermCriteria& dst, const char *name="<unknown>")
{
(void)name;
if(!obj)
return true;
return PyArg_ParseTuple(obj, "iid", &dst.type, &dst.maxCount, &dst.epsilon) > 0;
@ -816,6 +842,7 @@ static inline PyObject* pyopencv_from(const TermCriteria& src)
static inline bool pyopencv_to(PyObject *obj, RotatedRect& dst, const char *name="<unknown>")
{
(void)name;
if(!obj)
return true;
return PyArg_ParseTuple(obj, "(ff)(ff)f", &dst.center.x, &dst.center.y, &dst.size.width, &dst.size.height, &dst.angle) > 0;
@ -847,6 +874,7 @@ static inline PyObject* pyopencv_from(const CvDTreeNode* node)
static bool pyopencv_to(PyObject *o, cv::flann::IndexParams& p, const char *name="<unknown>")
{
(void)name;
bool ok = false;
PyObject* keys = PyObject_CallMethod(o,(char*)"keys",0);
PyObject* values = PyObject_CallMethod(o,(char*)"values",0);
@ -927,7 +955,7 @@ static void OnMouse(int event, int x, int y, int flags, void* param)
PyGILState_Release(gstate);
}
static PyObject *pycvSetMouseCallback(PyObject *self, PyObject *args, PyObject *kw)
static PyObject *pycvSetMouseCallback(PyObject*, PyObject *args, PyObject *kw)
{
const char *keywords[] = { "window_name", "on_mouse", "param", NULL };
char* name;
@ -961,7 +989,7 @@ static void OnChange(int pos, void *param)
PyGILState_Release(gstate);
}
static PyObject *pycvCreateTrackbar(PyObject *self, PyObject *args)
static PyObject *pycvCreateTrackbar(PyObject*, PyObject *args)
{
PyObject *on_change;
char* trackbar_name;
@ -983,6 +1011,11 @@ static PyObject *pycvCreateTrackbar(PyObject *self, PyObject *args)
#define MKTYPE2(NAME) pyopencv_##NAME##_specials(); if (!to_ok(&pyopencv_##NAME##_Type)) return
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#include "pyopencv_generated_types.h"
#include "pyopencv_generated_funcs.h"

View File

@ -1,9 +1,4 @@
#include "perf_precomp.hpp"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/flann/flann.hpp"

View File

@ -18,7 +18,7 @@ using namespace cv;
#if !defined(HAVE_CUDA)
int main( int argc, const char** argv )
int main( int, const char** )
{
cout << "Please compile the library with CUDA support" << endl;
return -1;

View File

@ -20,7 +20,7 @@
#endif
#if !defined(HAVE_CUDA)
int main( int argc, const char** argv )
int main( int, const char** )
{
std::cout << "Please compile the library with CUDA support" << std::endl;
return -1;