diff --git a/modules/core/include/opencv2/core/internal.hpp b/modules/core/include/opencv2/core/internal.hpp index 369921aff5..2fe56cd7d9 100644 --- a/modules/core/include/opencv2/core/internal.hpp +++ b/modules/core/include/opencv2/core/internal.hpp @@ -120,15 +120,15 @@ CV_INLINE IppiSize ippiSize(int width, int height) # else # define CV_SSSE3 0 # endif -# if defined __SSE4_1__ || _MSC_VER >= 1600 +# if defined __SSE4_1__ || (defined _MSC_VER && _MSC_VER >= 1600) # include # define CV_SSE4_1 1 # endif -# if defined __SSE4_2__ || _MSC_VER >= 1600 +# if defined __SSE4_2__ || (defined _MSC_VER && _MSC_VER >= 1600) # include # define CV_SSE4_2 1 # endif -# if defined __AVX__ || _MSC_VER >= 1600 +# if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600) # include # define CV_AVX 1 # endif @@ -779,4 +779,4 @@ CV_EXPORTS bool icvCheckGlError(const char* file, const int line, const char* fu #endif //__cplusplus -#endif // __OPENCV_CORE_INTERNAL_HPP__ \ No newline at end of file +#endif // __OPENCV_CORE_INTERNAL_HPP__ diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 3626a2a675..560ef54624 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -225,7 +225,7 @@ template <> int countNonZero_ (const uchar* src, int len) { int i=0, nz = 0; - #if CV_SSE4_2 + #if (defined CV_SSE4_2 && CV_SSE4_2) if(USE_SSE4_2)//5x-6x { __m128i pattern = _mm_setzero_si128 (); @@ -2012,4 +2012,4 @@ cvNorm( const void* imgA, const void* imgB, int normType, const void* maskarr ) cv::extractImageCOI(imgB, b); return !maskarr ? cv::norm(a, b, normType) : cv::norm(a, b, normType, mask); -} \ No newline at end of file +} diff --git a/modules/highgui/src/cap_openni.cpp b/modules/highgui/src/cap_openni.cpp index b440e0a02e..75aed56dce 100644 --- a/modules/highgui/src/cap_openni.cpp +++ b/modules/highgui/src/cap_openni.cpp @@ -44,7 +44,7 @@ #ifdef HAVE_OPENNI -#if TBB_INTERFACE_VERSION < 5000 +#if defined TBB_INTERFACE_VERSION && TBB_INTERFACE_VERSION < 5000 # undef HAVE_TBB #endif @@ -575,7 +575,12 @@ CvCapture_OpenNI::CvCapture_OpenNI( int index ) // Chose device according to index xn::NodeInfoList::Iterator it = devicesList.Begin(); - for( int i = 0; i < index; ++i ) it++; + for( int i = 0; i < index && it!=devicesList.End(); ++i ) it++; + if ( it == devicesList.End() ) + { + std::cerr << "CvCapture_OpenNI::CvCapture_OpenNI : Failed device with index " << index << std::endl; + return; + } xn::NodeInfo deviceNode = *it; status = context.CreateProductionTree( deviceNode, productionNode );