提交 0bd68a70 编写于 作者: V Vadim Pisarevsky

fixed #2297, #2300; fixed several warnings

上级 95d54196
......@@ -404,7 +404,7 @@ inline bool Mat::empty() const { return data == 0 || total() == 0; }
inline size_t Mat::total() const
{
if( dims <= 2 )
return rows*cols;
return (size_t)rows*cols;
size_t p = 1;
for( int i = 0; i < dims; i++ )
p *= size[i];
......
......@@ -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>
{
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);
if( d == 0 )
......@@ -1244,7 +1244,7 @@ template<> inline Vec<double, 4> Vec<double, 4>::conj() const
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");
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];
#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] +
(_Tw)ptr1[i+2]*ptr2[i+2] + (_Tw)ptr1[i+3]*ptr2[i+3];
#endif
......@@ -2500,7 +2501,7 @@ inline RNG::operator double()
unsigned t = next();
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 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
{
int t = type();
return t == MAP ? ((CvSet*)node->data.map)->active_count :
t == SEQ ? node->data.seq->total : (size_t)!isNone();
return t == MAP ? (size_t)((CvSet*)node->data.map)->active_count :
t == SEQ ? (size_t)node->data.seq->total : (size_t)!isNone();
}
inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; }
......
......@@ -861,7 +861,7 @@ cvCreateData( CvArr* arr )
if( CV_IS_MAT_CONT( mat->type ))
{
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
{
......
......@@ -7,7 +7,8 @@ using namespace std;
using namespace cv;
namespace {
void helpParser()
#if 0
static void helpParser()
{
printf("\nThe CommandLineParser class is designed for command line arguments parsing\n"
"Keys map: \n"
......@@ -50,6 +51,7 @@ void helpParser()
" It also works with 'unsigned int', 'double', and 'float' types \n"
);
}
#endif
vector<string> split_string(const string& str, const string& delimiters)
{
......
......@@ -113,13 +113,13 @@ namespace
const CvOpenGlFuncTab* g_glFuncTab = 0;
//#ifdef HAVE_CUDA
#if defined HAVE_CUDA || defined HAVE_OPENGL
const CvOpenGlFuncTab* glFuncTab()
{
static EmptyGlFuncTab empty;
return g_glFuncTab ? g_glFuncTab : &empty;
}
//#endif
#endif
}
CvOpenGlFuncTab::~CvOpenGlFuncTab()
......
......@@ -2793,7 +2793,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
fs->buffer_end = fs->buffer_start + buf_size;
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 );
if( !append || file_size == 0 )
{
......
......@@ -845,7 +845,7 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
cvtest::randUni( rng, elem_mat, cvScalarAll(0), cvScalarAll(255) );
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 )
{
cvSeqPushMulti( seq, elem, count, whence < 0 );
......@@ -866,8 +866,8 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
if( sseq->count > 0 )
{
// choose the random element among the added
pos = count > 0 ? cvtest::randInt(rng) % count + pos : MAX(pos-1,0);
elem2 = cvGetSeqElem( seq, pos );
pos = count > 0 ? (int)(cvtest::randInt(rng) % count + pos) : MAX(pos-1,0);
elem2 = cvGetSeqElem( seq, pos );
CV_TS_SEQ_CHECK_CONDITION( elem2 != 0, "multi push operation doesn't add elements" );
CV_TS_SEQ_CHECK_CONDITION( seq->total == sseq->count &&
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);
whence = op - 10;
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 )
{
......
......@@ -168,7 +168,7 @@ void Core_RandTest::run( int )
int sz = 0, dsz = 0, slice;
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);
tested_rng.fill(aslice, dist_type, A, B);
}
......
......@@ -260,8 +260,8 @@ private:
* @param k_nn the number of nearest neighbors
* @param checked_average used for debugging
*/
void getNeighbors(const ElementType* vec, bool do_radius, float radius, bool do_k, unsigned int k_nn,
float& checked_average)
void getNeighbors(const ElementType* vec, bool /*do_radius*/, float radius, bool do_k, unsigned int k_nn,
float& /*checked_average*/)
{
static std::vector<ScoreIndexPair> score_index_heap;
......
......@@ -62,7 +62,7 @@ struct FastNlMeansDenoisingInvoker {
void operator() (const BlockedRange& range) const;
void operator= (const FastNlMeansDenoisingInvoker& invoker) {
void operator= (const FastNlMeansDenoisingInvoker&) {
CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented");
}
......
......@@ -63,7 +63,7 @@ struct FastNlMeansMultiDenoisingInvoker {
void operator() (const BlockedRange& range) const;
void operator= (const FastNlMeansMultiDenoisingInvoker& invoker) {
void operator= (const FastNlMeansMultiDenoisingInvoker&) {
CV_Error(CV_StsNotImplemented, "Assigment operator is not implemented");
}
......
......@@ -5896,7 +5896,7 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
// part can be omitted.
//
// 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,
bool def_optional) {
// str and flag must not be NULL.
......@@ -7221,12 +7221,14 @@ void StackLowerThanAddress(const void* ptr, bool* result) {
*result = (&dummy < ptr);
}
#if GTEST_HAS_CLONE
static bool StackGrowsDown() {
int dummy;
bool result;
StackLowerThanAddress(&dummy, &result);
return result;
}
#endif
// 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册