Commit 70546425 authored by Simon Que's avatar Simon Que Committed by Alexander Alekhin

Merge pull request #11353 from eecsninja:3.4

* Fix CV_Asserts with negation of strings

{!"string"} causes some compilers to throw a warning.

The value of the string is not that important -- it's only for printing
the assertion message.

Replace these calls with:

  CV_Error(Error::StsError, "string")

to suppress the warning.

* remove unnecessary 'break' after CV_Error()
parent 2b4b9466
...@@ -445,7 +445,7 @@ void cv::Affine3<T>::rotation(const cv::Mat& data) ...@@ -445,7 +445,7 @@ void cv::Affine3<T>::rotation(const cv::Mat& data)
rotation(_rvec); rotation(_rvec);
} }
else else
CV_Assert(!"Input matrix can only be 3x3, 1x3 or 3x1"); CV_Error(Error::StsError, "Input matrix can only be 3x3, 1x3 or 3x1");
} }
template<typename T> inline template<typename T> inline
......
...@@ -638,7 +638,8 @@ private: ...@@ -638,7 +638,8 @@ private:
pack.func = to_binary<double>; pack.func = to_binary<double>;
break; break;
case 'r': case 'r':
default: { CV_Assert(!"type not support"); break; } default:
CV_Error(cv::Error::StsError, "type is not supported");
}; };
offset = static_cast<size_t>(cvAlign(static_cast<int>(offset), static_cast<int>(size))); offset = static_cast<size_t>(cvAlign(static_cast<int>(offset), static_cast<int>(size)));
...@@ -797,7 +798,8 @@ private: ...@@ -797,7 +798,8 @@ private:
pack.func = binary_to<double>; pack.func = binary_to<double>;
break; break;
case 'r': case 'r':
default: { CV_Assert(!"type not support"); break; } default:
CV_Error(cv::Error::StsError, "type is not supported");
}; // need a better way for outputting error. }; // need a better way for outputting error.
offset = static_cast<size_t>(cvAlign(static_cast<int>(offset), static_cast<int>(size))); offset = static_cast<size_t>(cvAlign(static_cast<int>(offset), static_cast<int>(size)));
...@@ -815,7 +817,8 @@ private: ...@@ -815,7 +817,8 @@ private:
case 'f': { pack.cv_type = CV_32F; break; } case 'f': { pack.cv_type = CV_32F; break; }
case 'd': { pack.cv_type = CV_64F; break; } case 'd': { pack.cv_type = CV_64F; break; }
case 'r': case 'r':
default: { CV_Assert(!"type is not support"); break; } default:
CV_Error(cv::Error::StsError, "type is not supported");
} // need a better way for outputting error. } // need a better way for outputting error.
binary_to_funcs.push_back(pack); binary_to_funcs.push_back(pack);
......
...@@ -1614,7 +1614,8 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc, ...@@ -1614,7 +1614,8 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
caps = gst_caps_fixate(caps); caps = gst_caps_fixate(caps);
#endif #endif
#else #else
CV_Assert(!"Gstreamer 0.10.29 or newer is required for grayscale input"); CV_Error(Error::StsError,
"Gstreamer 0.10.29 or newer is required for grayscale input");
#endif #endif
} }
......
...@@ -63,8 +63,7 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type) ...@@ -63,8 +63,7 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type)
switch (type) { switch (type) {
case LOAD_AUTO: case LOAD_AUTO:
{ {
CV_Assert(!"cv::viz::Mesh::LOAD_AUTO: Not implemented yet"); CV_Error(Error::StsError, "cv::viz::Mesh::LOAD_AUTO: Not implemented yet");
break;
} }
case LOAD_PLY: case LOAD_PLY:
{ {
...@@ -83,8 +82,7 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type) ...@@ -83,8 +82,7 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type)
break; break;
} }
default: default:
CV_Assert(!"cv::viz::Mesh::load: Unknown file type"); CV_Error(Error::StsError, "cv::viz::Mesh::load: Unknown file type");
break;
} }
vtkSmartPointer<vtkPolyData> polydata = reader->GetOutput(); vtkSmartPointer<vtkPolyData> polydata = reader->GetOutput();
......
...@@ -194,7 +194,7 @@ void cv::viz::writeCloud(const String& file, InputArray cloud, InputArray colors ...@@ -194,7 +194,7 @@ void cv::viz::writeCloud(const String& file, InputArray cloud, InputArray colors
vtkOBJWriter::SafeDownCast(writer)->SetFileName(file.c_str()); vtkOBJWriter::SafeDownCast(writer)->SetFileName(file.c_str());
} }
else else
CV_Assert(!"Unsupported format"); CV_Error(Error::StsError, "Unsupported format");
writer->SetInputConnection(source->GetOutputPort()); writer->SetInputConnection(source->GetOutputPort());
writer->Write(); writer->Write();
...@@ -228,7 +228,7 @@ cv::Mat cv::viz::readCloud(const String& file, OutputArray colors, OutputArray n ...@@ -228,7 +228,7 @@ cv::Mat cv::viz::readCloud(const String& file, OutputArray colors, OutputArray n
vtkSTLReader::SafeDownCast(reader)->SetFileName(file.c_str()); vtkSTLReader::SafeDownCast(reader)->SetFileName(file.c_str());
} }
else else
CV_Assert(!"Unsupported format"); CV_Error(Error::StsError, "Unsupported format");
cv::Mat cloud; cv::Mat cloud;
...@@ -325,7 +325,7 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int ...@@ -325,7 +325,7 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int
return; return;
} }
CV_Assert(!"Unsupported array kind"); CV_Error(Error::StsError, "Unsupported array kind");
} }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -128,7 +128,7 @@ int cv::viz::vtkCloudMatSource::SetColorCloudNormals(InputArray _cloud, InputArr ...@@ -128,7 +128,7 @@ int cv::viz::vtkCloudMatSource::SetColorCloudNormals(InputArray _cloud, InputArr
else if (n.depth() == CV_64F && c.depth() == CV_64F) else if (n.depth() == CV_64F && c.depth() == CV_64F)
filterNanNormalsCopy<double, double>(n, c, total); filterNanNormalsCopy<double, double>(n, c, total);
else else
CV_Assert(!"Unsupported normals/cloud type"); CV_Error(Error::StsError, "Unsupported normals/cloud type");
return total; return total;
} }
...@@ -155,7 +155,7 @@ int cv::viz::vtkCloudMatSource::SetColorCloudNormalsTCoords(InputArray _cloud, I ...@@ -155,7 +155,7 @@ int cv::viz::vtkCloudMatSource::SetColorCloudNormalsTCoords(InputArray _cloud, I
else if (tc.depth() == CV_64F && cl.depth() == CV_64F) else if (tc.depth() == CV_64F && cl.depth() == CV_64F)
filterNanTCoordsCopy<double, double>(tc, cl, total); filterNanTCoordsCopy<double, double>(tc, cl, total);
else else
CV_Assert(!"Unsupported tcoords/cloud type"); CV_Error(Error::StsError, "Unsupported tcoords/cloud type");
return total; return total;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment