fixed #2297, #2300; fixed several warnings

This commit is contained in:
Vadim Pisarevsky 2012-08-28 13:45:35 +04:00
parent 95d54196db
commit 0bd68a70f1
12 changed files with 27 additions and 22 deletions

View File

@ -404,7 +404,7 @@ inline bool Mat::empty() const { return data == 0 || total() == 0; }
inline size_t Mat::total() const inline size_t Mat::total() const
{ {
if( dims <= 2 ) if( dims <= 2 )
return rows*cols; return (size_t)rows*cols;
size_t p = 1; size_t p = 1;
for( int i = 0; i < dims; i++ ) for( int i = 0; i < dims; i++ )
p *= size[i]; p *= size[i];

View File

@ -866,7 +866,7 @@ template<typename _Tp, int m, int n> struct CV_EXPORTS Matx_FastSolveOp
template<typename _Tp> struct CV_EXPORTS Matx_FastSolveOp<_Tp, 2, 1> template<typename _Tp> struct CV_EXPORTS Matx_FastSolveOp<_Tp, 2, 1>
{ {
bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b, bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b,
Matx<_Tp, 2, 1>& x, int method) const Matx<_Tp, 2, 1>& x, int) const
{ {
_Tp d = determinant(a); _Tp d = determinant(a);
if( d == 0 ) if( d == 0 )
@ -1244,7 +1244,7 @@ template<> inline Vec<double, 4> Vec<double, 4>::conj() const
return conjugate(*this); return conjugate(*this);
} }
template<typename _Tp, int cn> inline Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>& v) const template<typename _Tp, int cn> inline Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const
{ {
CV_Error(CV_StsError, "for arbitrary-size vector there is no cross-product defined"); CV_Error(CV_StsError, "for arbitrary-size vector there is no cross-product defined");
return Vec<_Tp, cn>(); return Vec<_Tp, cn>();
@ -2466,7 +2466,8 @@ dot(const Vector<_Tp>& v1, const Vector<_Tp>& v2)
{ {
const _Tp *ptr1 = &v1[0], *ptr2 = &v2[0]; const _Tp *ptr1 = &v1[0], *ptr2 = &v2[0];
#if CV_ENABLE_UNROLLED #if CV_ENABLE_UNROLLED
for(; i <= n - 4; i += 4 ) const size_t n2 = (n > 4) ? n : 4;
for(; i <= n2 - 4; i += 4 )
s += (_Tw)ptr1[i]*ptr2[i] + (_Tw)ptr1[i+1]*ptr2[i+1] + s += (_Tw)ptr1[i]*ptr2[i] + (_Tw)ptr1[i+1]*ptr2[i+1] +
(_Tw)ptr1[i+2]*ptr2[i+2] + (_Tw)ptr1[i+3]*ptr2[i+3]; (_Tw)ptr1[i+2]*ptr2[i+2] + (_Tw)ptr1[i+3]*ptr2[i+3];
#endif #endif
@ -2500,7 +2501,7 @@ inline RNG::operator double()
unsigned t = next(); unsigned t = next();
return (((uint64)t << 32) | next())*5.4210108624275221700372640043497e-20; return (((uint64)t << 32) | next())*5.4210108624275221700372640043497e-20;
} }
inline int RNG::uniform(int a, int b) { return a == b ? a : next()%(b - a) + a; } inline int RNG::uniform(int a, int b) { return a == b ? a : (int)(next()%(b - a) + a); }
inline float RNG::uniform(float a, float b) { return ((float)*this)*(b - a) + a; } inline float RNG::uniform(float a, float b) { return ((float)*this)*(b - a) + a; }
inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; } inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; }
@ -2937,8 +2938,8 @@ inline bool FileNode::isNamed() const { return !node ? false : (node->tag & NAME
inline size_t FileNode::size() const inline size_t FileNode::size() const
{ {
int t = type(); int t = type();
return t == MAP ? ((CvSet*)node->data.map)->active_count : return t == MAP ? (size_t)((CvSet*)node->data.map)->active_count :
t == SEQ ? node->data.seq->total : (size_t)!isNone(); t == SEQ ? (size_t)node->data.seq->total : (size_t)!isNone();
} }
inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; } inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; }

View File

@ -861,7 +861,7 @@ cvCreateData( CvArr* arr )
if( CV_IS_MAT_CONT( mat->type )) if( CV_IS_MAT_CONT( mat->type ))
{ {
total_size = (size_t)mat->dim[0].size*(mat->dim[0].step != 0 ? total_size = (size_t)mat->dim[0].size*(mat->dim[0].step != 0 ?
mat->dim[0].step : total_size); (size_t)mat->dim[0].step : total_size);
} }
else else
{ {

View File

@ -7,7 +7,8 @@ using namespace std;
using namespace cv; using namespace cv;
namespace { namespace {
void helpParser() #if 0
static void helpParser()
{ {
printf("\nThe CommandLineParser class is designed for command line arguments parsing\n" printf("\nThe CommandLineParser class is designed for command line arguments parsing\n"
"Keys map: \n" "Keys map: \n"
@ -50,6 +51,7 @@ void helpParser()
" It also works with 'unsigned int', 'double', and 'float' types \n" " It also works with 'unsigned int', 'double', and 'float' types \n"
); );
} }
#endif
vector<string> split_string(const string& str, const string& delimiters) vector<string> split_string(const string& str, const string& delimiters)
{ {

View File

@ -113,13 +113,13 @@ namespace
const CvOpenGlFuncTab* g_glFuncTab = 0; const CvOpenGlFuncTab* g_glFuncTab = 0;
//#ifdef HAVE_CUDA #if defined HAVE_CUDA || defined HAVE_OPENGL
const CvOpenGlFuncTab* glFuncTab() const CvOpenGlFuncTab* glFuncTab()
{ {
static EmptyGlFuncTab empty; static EmptyGlFuncTab empty;
return g_glFuncTab ? g_glFuncTab : &empty; return g_glFuncTab ? g_glFuncTab : &empty;
} }
//#endif #endif
} }
CvOpenGlFuncTab::~CvOpenGlFuncTab() CvOpenGlFuncTab::~CvOpenGlFuncTab()

View File

@ -2793,7 +2793,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
fs->buffer_end = fs->buffer_start + buf_size; fs->buffer_end = fs->buffer_start + buf_size;
if( fs->fmt == CV_STORAGE_FORMAT_XML ) if( fs->fmt == CV_STORAGE_FORMAT_XML )
{ {
size_t file_size = fs->file ? ftell( fs->file ) : (size_t)0; size_t file_size = fs->file ? (size_t)ftell( fs->file ) : (size_t)0;
fs->strstorage = cvCreateChildMemStorage( fs->memstorage ); fs->strstorage = cvCreateChildMemStorage( fs->memstorage );
if( !append || file_size == 0 ) if( !append || file_size == 0 )
{ {

View File

@ -845,7 +845,7 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
cvtest::randUni( rng, elem_mat, cvScalarAll(0), cvScalarAll(255) ); cvtest::randUni( rng, elem_mat, cvScalarAll(0), cvScalarAll(255) );
whence = op - 7; whence = op - 7;
pos = whence < 0 ? 0 : whence > 0 ? sseq->count : cvtest::randInt(rng) % (sseq->count+1); pos = whence < 0 ? 0 : whence > 0 ? sseq->count : (int)(cvtest::randInt(rng) % (sseq->count+1));
if( whence != 0 ) if( whence != 0 )
{ {
cvSeqPushMulti( seq, elem, count, whence < 0 ); cvSeqPushMulti( seq, elem, count, whence < 0 );
@ -866,8 +866,8 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
if( sseq->count > 0 ) if( sseq->count > 0 )
{ {
// choose the random element among the added // choose the random element among the added
pos = count > 0 ? cvtest::randInt(rng) % count + pos : MAX(pos-1,0); pos = count > 0 ? (int)(cvtest::randInt(rng) % count + pos) : MAX(pos-1,0);
elem2 = cvGetSeqElem( seq, pos ); elem2 = cvGetSeqElem( seq, pos );
CV_TS_SEQ_CHECK_CONDITION( elem2 != 0, "multi push operation doesn't add elements" ); CV_TS_SEQ_CHECK_CONDITION( elem2 != 0, "multi push operation doesn't add elements" );
CV_TS_SEQ_CHECK_CONDITION( seq->total == sseq->count && CV_TS_SEQ_CHECK_CONDITION( seq->total == sseq->count &&
memcmp( elem2, cvTsSimpleSeqElem(sseq,pos), elem_size) == 0, memcmp( elem2, cvTsSimpleSeqElem(sseq,pos), elem_size) == 0,
@ -889,7 +889,7 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
count = cvtest::randInt(rng) % (sseq->count+1); count = cvtest::randInt(rng) % (sseq->count+1);
whence = op - 10; whence = op - 10;
pos = whence < 0 ? 0 : whence > 0 ? sseq->count - count : pos = whence < 0 ? 0 : whence > 0 ? sseq->count - count :
cvtest::randInt(rng) % (sseq->count - count + 1); (int)(cvtest::randInt(rng) % (sseq->count - count + 1));
if( whence != 0 ) if( whence != 0 )
{ {

View File

@ -168,7 +168,7 @@ void Core_RandTest::run( int )
int sz = 0, dsz = 0, slice; int sz = 0, dsz = 0, slice;
for( slice = 0; slice < maxSlice; slice++, sz += dsz ) for( slice = 0; slice < maxSlice; slice++, sz += dsz )
{ {
dsz = slice+1 < maxSlice ? cvtest::randInt(rng) % (SZ - sz + 1) : SZ - sz; dsz = slice+1 < maxSlice ? (int)(cvtest::randInt(rng) % (SZ - sz + 1)) : SZ - sz;
Mat aslice = arr[k].colRange(sz, sz + dsz); Mat aslice = arr[k].colRange(sz, sz + dsz);
tested_rng.fill(aslice, dist_type, A, B); tested_rng.fill(aslice, dist_type, A, B);
} }

View File

@ -260,8 +260,8 @@ private:
* @param k_nn the number of nearest neighbors * @param k_nn the number of nearest neighbors
* @param checked_average used for debugging * @param checked_average used for debugging
*/ */
void getNeighbors(const ElementType* vec, bool do_radius, float radius, bool do_k, unsigned int k_nn, void getNeighbors(const ElementType* vec, bool /*do_radius*/, float radius, bool do_k, unsigned int k_nn,
float& checked_average) float& /*checked_average*/)
{ {
static std::vector<ScoreIndexPair> score_index_heap; static std::vector<ScoreIndexPair> score_index_heap;

View File

@ -62,7 +62,7 @@ struct FastNlMeansDenoisingInvoker {
void operator() (const BlockedRange& range) const; void operator() (const BlockedRange& range) const;
void operator= (const FastNlMeansDenoisingInvoker& invoker) { void operator= (const FastNlMeansDenoisingInvoker&) {
CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented"); CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented");
} }

View File

@ -63,7 +63,7 @@ struct FastNlMeansMultiDenoisingInvoker {
void operator() (const BlockedRange& range) const; void operator() (const BlockedRange& range) const;
void operator= (const FastNlMeansMultiDenoisingInvoker& invoker) { void operator= (const FastNlMeansMultiDenoisingInvoker&) {
CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented"); CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented");
} }

View File

@ -5896,7 +5896,7 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
// part can be omitted. // part can be omitted.
// //
// Returns the value of the flag, or NULL if the parsing failed. // Returns the value of the flag, or NULL if the parsing failed.
const char* ParseFlagValue(const char* str, static const char* ParseFlagValue(const char* str,
const char* flag, const char* flag,
bool def_optional) { bool def_optional) {
// str and flag must not be NULL. // str and flag must not be NULL.
@ -7221,12 +7221,14 @@ void StackLowerThanAddress(const void* ptr, bool* result) {
*result = (&dummy < ptr); *result = (&dummy < ptr);
} }
#if GTEST_HAS_CLONE
static bool StackGrowsDown() { static bool StackGrowsDown() {
int dummy; int dummy;
bool result; bool result;
StackLowerThanAddress(&dummy, &result); StackLowerThanAddress(&dummy, &result);
return result; return result;
} }
#endif
// Spawns a child process with the same executable as the current process in // Spawns a child process with the same executable as the current process in
// a thread-safe manner and instructs it to run the death test. The // a thread-safe manner and instructs it to run the death test. The