From 22970b827055de32d07b94fa8d1ac039a70103ec Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 14 Jun 2011 12:03:34 +0000 Subject: [PATCH] fixed multiple GCC warnings on Ubuntu 11.04 --- 3rdparty/libjasper/jas_icc.c | 18 ++++----- 3rdparty/libjasper/jas_image.c | 2 +- 3rdparty/libjasper/jas_seq.c | 8 ++-- 3rdparty/libjasper/jp2_cod.c | 6 +-- 3rdparty/libjasper/jpc_cs.c | 36 ++++++++--------- 3rdparty/libjasper/jpc_dec.c | 20 +++++----- 3rdparty/libjasper/jpc_mqenc.c | 2 +- 3rdparty/libtiff/tif_dirread.c | 2 +- 3rdparty/libtiff/tif_unix.c | 3 +- modules/core/include/opencv2/core/operations.hpp | 9 ++++- modules/core/src/mathfuncs.cpp | 3 +- modules/core/src/rand.cpp | 2 +- modules/core/src/stat.cpp | 51 +++++++++++++++--------- modules/highgui/src/cap_dc1394_v2.cpp | 9 +++-- modules/imgproc/src/accum.cpp | 16 ++------ modules/imgproc/src/inpaint.cpp | 2 +- modules/imgproc/src/linefit.cpp | 4 +- modules/imgproc/test/test_convhull.cpp | 6 ++- modules/imgproc/test/test_subdivisions.cpp | 2 +- modules/legacy/src/contourtree.cpp | 2 - modules/python/src1/cv.cpp | 4 +- modules/python/src2/gen2.py | 2 +- 22 files changed, 111 insertions(+), 98 deletions(-) diff --git a/3rdparty/libjasper/jas_icc.c b/3rdparty/libjasper/jas_icc.c index e5a0a2e..13f2864 100644 --- a/3rdparty/libjasper/jas_icc.c +++ b/3rdparty/libjasper/jas_icc.c @@ -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); } /******************************************************************************\ diff --git a/3rdparty/libjasper/jas_image.c b/3rdparty/libjasper/jas_image.c index e094bde..5b188b9 100644 --- a/3rdparty/libjasper/jas_image.c +++ b/3rdparty/libjasper/jas_image.c @@ -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); diff --git a/3rdparty/libjasper/jas_seq.c b/3rdparty/libjasper/jas_seq.c index bb9d1fb..ecdcbdf 100644 --- a/3rdparty/libjasper/jas_seq.c +++ b/3rdparty/libjasper/jas_seq.c @@ -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) { diff --git a/3rdparty/libjasper/jp2_cod.c b/3rdparty/libjasper/jp2_cod.c index 3610023..f900062 100644 --- a/3rdparty/libjasper/jp2_cod.c +++ b/3rdparty/libjasper/jp2_cod.c @@ -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]); } } } diff --git a/3rdparty/libjasper/jpc_cs.c b/3rdparty/libjasper/jpc_cs.c index dde0835..a7683af 100644 --- a/3rdparty/libjasper/jpc_cs.c +++ b/3rdparty/libjasper/jpc_cs.c @@ -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])) { diff --git a/3rdparty/libjasper/jpc_dec.c b/3rdparty/libjasper/jpc_dec.c index 3332deb..368813e 100644 --- a/3rdparty/libjasper/jpc_dec.c +++ b/3rdparty/libjasper/jpc_dec.c @@ -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))); } } } diff --git a/3rdparty/libjasper/jpc_mqenc.c b/3rdparty/libjasper/jpc_mqenc.c index 7a3aa36..5b55ced 100644 --- a/3rdparty/libjasper/jpc_mqenc.c +++ b/3rdparty/libjasper/jpc_mqenc.c @@ -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); diff --git a/3rdparty/libtiff/tif_dirread.c b/3rdparty/libtiff/tif_dirread.c index 907b531..0fb205b 100644 --- a/3rdparty/libtiff/tif_dirread.c +++ b/3rdparty/libtiff/tif_dirread.c @@ -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]); } diff --git a/3rdparty/libtiff/tif_unix.c b/3rdparty/libtiff/tif_unix.c index 548f542..4767b58 100644 --- a/3rdparty/libtiff/tif_unix.c +++ b/3rdparty/libtiff/tif_unix.c @@ -36,9 +36,10 @@ #include #include +#include #include -#ifdef HAVE_UNISTD_H +#if defined HAVE_UNISTD_H || defined __linux__ # include #endif diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 6c5dac2..e98dd0e 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -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) { diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index 4e9a744..83970fa 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -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(); diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index fad9ae2..7ee7f69 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -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 ) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index fb75714..1e30104 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -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; } diff --git a/modules/highgui/src/cap_dc1394_v2.cpp b/modules/highgui/src/cap_dc1394_v2.cpp index b41b82f..a6b9d8d 100644 --- a/modules/highgui/src/cap_dc1394_v2.cpp +++ b/modules/highgui/src/cap_dc1394_v2.cpp @@ -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)) diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index cb2276e..a099fcb 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -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; diff --git a/modules/imgproc/src/inpaint.cpp b/modules/imgproc/src/inpaint.cpp index f78e737..2ca3170 100644 --- a/modules/imgproc/src/inpaint.cpp +++ b/modules/imgproc/src/inpaint.cpp @@ -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; diff --git a/modules/imgproc/src/linefit.cpp b/modules/imgproc/src/linefit.cpp index 2526858..1d237cb 100644 --- a/modules/imgproc/src/linefit.cpp +++ b/modules/imgproc/src/linefit.cpp @@ -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: diff --git a/modules/imgproc/test/test_convhull.cpp b/modules/imgproc/test/test_convhull.cpp index a4b61f5..1791789 100644 --- a/modules/imgproc/test/test_convhull.cpp +++ b/modules/imgproc/test/test_convhull.cpp @@ -797,7 +797,11 @@ void CV_MinCircleTest::run_func() if(!test_cpp) cvMinEnclosingCircle( points, ¢er, &radius ); else - cv::minEnclosingCircle(cv::cvarrToMat(points), (cv::Point2f&)center, radius); + { + cv::Point2f tmpcenter; + cv::minEnclosingCircle(cv::cvarrToMat(points), tmpcenter, radius); + center = tmpcenter; + } } diff --git a/modules/imgproc/test/test_subdivisions.cpp b/modules/imgproc/test/test_subdivisions.cpp index b65b8d2..65e2112 100644 --- a/modules/imgproc/test/test_subdivisions.cpp +++ b/modules/imgproc/test/test_subdivisions.cpp @@ -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 ); diff --git a/modules/legacy/src/contourtree.cpp b/modules/legacy/src/contourtree.cpp index b9b83a6..95d361a 100644 --- a/modules/legacy/src/contourtree.cpp +++ b/modules/legacy/src/contourtree.cpp @@ -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 || diff --git a/modules/python/src1/cv.cpp b/modules/python/src1/cv.cpp index dea8015..0470e83 100644 --- a/modules/python/src1/cv.cpp +++ b/modules/python/src1/cv.cpp @@ -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; diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index 771a5b2..dde0ee5 100644 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -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): -- 2.7.4