Commit 4afdd5ad authored by Jan Möbius's avatar Jan Möbius
Browse files

cppcheck

parent 8cffe1c3
......@@ -20,7 +20,7 @@ echo -e "${NC}"
echo "Please Wait ..."
# 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 )
......@@ -30,7 +30,7 @@ echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
MAX_COUNT=0
MAX_COUNT=100
if [ $COUNT -gt $MAX_COUNT ]; then
echo -e ${WARNING}
......
......@@ -72,7 +72,7 @@ public:
typedef MeshViewerWidgetT<Mesh> Base;
/// default constructor
MeshViewerWidget(QWidget* _parent=0)
explicit MeshViewerWidget(QWidget* _parent=0)
: Base(_parent)
{}
......
......@@ -107,7 +107,7 @@ public:
public: // inherited
void initialize(void)
void initialize(void) override
{
BaseModQ::initialize();
n_vertices_ = BaseModQ::mesh().n_vertices();
......
......@@ -86,6 +86,7 @@ struct CompositeTraits : public OpenMesh::DefaultTraits
FaceTraits
{
private:
typedef typename Refs::HalfedgeHandle HalfedgeHandle;
typedef typename Refs::Scalar Scalar;
......
......@@ -351,12 +351,11 @@ HeapT<HeapEntry, HeapInterface>::
downheap(size_t _idx)
{
const HeapEntry h = entry(_idx);
size_t childIdx;
const size_t s = size();
while(_idx < s)
{
childIdx = left(_idx);
size_t childIdx = left(_idx);
if (childIdx >= s) break;
if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx))))
......
......@@ -37,183 +37,183 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
#include <algorithm>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** \todo VHierarchyWindow documentation
*/
class VHierarchyWindow
{
private:
// reference of vertex hierarchy
VHierarchy *vhierarchy_;
// bits buffer (byte units)
unsigned char *buffer_;
int buffer_min_;
size_t buffer_max_;
int current_pos_;
// window (byte units)
int window_min_;
int window_max_;
// # of right shift (bit units)
unsigned char n_shift_; // [0, 7]
unsigned char flag8(unsigned char n_shift) const
{ return 0x80 >> n_shift; }
unsigned char flag8(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
}
int byte_idx(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return _node_handle.idx() / 8;
}
int buffer_idx(VHierarchyNodeHandle _node_handle) const
{ return byte_idx(_node_handle) - buffer_min_; }
bool before_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_min_) ? true : false; }
bool after_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_max_) ? false : true; }
bool underflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
bool overflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; }
bool update_buffer(VHierarchyNodeHandle _node_handle);
public:
VHierarchyWindow();
VHierarchyWindow(VHierarchy &_vhierarchy);
~VHierarchyWindow(void);
void set_vertex_hierarchy(VHierarchy &_vhierarchy)
{ vhierarchy_ = &_vhierarchy; }
void begin()
{
int new_window_min = window_min_;
for (current_pos_=window_min_-buffer_min_;
current_pos_ < window_size(); ++current_pos_)
{
if (buffer_[current_pos_] == 0)
++new_window_min;
else
{
n_shift_ = 0;
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
++n_shift_;
break;
}
}
window_min_ = new_window_min;
}
void next()
{
++n_shift_;
if (n_shift_ == 8)
{
n_shift_ = 0;
++current_pos_;
}
while (current_pos_ < window_max_-buffer_min_)
{
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
{
while (n_shift_ != 8)
{
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
return; // find 1 bit in the current byte
++n_shift_;
}
}
n_shift_ = 0;
++current_pos_;
}
}
bool end() { return !(current_pos_ < window_max_-buffer_min_); }
int window_size() const { return window_max_ - window_min_; }
size_t buffer_size() const { return buffer_max_ - buffer_min_; }
VHierarchyNodeHandle node_handle()
{
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
}
void activate(VHierarchyNodeHandle _node_handle)
{
update_buffer(_node_handle);
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
window_min_ = std::min(window_min_, byte_idx(_node_handle));
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
}
void inactivate(VHierarchyNodeHandle _node_handle)
{
if (is_active(_node_handle) != true) return;
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
}
bool is_active(VHierarchyNodeHandle _node_handle) const
{
if (before_window(_node_handle) == true ||
after_window(_node_handle) == true)
return false;
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
}
void init(VHierarchyNodeHandleContainer &_roots);
void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
void update_with_ecol(VHierarchyNodeHandle _parent_handle);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//=============================================================================
* ========================================================================= */
//=============================================================================
//
// CLASS newClass
//
//=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
#include <algorithm>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace OpenMesh {
namespace VDPM {
//== CLASS DEFINITION =========================================================
/** \todo VHierarchyWindow documentation
*/
class VHierarchyWindow
{
private:
// reference of vertex hierarchy
VHierarchy *vhierarchy_;
// bits buffer (byte units)
unsigned char *buffer_;
int buffer_min_;
size_t buffer_max_;
int current_pos_;
// window (byte units)
int window_min_;
int window_max_;
// # of right shift (bit units)
unsigned char n_shift_; // [0, 7]
unsigned char flag8(unsigned char n_shift) const
{ return 0x80 >> n_shift; }
unsigned char flag8(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
}
int byte_idx(VHierarchyNodeHandle _node_handle) const
{
assert(_node_handle.idx() >= 0);
return _node_handle.idx() / 8;
}
int buffer_idx(VHierarchyNodeHandle _node_handle) const
{ return byte_idx(_node_handle) - buffer_min_; }
bool before_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_min_) ? true : false; }
bool after_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_max_) ? false : true; }
bool underflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
bool overflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; }
bool update_buffer(VHierarchyNodeHandle _node_handle);
public:
VHierarchyWindow();
explicit VHierarchyWindow(VHierarchy &_vhierarchy);
~VHierarchyWindow(void);
void set_vertex_hierarchy(VHierarchy &_vhierarchy)
{ vhierarchy_ = &_vhierarchy; }
void begin()
{
int new_window_min = window_min_;
for (current_pos_=window_min_-buffer_min_;
current_pos_ < window_size(); ++current_pos_)
{
if (buffer_[current_pos_] == 0)
++new_window_min;
else
{
n_shift_ = 0;
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
++n_shift_;
break;
}
}
window_min_ = new_window_min;
}
void next()
{
++n_shift_;
if (n_shift_ == 8)
{
n_shift_ = 0;
++current_pos_;
}
while (current_pos_ < window_max_-buffer_min_)
{
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
{
while (n_shift_ != 8)
{
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
return; // find 1 bit in the current byte
++n_shift_;
}
}
n_shift_ = 0;
++current_pos_;
}
}
bool end() { return !(current_pos_ < window_max_-buffer_min_); }
int window_size() const { return window_max_ - window_min_; }
size_t buffer_size() const { return buffer_max_ - buffer_min_; }
VHierarchyNodeHandle node_handle()
{
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
}
void activate(VHierarchyNodeHandle _node_handle)
{
update_buffer(_node_handle);
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
window_min_ = std::min(window_min_, byte_idx(_node_handle));
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
}
void inactivate(VHierarchyNodeHandle _node_handle)
{
if (is_active(_node_handle) != true) return;
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
}
bool is_active(VHierarchyNodeHandle _node_handle) const
{
if (before_window(_node_handle) == true ||
after_window(_node_handle) == true)
return false;
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
}
void init(VHierarchyNodeHandleContainer &_roots);
void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
void update_with_ecol(VHierarchyNodeHandle _parent_handle);
};
//=============================================================================
} // namespace VDPM
} // namespace OpenMesh
//=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//=============================================================================
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