fixed multiple GCC warnings on Ubuntu 11.04
authorVadim Pisarevsky <no@email>
Tue, 14 Jun 2011 12:03:34 +0000 (12:03 +0000)
committerVadim Pisarevsky <no@email>
Tue, 14 Jun 2011 12:03:34 +0000 (12:03 +0000)
22 files changed:
3rdparty/libjasper/jas_icc.c
3rdparty/libjasper/jas_image.c
3rdparty/libjasper/jas_seq.c
3rdparty/libjasper/jp2_cod.c
3rdparty/libjasper/jpc_cs.c
3rdparty/libjasper/jpc_dec.c
3rdparty/libjasper/jpc_mqenc.c
3rdparty/libtiff/tif_dirread.c
3rdparty/libtiff/tif_unix.c
modules/core/include/opencv2/core/operations.hpp
modules/core/src/mathfuncs.cpp
modules/core/src/rand.cpp
modules/core/src/stat.cpp
modules/highgui/src/cap_dc1394_v2.cpp
modules/imgproc/src/accum.cpp
modules/imgproc/src/inpaint.cpp
modules/imgproc/src/linefit.cpp
modules/imgproc/test/test_convhull.cpp
modules/imgproc/test/test_subdivisions.cpp
modules/legacy/src/contourtree.cpp
modules/python/src1/cv.cpp
modules/python/src2/gen2.py

index e5a0a2e..13f2864 100644 (file)
@@ -730,9 +730,9 @@ void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out)
                fprintf(out, "attrno=%d; attrname=\"%s\"(0x%08x); attrtype=\"%s\"(0x%08x)\n",
                  i,
                  jas_iccsigtostr(attr->name, &buf[0]),
-                 attr->name,
+                 (unsigned)attr->name,
                  jas_iccsigtostr(attrval->type, &buf[8]),
-                 attrval->type
+                 (unsigned)attrval->type
                  );
                jas_iccattrval_dump(attrval, out);
                fprintf(out, "---\n");
@@ -884,7 +884,7 @@ void jas_iccattrval_dump(jas_iccattrval_t *attrval, FILE *out)
        char buf[8];
        jas_iccsigtostr(attrval->type, buf);
        fprintf(out, "refcnt = %d; type = 0x%08x %s\n", attrval->refcnt,
-         attrval->type, jas_iccsigtostr(attrval->type, &buf[0]));
+         (unsigned)attrval->type, jas_iccsigtostr(attrval->type, &buf[0]));
        if (attrval->ops->dump) {
                (*attrval->ops->dump)(attrval, out);
        }
