From 23a9b7bb9c64d0f8440f60138bb89aadf989dedf Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 30 Apr 2011 19:29:26 +0000 Subject: [PATCH] fixed several warnings from Xcode 4 LLVM compiler; fixed bug #920 --- 3rdparty/libjasper/jas_debug.c | 2 +- 3rdparty/libjasper/jp2_cod.c | 8 ++++---- 3rdparty/libjasper/jpc_cs.c | 3 +-- 3rdparty/libjasper/jpc_mqdec.c | 6 +++--- 3rdparty/libjasper/jpc_mqenc.c | 4 ++-- 3rdparty/libjasper/jpc_t2dec.c | 2 +- 3rdparty/libjpeg/transupp.c | 4 ++++ 3rdparty/libtiff/tif_predict.c | 2 +- 3rdparty/libtiff/tif_unix.c | 12 ++++++------ modules/calib3d/src/circlesgrid.cpp | 4 ++-- modules/features2d/test/test_features2d.cpp | 5 ++--- modules/flann/include/opencv2/flann/general.h | 8 +------- modules/flann/include/opencv2/flann/logger.h | 13 +++++++++---- modules/flann/src/precomp.hpp | 1 - modules/highgui/src/window_cocoa.mm | 4 ++-- modules/objdetect/src/datamatrix.cpp | 6 +++--- modules/python/src/cv.cpp | 19 +++++++++---------- modules/python/src/opencv2x.h | 1 - 18 files changed, 51 insertions(+), 53 deletions(-) diff --git a/3rdparty/libjasper/jas_debug.c b/3rdparty/libjasper/jas_debug.c index 8a762d562a..ca09d1d92c 100644 --- a/3rdparty/libjasper/jas_debug.c +++ b/3rdparty/libjasper/jas_debug.c @@ -125,7 +125,7 @@ int jas_memdump(FILE *out, void *data, size_t len) uchar *dp; dp = data; for (i = 0; i < len; i += 16) { - fprintf(out, "%04x:", i); + fprintf(out, "%04x:", (int)i); for (j = 0; j < 16; ++j) { if (i + j < len) { fprintf(out, " %02x", dp[i + j]); diff --git a/3rdparty/libjasper/jp2_cod.c b/3rdparty/libjasper/jp2_cod.c index c4c4502fd1..3610023dce 100644 --- a/3rdparty/libjasper/jp2_cod.c +++ b/3rdparty/libjasper/jp2_cod.c @@ -490,18 +490,18 @@ int jp2_box_put(jp2_box_t *box, jas_stream_t *out) box->len = jas_stream_tell(tmpstream) + JP2_BOX_HDRLEN(false); jas_stream_rewind(tmpstream); } - extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0; - if (jp2_putuint32(out, extlen ? 1 : box->len)) { + //extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0; + if (jp2_putuint32(out, /*extlen ? 1 :*/ box->len)) { goto error; } if (jp2_putuint32(out, box->type)) { goto error; } - if (extlen) { + /*if (extlen) { if (jp2_putuint64(out, box->len)) { goto error; } - } + }*/ if (dataflag) { if (jas_stream_copy(out, tmpstream, box->len - JP2_BOX_HDRLEN(false))) { diff --git a/3rdparty/libjasper/jpc_cs.c b/3rdparty/libjasper/jpc_cs.c index 3d47cbe19d..dde08358f7 100644 --- a/3rdparty/libjasper/jpc_cs.c +++ b/3rdparty/libjasper/jpc_cs.c @@ -240,8 +240,7 @@ jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate) } /* Get the marker type. */ - if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN || - ms->id > JPC_MS_MAX) { + if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN /*|| ms->id > JPC_MS_MAX*/) { jpc_ms_destroy(ms); return 0; } diff --git a/3rdparty/libjasper/jpc_mqdec.c b/3rdparty/libjasper/jpc_mqdec.c index 37c0f8437b..6f19f05879 100644 --- a/3rdparty/libjasper/jpc_mqdec.c +++ b/3rdparty/libjasper/jpc_mqdec.c @@ -300,7 +300,7 @@ void jpc_mqdec_dump(jpc_mqdec_t *mqdec, FILE *out) fprintf(out, "MQDEC A = %08lx, C = %08lx, CT=%08lx, ", (unsigned long) mqdec->areg, (unsigned long) mqdec->creg, (unsigned long) mqdec->ctreg); - fprintf(out, "CTX = %d, ", mqdec->curctx - mqdec->ctxs); - fprintf(out, "IND %d, MPS %d, QEVAL %x\n", *mqdec->curctx - - jpc_mqstates, (*mqdec->curctx)->mps, (*mqdec->curctx)->qeval); + fprintf(out, "CTX = %d, ", (int)(mqdec->curctx - mqdec->ctxs)); + fprintf(out, "IND %d, MPS %d, QEVAL %x\n", (int)(*mqdec->curctx - + jpc_mqstates), (int)(*mqdec->curctx)->mps, (int)(*mqdec->curctx)->qeval); } diff --git a/3rdparty/libjasper/jpc_mqenc.c b/3rdparty/libjasper/jpc_mqenc.c index b3683f7348..7a3aa36f00 100644 --- a/3rdparty/libjasper/jpc_mqenc.c +++ b/3rdparty/libjasper/jpc_mqenc.c @@ -386,7 +386,7 @@ int jpc_mqenc_dump(jpc_mqenc_t *mqenc, FILE *out) fprintf(out, "AREG = %08x, CREG = %08x, CTREG = %d\n", mqenc->areg, mqenc->creg, mqenc->ctreg); fprintf(out, "IND = %02d, MPS = %d, QEVAL = %04x\n", - *mqenc->curctx - jpc_mqstates, (*mqenc->curctx)->mps, - (*mqenc->curctx)->qeval); + (int)(*mqenc->curctx - jpc_mqstates), (int)(*mqenc->curctx)->mps, + (int)(*mqenc->curctx)->qeval); return 0; } diff --git a/3rdparty/libjasper/jpc_t2dec.c b/3rdparty/libjasper/jpc_t2dec.c index 9bfde32663..10f4839378 100644 --- a/3rdparty/libjasper/jpc_t2dec.c +++ b/3rdparty/libjasper/jpc_t2dec.c @@ -574,7 +574,7 @@ long jpc_dec_lookahead(jas_stream_t *in) jas_stream_ungetc(in, x >> 8) == EOF) { return -1; } - if (x >= JPC_MS_INMIN && x <= JPC_MS_INMAX) { + if (x >= JPC_MS_INMIN /*&& x <= JPC_MS_INMAX*/) { return x; } return 0; diff --git a/3rdparty/libjpeg/transupp.c b/3rdparty/libjpeg/transupp.c index ff0f275cfc..c778add1b0 100644 --- a/3rdparty/libjpeg/transupp.c +++ b/3rdparty/libjpeg/transupp.c @@ -1309,6 +1309,8 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, case JXFORM_ROT_270: transpose_critical_parameters(dstinfo); break; + default: + break; } /* Adjust Exif properties */ @@ -1446,6 +1448,8 @@ jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height, if (image_height % (JDIMENSION) MCU_height) result = FALSE; break; + default: + break; } return result; diff --git a/3rdparty/libtiff/tif_predict.c b/3rdparty/libtiff/tif_predict.c index bbc221f27f..b972c6d916 100644 --- a/3rdparty/libtiff/tif_predict.c +++ b/3rdparty/libtiff/tif_predict.c @@ -584,7 +584,7 @@ PredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s) { TIFFErrorExt(tif->tif_clientdata, module, "Out of memory allocating %d byte temp buffer.", - cc0 ); + (int)cc0 ); return 0; } memcpy( working_copy, bp0, cc0 ); diff --git a/3rdparty/libtiff/tif_unix.c b/3rdparty/libtiff/tif_unix.c index e0f1a8ddf2..548f5422c5 100644 --- a/3rdparty/libtiff/tif_unix.c +++ b/3rdparty/libtiff/tif_unix.c @@ -51,25 +51,25 @@ static tsize_t _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { - return ((tsize_t) read((int) fd, buf, (size_t) size)); + return ((tsize_t) read((int) (size_t)fd, buf, (size_t) size)); } static tsize_t _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) { - return ((tsize_t) write((int) fd, buf, (size_t) size)); + return ((tsize_t) write((int) (size_t)fd, buf, (size_t) size)); } static toff_t _tiffSeekProc(thandle_t fd, toff_t off, int whence) { - return ((toff_t) lseek((int) fd, (off_t) off, whence)); + return ((toff_t) lseek((int) (size_t)fd, (off_t) off, whence)); } static int _tiffCloseProc(thandle_t fd) { - return (close((int) fd)); + return (close((int) (size_t)fd)); } @@ -81,7 +81,7 @@ _tiffSizeProc(thandle_t fd) return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize); #else struct stat sb; - return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size); + return (toff_t) (fstat((int) (size_t)fd, &sb) < 0 ? 0 : sb.st_size); #endif } @@ -133,7 +133,7 @@ TIFFFdOpen(int fd, const char* name, const char* mode) TIFF* tif; tif = TIFFClientOpen(name, mode, - (thandle_t) fd, + (thandle_t) (size_t)fd, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); diff --git a/modules/calib3d/src/circlesgrid.cpp b/modules/calib3d/src/circlesgrid.cpp index 42cd520d23..413ef27511 100644 --- a/modules/calib3d/src/circlesgrid.cpp +++ b/modules/calib3d/src/circlesgrid.cpp @@ -73,7 +73,7 @@ void CirclesGridClusterFinder::hierarchicalClustering(const vector poin } int patternClusterIdx = 0; - while(clusters[patternClusterIdx].size() < patternSize.area() && countNonZero(distsMask == 255) > 0) + while((int)clusters[patternClusterIdx].size() < patternSize.area() && countNonZero(distsMask == 255) > 0) { Point minLoc; minMaxLoc(dists, 0, 0, &minLoc, 0, distsMask); @@ -93,7 +93,7 @@ void CirclesGridClusterFinder::hierarchicalClustering(const vector poin } patternPoints.clear(); - if(clusters[patternClusterIdx].size() != patternSize.area()) + if((int)clusters[patternClusterIdx].size() != patternSize.area()) { return; } diff --git a/modules/features2d/test/test_features2d.cpp b/modules/features2d/test/test_features2d.cpp index 2e9280b354..3b75499572 100644 --- a/modules/features2d/test/test_features2d.cpp +++ b/modules/features2d/test/test_features2d.cpp @@ -481,10 +481,9 @@ protected: return true; } + string name; const DistanceType maxDist; const float prevTime; - - string name; Ptr dextractor; Distance distance; @@ -516,7 +515,7 @@ class CV_DescriptorMatcherTest : public cvtest::BaseTest { public: CV_DescriptorMatcherTest( const string& _name, const Ptr& _dmatcher, float _badPart ) : - name(_name), badPart(_badPart), dmatcher(_dmatcher) + badPart(_badPart), name(_name), dmatcher(_dmatcher) {} protected: static const int dim = 500; diff --git a/modules/flann/include/opencv2/flann/general.h b/modules/flann/include/opencv2/flann/general.h index 7ca25cd9a6..880cc84b0c 100644 --- a/modules/flann/include/opencv2/flann/general.h +++ b/modules/flann/include/opencv2/flann/general.h @@ -36,6 +36,7 @@ #include #include #include "opencv2/flann/object_factory.h" +#include "opencv2/flann/logger.h" namespace cvflann { @@ -58,13 +59,6 @@ enum flann_centers_init_t { FLANN_CENTERS_KMEANSPP = 2 }; -enum flann_log_level_t { - FLANN_LOG_NONE = 0, - FLANN_LOG_FATAL = 1, - FLANN_LOG_ERROR = 2, - FLANN_LOG_WARN = 3, - FLANN_LOG_INFO = 4 -}; enum flann_distance_t { FLANN_DIST_EUCLIDEAN = 1, diff --git a/modules/flann/include/opencv2/flann/logger.h b/modules/flann/include/opencv2/flann/logger.h index a5300c05db..979756d305 100644 --- a/modules/flann/include/opencv2/flann/logger.h +++ b/modules/flann/include/opencv2/flann/logger.h @@ -31,15 +31,20 @@ #ifndef _OPENCV_LOGGER_H_ #define _OPENCV_LOGGER_H_ - #include #include -#include "opencv2/flann/general.h" - namespace cvflann { - + +enum flann_log_level_t { + FLANN_LOG_NONE = 0, + FLANN_LOG_FATAL = 1, + FLANN_LOG_ERROR = 2, + FLANN_LOG_WARN = 3, + FLANN_LOG_INFO = 4 +}; + class CV_EXPORTS Logger { FILE* stream; diff --git a/modules/flann/src/precomp.hpp b/modules/flann/src/precomp.hpp index bcf411f011..67deeeb8c0 100644 --- a/modules/flann/src/precomp.hpp +++ b/modules/flann/src/precomp.hpp @@ -7,7 +7,6 @@ #include "opencv2/flann/dist.h" #include "opencv2/flann/index_testing.h" -#include "opencv2/flann/logger.h" #include "opencv2/flann/saving.h" #include "opencv2/flann/general.h" diff --git a/modules/highgui/src/window_cocoa.mm b/modules/highgui/src/window_cocoa.mm index 176d8f3e71..fd0efe9293 100644 --- a/modules/highgui/src/window_cocoa.mm +++ b/modules/highgui/src/window_cocoa.mm @@ -122,7 +122,7 @@ static bool wasInitialized = false; - (void)createSliderWithName:(const char *)name maxValue:(int)max value:(int *)value callback:(CvTrackbarCallback)callback; @end -static void icvCocoaCleanup(void) +/*static void icvCocoaCleanup(void) { //cout << "icvCocoaCleanup" << endl; if( application ) @@ -132,7 +132,7 @@ static void icvCocoaCleanup(void) application = 0; [pool release]; } -} +}*/ CV_IMPL int cvInitSystem( int argc, char** argv) { diff --git a/modules/objdetect/src/datamatrix.cpp b/modules/objdetect/src/datamatrix.cpp index 674c1d1cff..3b96d69d8d 100644 --- a/modules/objdetect/src/datamatrix.cpp +++ b/modules/objdetect/src/datamatrix.cpp @@ -62,7 +62,7 @@ static const uint8 Alog[256] = { 1,2,4,8,16,32,64,128,45,90,180,69,138,57,114,22 169,127,254,209,143,51,102,204,181,71,142,49,98,196,165,103,206,177,79,158,17,34,68,136,61,122,244,197,167,99, 198,161,111,222,145,15,30,60,120,240,205,183,67,134,33,66,132,37,74,148,5,10,20,40,80,160,109,218,153,31,62, 124,248,221,151,3,6,12,24,48,96,192,173,119,238,241,207,179,75,150,1 }; -static const uint8 Log[256] = { -255,255,1,240,2,225,241,53,3,38,226,133,242,43,54,210,4,195,39, +static const uint8 Log[256] = { (uchar)-255,255,1,240,2,225,241,53,3,38,226,133,242,43,54,210,4,195,39, 114,227,106,134,28,243,140,44,23,55,118,211,234,5,219,196,96,40,222,115,103,228,78,107,125, 135,8,29,162,244,186,141,180,45,99,24,49,56,13,119,153,212,199,235,91,6,76,220,217,197,11,97, 184,41,36,223,253,116,138,104,193,229,86,79,171,108,165,126,145,136,34,9,74,30,32,163,84,245, @@ -161,9 +161,9 @@ int Sampler::hasbars() void Sampler::timing() { - uint8 dark = getpixel(9, 0); + uint8 light, dark = getpixel(9, 0); for (int i = 1; i < 3; i += 2) { - uint8 light = getpixel(9, i); + light = getpixel(9, i); // if (light <= dark) // goto endo; dark = getpixel(9, i + 1); diff --git a/modules/python/src/cv.cpp b/modules/python/src/cv.cpp index 3ac32d3d4d..c4909491c1 100644 --- a/modules/python/src/cv.cpp +++ b/modules/python/src/cv.cpp @@ -1394,7 +1394,7 @@ static void cvsubdiv2dpoint_specials(void) /************************************************************************/ /* convert_to_X: used after PyArg_ParseTuple in the generated code */ -static int convert_to_PyObjectPTR(PyObject *o, PyObject **dst, const char *name = "no_name") +/*static int convert_to_PyObjectPTR(PyObject *o, PyObject **dst, const char *name = "no_name") { *dst = o; return 1; @@ -1404,7 +1404,7 @@ static int convert_to_PyCallableObjectPTR(PyObject *o, PyObject **dst, const cha { *dst = o; return 1; -} +}*/ static int convert_to_char(PyObject *o, char *dst, const char *name = "no_name") { @@ -2097,7 +2097,7 @@ static int convert_to_CvArrs(PyObject *o, CvArrs *dst, const char *name = "no_na return 1; } -static int convert_to_floatPTRPTR(PyObject *o, float*** dst, const char *name = "no_name") +/*static int convert_to_floatPTRPTR(PyObject *o, float*** dst, const char *name = "no_name") { PyObject *fi = PySequence_Fast(o, name); if (fi == NULL) @@ -2113,7 +2113,7 @@ static int convert_to_floatPTRPTR(PyObject *o, float*** dst, const char *name = } *dst = r; return 1; -} +}*/ static int convert_to_CvFontPTR(PyObject *o, CvFont** dst, const char *name = "no_name") { @@ -2126,7 +2126,7 @@ static int convert_to_CvFontPTR(PyObject *o, CvFont** dst, const char *name = "n } } -static int convert_to_CvContourTreePTR(PyObject *o, CvContourTree** dst, const char *name = "no_name") +/*static int convert_to_CvContourTreePTR(PyObject *o, CvContourTree** dst, const char *name = "no_name") { if (PyType_IsSubtype(o->ob_type, &cvcontourtree_Type)) { (*dst) = ((cvcontourtree_t*)o)->a; @@ -2135,7 +2135,7 @@ static int convert_to_CvContourTreePTR(PyObject *o, CvContourTree** dst, const c (*dst) = NULL; return failmsg("Expected CvContourTree for argument '%s'", name); } -} +}*/ static int convert_to_CvRNGPTR(PyObject *o, CvRNG** dst, const char *name = "no_name") { @@ -2607,12 +2607,12 @@ static PyObject *FROM_CvRNG(CvRNG r) return (PyObject*)m; } -static PyObject *FROM_CvContourTreePTR(CvContourTree *r) +/*static PyObject *FROM_CvContourTreePTR(CvContourTree *r) { cvcontourtree_t *m = PyObject_NEW(cvcontourtree_t, &cvcontourtree_Type); m->a = r; return (PyObject*)m; -} +}*/ static PyObject *FROM_generic(generic r) { @@ -3690,8 +3690,7 @@ static PyObject *pyfinddatamatrix(PyObject *self, PyObject *args) ERRWRAP(codes = cvFindDataMatrix(image)); PyObject *pycodes = PyList_New(codes.size()); - int i; - for (i = 0; i < codes.size(); i++) { + for (size_t i = 0; i < codes.size(); i++) { DataMatrixCode *pc = &codes[i]; PyList_SetItem(pycodes, i, Py_BuildValue("(sOO)", pc->msg, FROM_CvMat(pc->corners), FROM_CvMat(pc->original))); } diff --git a/modules/python/src/opencv2x.h b/modules/python/src/opencv2x.h index 4f2ec2cd66..271118236a 100644 --- a/modules/python/src/opencv2x.h +++ b/modules/python/src/opencv2x.h @@ -555,7 +555,6 @@ template static inline PyObject* pyopencv_from(const vector<_Tp>& } static PyObject* pyopencv_from(const KeyPoint&); -static bool pyopencv_from(PyObject*,KeyPoint&,const char*); template static inline bool pyopencv_to_generic_vec(PyObject* obj, vector<_Tp>& value, const char* name="") {