Commit f1b31421 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'cpp_check' into 'master'

Cpp check

See merge request !221
parents 6e14f292 e7a34cf8
Pipeline #10645 passed with stages
in 51 minutes and 57 seconds
...@@ -20,7 +20,7 @@ echo -e "${NC}" ...@@ -20,7 +20,7 @@ echo -e "${NC}"
echo "Please Wait ..." echo "Please Wait ..."
# Run cppcheck and output into file # Run cppcheck and output into file
cppcheck --enable=all . -I src -i Doc/ --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log cppcheck --enable=all . -I src -i Doc/ -i src/Unittests --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log
COUNT=$(wc -l < cppcheck.log ) COUNT=$(wc -l < cppcheck.log )
...@@ -30,7 +30,7 @@ echo "CPPCHECK Summary" ...@@ -30,7 +30,7 @@ echo "CPPCHECK Summary"
echo "==============================================================================" echo "=============================================================================="
echo -e "${NC}" echo -e "${NC}"
MAX_COUNT=0 MAX_COUNT=27
if [ $COUNT -gt $MAX_COUNT ]; then if [ $COUNT -gt $MAX_COUNT ]; then
echo -e ${WARNING} echo -e ${WARNING}
......
...@@ -19,7 +19,7 @@ if ( WIN32 ) ...@@ -19,7 +19,7 @@ if ( WIN32 )
list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
endif() endif()
endif() endif()
...@@ -45,10 +45,12 @@ endif( WIN32 ) ...@@ -45,10 +45,12 @@ endif( WIN32 )
if (UNIX) if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS ) set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS ) set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS ) set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS ) set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
...@@ -58,19 +60,13 @@ if (UNIX) ...@@ -58,19 +60,13 @@ if (UNIX)
################################################################################ ################################################################################
# add our standard flags for Template inclusion # add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
################################################################################ ################################################################################
# OS Defines # OS Defines
################################################################################ ################################################################################
if (APPLE) if (APPLE)
add_definitions( -DARCH_DARWIN ) add_definitions( -DARCH_DARWIN )
endif() endif()
...@@ -91,7 +87,7 @@ if (UNIX) ...@@ -91,7 +87,7 @@ if (UNIX)
################################################################################ ################################################################################
# Warnings # Warnings
################################################################################ ################################################################################
# Add the standard compiler warnings # Add the standard compiler warnings
if ( NOT COMPILER_WARNINGS ) if ( NOT COMPILER_WARNINGS )
...@@ -104,18 +100,27 @@ if (UNIX) ...@@ -104,18 +100,27 @@ if (UNIX)
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ELSE () ELSE ()
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ENDIF() ENDIF()
endif ( NOT COMPILER_WARNINGS ) endif ( NOT COMPILER_WARNINGS )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_CXX_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_C_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} ) if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
# enable later:
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif()
################################################################################ ################################################################################
# STL Vector checks # STL Vector checks
################################################################################ ################################################################################
...@@ -147,43 +152,49 @@ if (UNIX) ...@@ -147,43 +152,49 @@ if (UNIX)
################################################################################ ################################################################################
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ") set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ") set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ") set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
......
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
public: // inherited public: // inherited
bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
{ {
bool rc; bool rc;
...@@ -170,7 +170,7 @@ protected slots: ...@@ -170,7 +170,7 @@ protected slots:
protected: protected:
virtual void keyPressEvent(QKeyEvent* _event); virtual void keyPressEvent(QKeyEvent* _event) override;
private: private:
......
...@@ -216,7 +216,7 @@ decimate(const std::string &_ifname, ...@@ -216,7 +216,7 @@ decimate(const std::string &_ifname,
using namespace std; using namespace std;
Mesh mesh; Mesh mesh;
OpenMesh::IO::Options opt; OpenMesh::IO::Options readopt;
OpenMesh::Utils::Timer timer; OpenMesh::Utils::Timer timer;
// ---------------------------------------- read source mesh // ---------------------------------------- read source mesh
...@@ -227,7 +227,7 @@ decimate(const std::string &_ifname, ...@@ -227,7 +227,7 @@ decimate(const std::string &_ifname,
if (gverbose) if (gverbose)
clog << _ifname << endl; clog << _ifname << endl;
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) ) if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) )
{ {
cerr << " ERROR: read failed!" << endl; cerr << " ERROR: read failed!" << endl;
return rc; return rc;
...@@ -238,7 +238,7 @@ decimate(const std::string &_ifname, ...@@ -238,7 +238,7 @@ decimate(const std::string &_ifname,
{ {
// ---- 0 - For module NormalFlipping one needs face normals // ---- 0 - For module NormalFlipping one needs face normals
if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) ) if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) )
{ {
if ( !mesh.has_face_normals() ) if ( !mesh.has_face_normals() )
mesh.request_face_normals(); mesh.request_face_normals();
...@@ -420,11 +420,11 @@ decimate(const std::string &_ifname, ...@@ -420,11 +420,11 @@ decimate(const std::string &_ifname,
ofname.insert(++pos, n ); ofname.insert(++pos, n );
} }
OpenMesh::IO::Options opt; OpenMesh::IO::Options writeopt;
//opt += OpenMesh::IO::Options::Binary; //opt += OpenMesh::IO::Options::Binary;
if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) ) if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) )
{ {
std::cerr << " Cannot write decimated mesh to file '" std::cerr << " Cannot write decimated mesh to file '"
<< ofname << "'\n"; << ofname << "'\n";
......
...@@ -94,8 +94,12 @@ public: ...@@ -94,8 +94,12 @@ public:
public: public:
/// default constructor /// default constructor
ProgViewerWidget(QWidget* _parent=0) explicit ProgViewerWidget(QWidget* _parent=0)
: MeshViewerWidget(_parent) : MeshViewerWidget(_parent),
n_base_vertices_(0),
n_base_faces_(0),
n_detail_vertices_(0),
n_max_vertices_(0)
{ {
timer_ = new QTimer(this); timer_ = new QTimer(this);
...@@ -133,7 +137,7 @@ private: ...@@ -133,7 +137,7 @@ private:
/// coarsen mesh down to _n vertices /// coarsen mesh down to _n vertices
void coarsen(unsigned int _n); void coarsen(unsigned int _n);
virtual void keyPressEvent(QKeyEvent* _event); virtual void keyPressEvent(QKeyEvent* _event) override;
// mesh data // mesh data
bool animateRefinement_; bool animateRefinement_;
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
public: public:
/// default constructor /// default constructor
MeshViewerWidgetT(QWidget* _parent=0) explicit MeshViewerWidgetT(QWidget* _parent=0)
: QGLViewerWidget(_parent), : QGLViewerWidget(_parent),
f_strips_(false), f_strips_(false),
tex_id_(0), tex_id_(0),
...@@ -85,7 +85,8 @@ public: ...@@ -85,7 +85,8 @@ public:
strips_(mesh_), strips_(mesh_),
use_color_(true), use_color_(true),
show_vnormals_(false), show_vnormals_(false),
show_fnormals_(false) show_fnormals_(false),
normal_scale_(1.0)
{ {
add_draw_mode("Points"); add_draw_mode("Points");
add_draw_mode("Hidden-Line"); add_draw_mode("Hidden-Line");
...@@ -116,7 +117,7 @@ public: ...@@ -116,7 +117,7 @@ public:
protected: protected:
/// inherited drawing method /// inherited drawing method
virtual void draw_scene(const std::string& _draw_mode); virtual void draw_scene(const std::string& _draw_mode) override;
protected: protected:
...@@ -170,7 +171,7 @@ protected: // Strip support ...@@ -170,7 +171,7 @@ protected: // Strip support
protected: // inherited protected: // inherited
virtual void keyPressEvent( QKeyEvent* _event); virtual void keyPressEvent( QKeyEvent* _event) override;
protected: protected:
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
typedef QGLWidget Super; typedef QGLWidget Super;
// Default constructor. // Default constructor.
QGLViewerWidget( QWidget* _parent=0 ); explicit QGLViewerWidget( QWidget* _parent=0 );
// //
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 ); QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
typedef MeshViewerWidgetT<Mesh> Base; typedef MeshViewerWidgetT<Mesh> Base;
/// default constructor /// default constructor
MeshViewerWidget(QWidget* _parent=0) explicit MeshViewerWidget(QWidget* _parent=0)
: Base(_parent) : Base(_parent)
{} {}
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
~MeshViewerWidget() {} ~MeshViewerWidget() {}
/// open mesh /// open mesh
inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
{ {
if ( Base::open_mesh( _filename, _opt ) ) if ( Base::open_mesh( _filename, _opt ) )
{ {
......
...@@ -78,7 +78,14 @@ namespace OpenMesh { ...@@ -78,7 +78,14 @@ namespace OpenMesh {
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name) VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name)
: MeshViewerWidget(_parent) : MeshViewerWidget(_parent),
kappa_square_(0.0),
adaptive_mode_(false),
n_base_vertices_(0),
n_base_edges_(0),
n_base_faces_(0),
n_details_(0)
{ {
adaptive_mode_ = true; adaptive_mode_ = true;
} }
......
...@@ -107,7 +107,7 @@ public: ...@@ -107,7 +107,7 @@ public:
public: // inherited public: // inherited
void initialize(void) void initialize(void) override
{ {
BaseModQ::initialize(); BaseModQ::initialize();
n_vertices_ = BaseModQ::mesh().n_vertices(); n_vertices_ = BaseModQ::mesh().n_vertices();
......
...@@ -89,17 +89,17 @@ protected: ...@@ -89,17 +89,17 @@ protected:
inline static Scalar compute_limit_weight(uint _valence) inline static Scalar compute_limit_weight(uint _valence)
{ {
double proj_weight = compute_proj_weight(_valence); double proj_weight_value = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0)); double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
return (Scalar)weight; return (Scalar)weight;
} }
inline static Scalar compute_step_weight(uint _valence) inline static Scalar compute_step_weight(uint _valence)
{ {
double proj_weight = compute_proj_weight(_valence); double proj_weight_value = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = proj_weight - (3.0/8.0); double weight = proj_weight_value - (3.0/8.0);
return (Scalar)weight; return (Scalar)weight;
} }
......
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
{} {}
template <class _Point> template <class _Point>
QuadricT(const _Point& _pt) explicit QuadricT(const _Point& _pt)
{ {
set_distance_to_point(_pt); set_distance_to_point(_pt);
} }
......
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
bool write(const std::string& _filename, bool write(const std::string& _filename,
BaseExporter& _be, BaseExporter& _be,
Options _opt=Options::Default, Options _opt=Options::Default,
std::streamsize _precision = 6); std::streamsize _precision = 6);
/** Write a mesh to open std::ostream _os. The source data structure is specified /** Write a mesh to open std::ostream _os. The source data structure is specified
by the given BaseExporter. The \c save method consecutively queries all by the given BaseExporter. The \c save method consecutively queries all
...@@ -159,7 +159,7 @@ public: ...@@ -159,7 +159,7 @@ public:
const std::string& _ext, const std::string& _ext,
BaseExporter& _be, BaseExporter& _be,
Options _opt=Options::Default, Options _opt=Options::Default,
std::streamsize _precision = 6); std::streamsize _precision = 6);
/// Returns true if the format is supported by one of the reader modules. /// Returns true if the format is supported by one of the reader modules.
......
...@@ -252,7 +252,7 @@ namespace OMFormat { ...@@ -252,7 +252,7 @@ namespace OMFormat {
PropertyName( ) { } PropertyName( ) { }
PropertyName( const std::string& _name ) { *this = _name; } explicit PropertyName( const std::string& _name ) { *this = _name; }
bool is_valid() const { return is_valid( size() ); } bool is_valid() const { return is_valid( size() ); }
......
...@@ -84,7 +84,7 @@ class ExporterT : public BaseExporter ...@@ -84,7 +84,7 @@ class ExporterT : public BaseExporter
public: public:
// Constructor // Constructor
ExporterT(const Mesh& _mesh) : mesh_(_mesh) {} explicit ExporterT(const Mesh& _mesh) : mesh_(_mesh) {}
// get vertex data // get vertex data
......
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
typedef std::vector<VertexHandle> VHandles; typedef std::vector<VertexHandle> VHandles;
ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {} explicit ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {}
virtual VertexHandle add_vertex(const Vec3f& _point) override virtual VertexHandle add_vertex(const Vec3f& _point) override
......
...@@ -135,13 +135,13 @@ read(const std::string& _filename, BaseImporter& _bi, Options& _opt) ...@@ -135,13 +135,13 @@ read(const std::string& _filename, BaseImporter& _bi, Options& _opt)
{ {
#if defined(WIN32) #if defined(WIN32)
std::string::size_type dot = _filename.find_last_of("\\/"); std::string::size_type dot_pos = _filename.find_last_of("\\/");
#else #else
std::string::size_type dot = _filename.rfind("/"); std::string::size_type dot_pos = _filename.rfind("/");
#endif #endif
path_ = (dot == std::string::npos) path_ = (dot_pos == std::string::npos)
? "./" ? "./"
: std::string(_filename.substr(0,dot+1)); : std::string(_filename.substr(0,dot_pos+1));
} }
bool result = read(in, _bi, _opt); bool result = read(in, _bi, _opt);
......
...@@ -87,16 +87,16 @@ public: ...@@ -87,16 +87,16 @@ public:
virtual ~_OBJReader_() { } virtual ~_OBJReader_() { }
std::string get_description() const { return "Alias/Wavefront"; } std::string get_description() const override { return "Alias/Wavefront"; }
std::string get_extensions() const { return "obj"; } std::string get_extensions() const override { return "obj"; }
bool read(const std::string& _filename, bool read(const std::string& _filename,
BaseImporter& _bi, BaseImporter& _bi,
Options& _opt); Options& _opt) override;
bool read(std::istream& _in, bool read(std::istream& _in,
BaseImporter& _bi, BaseImporter& _bi,
Options& _opt); Options& _opt) override;
private: private:
...@@ -105,7 +105,7 @@ private: ...@@ -105,7 +105,7 @@ private:
{ {
public: public:
Material() { cleanup(); } Material():Tr_(0),index_Kd_(0) { cleanup(); }
void cleanup() void cleanup()
{ {
...@@ -137,7 +137,7 @@ private: ...@@ -137,7 +137,7 @@ private:
void set_Tr( float t ) void set_Tr( float t )
{ Tr_=t; Tr_is_set_=true; } { Tr_=t; Tr_is_set_=true; }
void set_map_Kd( std::string _name, int _index_Kd ) void set_map_Kd( const std::string& _name, int _index_Kd )
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; }; { map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
const Vec3f& Kd( void ) const { return Kd_; } const Vec3f& Kd( void ) const { return Kd_; }
......
...@@ -118,17 +118,17 @@ public: ...@@ -118,17 +118,17 @@ public:
/// Destructor /// Destructor
virtual ~_OFFReader_() {}; virtual ~_OFFReader_() {};
std::string get_description() const { return "Object File Format"; } std::string get_description() const override { return "Object File Format"; }
std::string get_extensions() const { return "off"; } std::string get_extensions() const override { return "off"; }
std::string get_magic() const { return "OFF"; } std::string get_magic() const override { return "OFF"; }