@@ -1041,7 +1041,7 @@ static void jas_icccurv_dump(jas_iccattrval_t *attrval, FILE *out)
 {
        int i;
        jas_icccurv_t *curv = &attrval->data.curv;
-       fprintf(out, "number of entires = %d\n", curv->numents);
+       fprintf(out, "number of entires = %d\n", (int)curv->numents);
        if (curv->numents == 1) {
                fprintf(out, "gamma = %f\n", curv->ents[0] / 256.0);
        } else {
@@ -1167,9 +1167,9 @@ static void jas_icctxtdesc_dump(jas_iccattrval_t *attrval, FILE *out)
 {
        jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
        fprintf(out, "ascii = \"%s\"\n", txtdesc->ascdata);
-       fprintf(out, "uclangcode = %d; uclen = %d\n", txtdesc->uclangcode,
-         txtdesc->uclen);
-       fprintf(out, "sccode = %d\n", txtdesc->sccode);
+       fprintf(out, "uclangcode = %d; uclen = %d\n", (int)txtdesc->uclangcode,
+         (int)txtdesc->uclen);
+       fprintf(out, "sccode = %d\n", (int)txtdesc->sccode);
        fprintf(out, "maclen = %d\n", txtdesc->maclen);
 }
 
@@ -1401,7 +1401,7 @@ static void jas_icclut8_dump(jas_iccattrval_t *attrval, FILE *out)
                fprintf(out, "\n");
        }
        fprintf(out, "numintabents=%d, numouttabents=%d\n",
-         lut8->numintabents, lut8->numouttabents);
+         (int)lut8->numintabents, (int)lut8->numouttabents);
 }
 
 /******************************************************************************\
@@ -1565,7 +1565,7 @@ static void jas_icclut16_dump(jas_iccattrval_t *attrval, FILE *out)
                fprintf(out, "\n");
        }
        fprintf(out, "numintabents=%d, numouttabents=%d\n",
-         lut16->numintabents, lut16->numouttabents);
+         (int)lut16->numintabents, (int)lut16->numouttabents);
 }
 
 /******************************************************************************\
index e094bde..5b188b9 100644 (file)
@@ -822,7 +822,7 @@ void jas_image_dump(jas_image_t *image, FILE *out)
        for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
                cmpt = image->cmpts_[cmptno];
                fprintf(out, "prec=%d, sgnd=%d, cmpttype=%d\n", cmpt->prec_,
-                 cmpt->sgnd_, cmpt->type_);
+                 cmpt->sgnd_, (int)cmpt->type_);
                width = jas_image_cmptwidth(image, cmptno);
                height = jas_image_cmptheight(image, cmptno);
                n = JAS_MIN(16, width);
index bb9d1fb..ecdcbdf 100644 (file)
@@ -423,10 +423,10 @@ int jas_seq2d_output(jas_matrix_t *matrix, FILE *out)
        char sbuf[MAXLINELEN + 1];
        int n;
 
-       fprintf(out, "%d %d\n", jas_seq2d_xstart(matrix),
-         jas_seq2d_ystart(matrix));
-       fprintf(out, "%d %d\n", jas_matrix_numcols(matrix),
-         jas_matrix_numrows(matrix));
+       fprintf(out, "%d %d\n", (int)jas_seq2d_xstart(matrix),
+         (int)jas_seq2d_ystart(matrix));
+       fprintf(out, "%d %d\n", (int)jas_matrix_numcols(matrix),
+         (int)jas_matrix_numrows(matrix));
 
        buf[0] = '\0';
        for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
index 3610023..f900062 100644 (file)
@@ -321,7 +321,7 @@ void jp2_box_dump(jp2_box_t *box, FILE *out)
 
        fprintf(out, "JP2 box: ");
        fprintf(out, "type=%c%s%c (0x%08x); length=%d\n", '"', boxinfo->name,
-         '"', box->type, box->len);
+         '"', (unsigned)box->type, (int)box->len);
        if (box->ops->dumpdata) {
                (*box->ops->dumpdata)(box, out);
        }
@@ -433,7 +433,7 @@ static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out)
        unsigned int i;
        for (i = 0; i < cdef->numchans; ++i) {
                fprintf(out, "channo=%d; type=%d; assoc=%d\n",
-                 cdef->ents[i].channo, cdef->ents[i].type, cdef->ents[i].assoc);
+                 (int)cdef->ents[i].channo, (int)cdef->ents[i].type, (int)cdef->ents[i].assoc);
        }
 }
 
@@ -871,7 +871,7 @@ static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out)
          (int) pclr->numchans);
        for (i = 0; i < pclr->numlutents; ++i) {
                for (j = 0; j < pclr->numchans; ++j) {
-                       fprintf(out, "LUT[%d][%d]=%d\n", i, j, pclr->lutdata[i * pclr->numchans + j]);
+                       fprintf(out, "LUT[%d][%d]=%d\n", i, j, (int)pclr->lutdata[i * pclr->numchans + j]);
                }
        }
 }
index dde0835..a7683af 100644 (file)
@@ -403,9 +403,9 @@ void jpc_ms_dump(jpc_ms_t *ms, FILE *out)
 {
        jpc_mstabent_t *mstabent;
        mstabent = jpc_mstab_lookup(ms->id);
-       fprintf(out, "type = 0x%04x (%s);", ms->id, mstabent->name);
+       fprintf(out, "type = 0x%04x (%s);", (unsigned)ms->id, mstabent->name);
        if (JPC_MS_HASPARMS(ms->id)) {
-               fprintf(out, " len = %d;", ms->len + 2);
+               fprintf(out, " len = %d;", (int)(ms->len + 2));
                if (ms->ops->dumpparms) {
                        (*ms->ops->dumpparms)(ms, out);
                } else {
@@ -459,7 +459,7 @@ static int jpc_sot_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_sot_t *sot = &ms->parms.sot;
        fprintf(out, "tileno = %d; len = %d; partno = %d; numparts = %d\n",
-         sot->tileno, sot->len, sot->partno, sot->numparts);
+         (int)sot->tileno, (int)sot->len, sot->partno, sot->numparts);
        return 0;
 }
 
@@ -558,12 +558,12 @@ static int jpc_siz_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_siz_t *siz = &ms->parms.siz;
        unsigned int i;
-       fprintf(out, "caps = 0x%02x;\n", siz->caps);
+       fprintf(out, "caps = 0x%02x;\n", (unsigned)siz->caps);
        fprintf(out, "width = %d; height = %d; xoff = %d; yoff = %d;\n",
-         siz->width, siz->height, siz->xoff, siz->yoff);
+         (int)siz->width, (int)siz->height, (int)siz->xoff, (int)siz->yoff);
        fprintf(out, "tilewidth = %d; tileheight = %d; tilexoff = %d; "
-         "tileyoff = %d;\n", siz->tilewidth, siz->tileheight, siz->tilexoff,
-         siz->tileyoff);
+         "tileyoff = %d;\n", (int)siz->tilewidth, (int)siz->tileheight, (int)siz->tilexoff,
+         (int)siz->tileyoff);
        for (i = 0; i < siz->numcomps; ++i) {
                fprintf(out, "prec[%d] = %d; sgnd[%d] = %d; hsamp[%d] = %d; "
                  "vsamp[%d] = %d\n", i, siz->comps[i].prec, i,
@@ -631,7 +631,7 @@ static int jpc_cod_dumpparms(jpc_ms_t *ms, FILE *out)
        fprintf(out, "numdlvls = %d; qmfbid = %d; mctrans = %d\n",
          cod->compparms.numdlvls, cod->compparms.qmfbid, cod->mctrans);
        fprintf(out, "prg = %d; numlyrs = %d;\n",
-         cod->prg, cod->numlyrs);
+         cod->prg, (int)cod->numlyrs);
        fprintf(out, "cblkwidthval = %d; cblkheightval = %d; "
          "cblksty = 0x%02x;\n", cod->compparms.cblkwidthval, cod->compparms.cblkheightval,
          cod->compparms.cblksty);
@@ -709,7 +709,7 @@ static int jpc_coc_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_coc_t *coc = &ms->parms.coc;
        fprintf(out, "compno = %d; csty = 0x%02x; numdlvls = %d;\n",
-         coc->compno, coc->compparms.csty, coc->compparms.numdlvls);
+         (int)coc->compno, coc->compparms.csty, coc->compparms.numdlvls);
        fprintf(out, "cblkwidthval = %d; cblkheightval = %d; "
          "cblksty = 0x%02x; qmfbid = %d;\n", coc->compparms.cblkwidthval,
          coc->compparms.cblkheightval, coc->compparms.cblksty, coc->compparms.qmfbid);
@@ -840,7 +840,7 @@ static int jpc_rgn_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_rgn_t *rgn = &ms->parms.rgn;
        fprintf(out, "compno = %d; roisty = %d; roishift = %d\n",
-         rgn->compno, rgn->roisty, rgn->roishift);
+         (int)rgn->compno, rgn->roisty, rgn->roishift);
        return 0;
 }
 
@@ -933,7 +933,7 @@ static int jpc_qcc_dumpparms(jpc_ms_t *ms, FILE *out)
        jpc_qcc_t *qcc = &ms->parms.qcc;
        int i;
        fprintf(out, "compno = %d; qntsty = %d; numguard = %d; "
-         "numstepsizes = %d\n", qcc->compno, qcc->compparms.qntsty, qcc->compparms.numguard,
+         "numstepsizes = %d\n", (int)qcc->compno, qcc->compparms.qntsty, qcc->compparms.numguard,
          qcc->compparms.numstepsizes);
        for (i = 0; i < qcc->compparms.numstepsizes; ++i) {
                fprintf(out, "expn[%d] = 0x%04x; mant[%d] = 0x%04x;\n",
@@ -1056,7 +1056,7 @@ static int jpc_sop_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
 static int jpc_sop_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_sop_t *sop = &ms->parms.sop;
-       fprintf(out, "seqno = %d;\n", sop->seqno);
+       fprintf(out, "seqno = %d;\n", (int)sop->seqno);
        return 0;
 }
 
@@ -1122,7 +1122,7 @@ static int jpc_ppm_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
 static int jpc_ppm_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_ppm_t *ppm = &ms->parms.ppm;
-       fprintf(out, "ind=%d; len = %d;\n", ppm->ind, ppm->len);
+       fprintf(out, "ind=%d; len = %d;\n", ppm->ind, (int)ppm->len);
        if (ppm->len > 0) {
                fprintf(out, "data =\n");
                jas_memdump(out, ppm->data, ppm->len);
@@ -1194,7 +1194,7 @@ static int jpc_ppt_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *ou
 static int jpc_ppt_dumpparms(jpc_ms_t *ms, FILE *out)
 {
        jpc_ppt_t *ppt = &ms->parms.ppt;
-       fprintf(out, "ind=%d; len = %d;\n", ppt->ind, ppt->len);
+       fprintf(out, "ind=%d; len = %d;\n", ppt->ind, (int)ppt->len);
        if (ppt->len > 0) {
                fprintf(out, "data =\n");
                jas_memdump(out, ppt->data, ppt->len);
@@ -1301,10 +1301,10 @@ static int jpc_poc_dumpparms(jpc_ms_t *ms, FILE *out)
          ++pchgno, ++pchg) {
                fprintf(out, "po[%d] = %d; ", pchgno, pchg->prgord);
                fprintf(out, "cs[%d] = %d; ce[%d] = %d; ",
-                 pchgno, pchg->compnostart, pchgno, pchg->compnoend);
+                 pchgno, (int)pchg->compnostart, pchgno, (int)pchg->compnoend);
                fprintf(out, "rs[%d] = %d; re[%d] = %d; ",
                  pchgno, pchg->rlvlnostart, pchgno, pchg->rlvlnoend);
-               fprintf(out, "le[%d] = %d\n", pchgno, pchg->lyrnoend);
+               fprintf(out, "le[%d] = %d\n", pchgno, (int)pchg->lyrnoend);
        }
        return 0;
 }
@@ -1368,7 +1368,7 @@ static int jpc_crg_dumpparms(jpc_ms_t *ms, FILE *out)
        for (compno = 0, comp = crg->comps; compno < crg->numcomps; ++compno,
          ++comp) {
                fprintf(out, "hoff[%d] = %d; voff[%d] = %d\n", compno,
-                 comp->hoff, compno, comp->voff);
+                 (int)comp->hoff, compno, (int)comp->voff);
        }
        return 0;
 }
@@ -1430,7 +1430,7 @@ static int jpc_com_dumpparms(jpc_ms_t *ms, FILE *out)
        jpc_com_t *com = &ms->parms.com;
        unsigned int i;
        int printable;
-       fprintf(out, "regid = %d;\n", com->regid);
+       fprintf(out, "regid = %d;\n", (int)com->regid);
        printable = 1;
        for (i = 0; i < com->len; ++i) {
                if (!isprint(com->data[i])) {
index 3332deb..368813e 100644 (file)
@@ -2003,31 +2003,31 @@ static int jpc_dec_dump(jpc_dec_t *dec, FILE *out)
                          tcomp->numrlvls; ++rlvlno, ++rlvl) {
 fprintf(out, "RESOLUTION LEVEL %d\n", rlvlno);
 fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
-  rlvl->xstart, rlvl->ystart, rlvl->xend, rlvl->yend, rlvl->xend -
-  rlvl->xstart, rlvl->yend - rlvl->ystart);
+  (int)rlvl->xstart, (int)rlvl->ystart, (int)rlvl->xend, (int)rlvl->yend, (int)(rlvl->xend -
+  rlvl->xstart), (int)(rlvl->yend - rlvl->ystart));
                                for (bandno = 0, band = rlvl->bands;
                                  bandno < rlvl->numbands; ++bandno, ++band) {
 fprintf(out, "BAND %d\n", bandno);
 fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
-  jas_seq2d_xstart(band->data), jas_seq2d_ystart(band->data), jas_seq2d_xend(band->data),
-  jas_seq2d_yend(band->data), jas_seq2d_xend(band->data) - jas_seq2d_xstart(band->data),
-  jas_seq2d_yend(band->data) - jas_seq2d_ystart(band->data));
+  (int)jas_seq2d_xstart(band->data), (int)jas_seq2d_ystart(band->data), (int)jas_seq2d_xend(band->data),
+  (int)jas_seq2d_yend(band->data), (int)(jas_seq2d_xend(band->data) - jas_seq2d_xstart(band->data)),
+  (int)(jas_seq2d_yend(band->data) - jas_seq2d_ystart(band->data)));
                                        for (prcno = 0, prc = band->prcs;
                                          prcno < rlvl->numprcs; ++prcno,
                                          ++prc) {
 fprintf(out, "CODE BLOCK GROUP %d\n", prcno);
 fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
-  prc->xstart, prc->ystart, prc->xend, prc->yend, prc->xend -
-  prc->xstart, prc->yend - prc->ystart);
+  (int)prc->xstart, (int)prc->ystart, (int)prc->xend, (int)prc->yend, (int)(prc->xend -
+  prc->xstart), (int)(prc->yend - prc->ystart));
                                                for (cblkno = 0, cblk =
                                                  prc->cblks; cblkno <
                                                  prc->numcblks; ++cblkno,
                                                  ++cblk) {
 fprintf(out, "CODE BLOCK %d\n", cblkno);
 fprintf(out, "xs =%d, ys = %d, xe = %d, ye = %d, w = %d, h = %d\n",
-  jas_seq2d_xstart(cblk->data), jas_seq2d_ystart(cblk->data), jas_seq2d_xend(cblk->data),
-  jas_seq2d_yend(cblk->data), jas_seq2d_xend(cblk->data) - jas_seq2d_xstart(cblk->data),
-  jas_seq2d_yend(cblk->data) - jas_seq2d_ystart(cblk->data));
+  (int)jas_seq2d_xstart(cblk->data), (int)jas_seq2d_ystart(cblk->data), (int)jas_seq2d_xend(cblk->data),
+  (int)jas_seq2d_yend(cblk->data), (int)(jas_seq2d_xend(cblk->data) - jas_seq2d_xstart(cblk->data)),
+  (int)(jas_seq2d_yend(cblk->data) - jas_seq2d_ystart(cblk->data)));
                                                }
                                        }
                                }
index 7a3aa36..5b55ced 100644 (file)
@@ -384,7 +384,7 @@ static void jpc_mqenc_setbits(jpc_mqenc_t *mqenc)
 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);
+         (unsigned)mqenc->areg, (unsigned)mqenc->creg, (int)mqenc->ctreg);
        fprintf(out, "IND = %02d, MPS = %d, QEVAL = %04x\n",
          (int)(*mqenc->curctx - jpc_mqstates), (int)(*mqenc->curctx)->mps,
          (int)(*mqenc->curctx)->qeval);
index 907b531..0fb205b 100644 (file)
@@ -1420,7 +1420,7 @@ TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
                case TIFF_SHORT:
                case TIFF_SSHORT:
                        {
-                       uint16 v[2];
+                       uint16 v[2]={0,0};
                        return TIFFFetchShortArray(tif, dir, v)
                                && TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);
                        }
index 548f542..4767b58 100644 (file)
 
 #include <stdarg.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_UNISTD_H
+#if defined HAVE_UNISTD_H || defined __linux__
 # include <unistd.h>
 #endif
 
index 6c5dac2..e98dd0e 100644 (file)
@@ -3433,7 +3433,14 @@ public:
     static int isInstance(const void* ptr)
     {
         static _ClsName dummy;
-        return *(const void**)&dummy == *(const void**)ptr;
+        union
+        {
+            const void* p;
+            const void** pp;
+        } a, b;
+        a.p = &dummy;
+        b.p = ptr;
+        return *a.pp == *b.pp;
     }
     static void release(void** dbptr)
     {
index 4e9a744..83970fa 100644 (file)
@@ -558,8 +558,7 @@ void polarToCart( InputArray src1, InputArray src2,
 {
     Mat Mag = src1.getMat(), Angle = src2.getMat();
     int type = Angle.type(), depth = Angle.depth(), cn = Angle.channels();
-    if( !Mag.empty() )
-        CV_Assert( Angle.size == Mag.size && type == Mag.type() && (depth == CV_32F || depth == CV_64F));
+    CV_Assert( Mag.empty() || (Angle.size == Mag.size && type == Mag.type() && (depth == CV_32F || depth == CV_64F)));
     dst1.create( Angle.dims, Angle.size, type );
     dst2.create( Angle.dims, Angle.size, type );
     Mat X = dst1.getMat(), Y = dst2.getMat();
index fad9ae2..7ee7f69 100644 (file)
@@ -801,7 +801,7 @@ cvRandArr( CvRNG* _rng, CvArr* arr, int disttype, CvScalar param1, CvScalar para
     // !!! this will only work for current 64-bit MWC RNG !!!
     cv::RNG& rng = _rng ? (cv::RNG&)*_rng : cv::theRNG();
     rng.fill(mat, disttype == CV_RAND_NORMAL ?
-        cv::RNG::NORMAL : cv::RNG::UNIFORM, (cv::Scalar&)param1, (cv::Scalar&)param2 );
+        cv::RNG::NORMAL : cv::RNG::UNIFORM, cv::Scalar(param1), cv::Scalar(param2) );
 }
 
 CV_IMPL void cvRandShuffle( CvArr* arr, CvRNG* _rng, double iter_factor )
index fb75714..1e30104 100644 (file)
@@ -466,8 +466,7 @@ int cv::countNonZero( InputArray _src )
 cv::Scalar cv::mean( InputArray _src, InputArray _mask )
 {
     Mat src = _src.getMat(), mask = _mask.getMat();
-    if( !mask.empty() )
-        CV_Assert( mask.type() == CV_8U );
+    CV_Assert( mask.empty() || mask.type() == CV_8U );
     
     int k, cn = src.channels(), depth = src.depth();
     SumFunc func = sumTab[depth];
@@ -526,8 +525,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
 void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, InputArray _mask )
 {
     Mat src = _src.getMat(), mask = _mask.getMat();
-    if( !mask.empty() )
-        CV_Assert( mask.type() == CV_8U );
+    CV_Assert( mask.empty() || mask.type() == CV_8U );
     
     int k, cn = src.channels(), depth = src.depth();
     SumSqrFunc func = sumSqrTab[depth];
@@ -1059,13 +1057,20 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
     
     const Mat* arrays[] = {&src, &mask, 0};
     uchar* ptrs[2];
-    double result = 0;
+    union
+    {
+        double d;
+        int i;
+        float f;
+    }
+    result;
+    result.d = 0;
     NAryMatIterator it(arrays, ptrs);
     int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0;
     bool blockSum = (normType == NORM_L1 && depth <= CV_16S) ||
                     (normType == NORM_L2 && depth <= CV_8S);
     int isum = 0;
-    int *ibuf = (int*)&result;
+    int *ibuf = &result.i;
     size_t esz = 0;
     
     if( blockSum )
@@ -1085,7 +1090,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
             count += bsz;
             if( blockSum && (count + blockSize >= intSumBlockSize || (i+1 >= it.nplanes && j+bsz >= total)) )
             {
-                result += isum;
+                result.d += isum;
                 isum = 0;
                 count = 0;
             }
@@ -1100,14 +1105,14 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
         if( depth == CV_64F )
             ;
         else if( depth == CV_32F )
-            result = (float&)result;
+            result.d = result.f;
         else
-            result = (int&)result;
+            result.d = result.i;
     }
     else if( normType == NORM_L2 )
-        result = std::sqrt(result);
+        result.d = std::sqrt(result.d);
     
-    return result;
+    return result.d;
 }
 
     
@@ -1159,13 +1164,21 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
     
     const Mat* arrays[] = {&src1, &src2, &mask, 0};
     uchar* ptrs[3];
-    double result = 0;
+    union
+    {
+        double d;
+        float f;
+        int i;
+        unsigned u;
+    }
+    result;
+    result.d = 0;
     NAryMatIterator it(arrays, ptrs);
     int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0;
     bool blockSum = (normType == NORM_L1 && depth <= CV_16S) ||
     (normType == NORM_L2 && depth <= CV_8S);
-    unsigned int isum = 0;
-    unsigned int *ibuf = (unsigned int*)&result;
+    unsigned isum = 0;
+    unsigned *ibuf = &result.u;
     size_t esz = 0;
     
     if( blockSum )
@@ -1185,7 +1198,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
             count += bsz;
             if( blockSum && (count + blockSize >= intSumBlockSize || (i+1 >= it.nplanes && j+bsz >= total)) )
             {
-                result += isum;
+                result.d += isum;
                 isum = 0;
                 count = 0;
             }
@@ -1201,14 +1214,14 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
         if( depth == CV_64F )
             ;
         else if( depth == CV_32F )
-            result = (float&)result;
+            result.d = result.f;
         else
-            result = (int&)result;
+            result.d = result.u;
     }
     else if( normType == NORM_L2 )
-        result = std::sqrt(result);
+        result.d = std::sqrt(result.d);
     
-    return result;
+    return result.d;
 }
 
 
index b41b82f..a6b9d8d 100644 (file)
@@ -352,7 +352,7 @@ bool CvCaptureCAM_DC1394_v2_CPP::startCapture()
     {
         dc1394video_modes_t videoModes;
         dc1394_video_get_supported_modes(dcCam, &videoModes);
-        if (userMode < videoModes.num)
+        if (userMode < (int)videoModes.num)
         {
             dc1394video_mode_t mode = videoModes.modes[userMode];
             code = dc1394_video_set_mode(dcCam, mode);
@@ -665,14 +665,15 @@ bool CvCaptureCAM_DC1394_v2_CPP::setProperty(int propId, double value)
                  && dcCam)
              {
                  if (cvRound(value) == CV_CAP_PROP_DC1394_OFF)
+                 {
                      if ((feature_set.feature[dc1394properties[propId]-DC1394_FEATURE_MIN].on_off_capable)
                          && (dc1394_feature_set_power(dcCam, (dc1394feature_t)dc1394properties[propId], DC1394_OFF)==DC1394_SUCCESS))
-                         {
+                     {
                          feature_set.feature[dc1394properties[propId]-DC1394_FEATURE_MIN].is_on=DC1394_OFF;
                          return true;
-                         }
-                 else
+                     }
                      return false;
+                 }
                  //try to turn the feature ON, feature can be ON and at the same time it can be not capable to change state to OFF
                  if ( feature_set.feature[dc1394properties[propId]-DC1394_FEATURE_MIN].is_on == DC1394_OFF &&
                       (feature_set.feature[dc1394properties[propId]-DC1394_FEATURE_MIN].on_off_capable == DC1394_TRUE))
index cb2276e..a099fcb 100644 (file)
@@ -356,9 +356,7 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
     int sdepth = src.depth(), ddepth = dst.depth(), cn = src.channels();
     
     CV_Assert( dst.size == src.size && dst.channels() == cn );
-    
-    if( !mask.empty() )
-        CV_Assert( mask.size == src.size && mask.type() == CV_8U );
+    CV_Assert( mask.empty() || (mask.size == src.size && mask.type() == CV_8U) );
     
     int fidx = getAccTabIdx(sdepth, ddepth);
     AccFunc func = fidx >= 0 ? accTab[fidx] : 0;
@@ -380,9 +378,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m
     int sdepth = src.depth(), ddepth = dst.depth(), cn = src.channels();
     
     CV_Assert( dst.size == src.size && dst.channels() == cn );
-    
-    if( !mask.empty() )
-        CV_Assert( mask.size == src.size && mask.type() == CV_8U );
+    CV_Assert( mask.empty() || (mask.size == src.size && mask.type() == CV_8U) );
     
     int fidx = getAccTabIdx(sdepth, ddepth);
     AccFunc func = fidx >= 0 ? accSqrTab[fidx] : 0;
@@ -405,9 +401,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2,
     
     CV_Assert( src2.size && src1.size && src2.type() == src1.type() );
     CV_Assert( dst.size == src1.size && dst.channels() == cn );
-    
-    if( !mask.empty() )
-        CV_Assert( mask.size == src1.size && mask.type() == CV_8U );
+    CV_Assert( mask.empty() || (mask.size == src1.size && mask.type() == CV_8U) );
     
     int fidx = getAccTabIdx(sdepth, ddepth);
     AccProdFunc func = fidx >= 0 ? accProdTab[fidx] : 0;
@@ -430,9 +424,7 @@ void cv::accumulateWeighted( InputArray _src, CV_IN_OUT InputOutputArray _dst,
     int sdepth = src.depth(), ddepth = dst.depth(), cn = src.channels();
     
     CV_Assert( dst.size == src.size && dst.channels() == cn );
-    
-    if( !mask.empty() )
-        CV_Assert( mask.size == src.size && mask.type() == CV_8U );
+    CV_Assert( mask.empty() || (mask.size == src.size && mask.type() == CV_8U) );
     
     int fidx = getAccTabIdx(sdepth, ddepth);
     AccWFunc func = fidx >= 0 ? accWTab[fidx] : 0;
index f78e737..2ca3170 100644 (file)
@@ -103,7 +103,7 @@ public:
         for (i=1; i<=num; i++) {
             mem[i].prev   = mem+i-1;
             mem[i].next   = mem+i+1;
-            mem[i].i      = mem[i].i = -1;
+            mem[i].i      = -1;
             mem[i].T      = FLT_MAX;
         }
         tail       = mem+i;
index 2526858..1d237cb 100644 (file)
@@ -494,14 +494,12 @@ icvFitLine3D( CvPoint3D32f * points, int count, int dist,
     float *w;                   /* weights */
     float *r;                   /* square distances */
     int i, j, k;
-    float _line[6], _lineprev[6];
+    float _line[6]={0,0,0,0,0,0}, _lineprev[6]={0,0,0,0,0,0};
     float rdelta = reps != 0 ? reps : 1.0f;
     float adelta = aeps != 0 ? aeps : 0.01f;
     double min_err = DBL_MAX, err = 0;
     CvRNG rng = cvRNG(-1);
 
-    memset( line, 0, 6*sizeof(line[0]) );
-
     switch (dist)
     {
     case CV_DIST_L2:
index a4b61f5..1791789 100644 (file)
@@ -797,7 +797,11 @@ void CV_MinCircleTest::run_func()
     if(!test_cpp)
         cvMinEnclosingCircle( points, &center, &radius );
     else
-        cv::minEnclosingCircle(cv::cvarrToMat(points), (cv::Point2f&)center, radius);
+    {
+        cv::Point2f tmpcenter;
+        cv::minEnclosingCircle(cv::cvarrToMat(points), tmpcenter, radius);
+        center = tmpcenter;
+    }
 }
 
 
index b65b8d2..65e2112 100644 (file)
@@ -214,7 +214,7 @@ int CV_SubdivTest::validate_test_results( int /*test_case_idx*/ )
     double xrange = img_size.width*(1 - FLT_EPSILON);
     double yrange = img_size.height*(1 - FLT_EPSILON);
     
-    subdiv = subdiv = cvCreateSubdivDelaunay2D(
+    subdiv = cvCreateSubdivDelaunay2D(
         cvRect( 0, 0, img_size.width, img_size.height ), storage );
     
     CvSeq* seq = cvCreateSeq( 0, sizeof(*seq), sizeof(CvPoint2D32f), storage );
index b9b83a6..95d361a 100644 (file)
@@ -715,8 +715,6 @@ cvContourFromContourTree( const CvContourTree*  tree,
     criteria = cvCheckTermCriteria( criteria, 0., 100 );
 
     lpt = tree->total;
-    ptr_buf = NULL;
-    level_buf = NULL;
     i_buf = 0;
     cur_level = 0;
     log_iter = (char) (criteria.type == CV_TERMCRIT_ITER ||
index dea8015..0470e83 100644 (file)
@@ -150,7 +150,7 @@ static void translate_error_to_exception(void)
   cvSetErrStatus(0);
 }
 
-#define ERRCHK do { if (cvGetErrStatus() != 0) { translate_error_to_exception(); return NULL; } } while (0)
+#define ERRCHK do { if (cvGetErrStatus() != 0) { translate_error_to_exception(); return 0; } } while (0)
 #define ERRWRAPN(F, N) \
     do { \
         try \
@@ -3355,7 +3355,7 @@ static PyObject *pycvReshapeMatND(PyObject *self, PyObject *args)
   CvMatND *cva;
   if (!convert_to_CvMatND(o, &cva, "src"))
     return NULL;
-  ints dims;
+  ints dims={0,0};
   if (new_dims != NULL) {
     if (!convert_to_ints(new_dims, &dims, "new_dims"))
       return NULL;
index 771a5b2..dde0ee5 100644 (file)
@@ -161,7 +161,7 @@ simple_argtype_mapping = {
     "int": ("int", "i", "0"),
     "float": ("float", "f", "0.f"),
     "double": ("double", "d", "0"),
-    "c_string": ("char*", "s", '""')
+    "c_string": ("char*", "s", '(char*)""')
 }
 
 class ClassProp(object):