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

Merge branch 'cppcheck_via_gitlab' into 'master'

Cppcheck via gitlab

Run cppcheck via gitlab not via jenkins

See merge request !93
parents 0d88413e 851abb59
Pipeline #1707 passed with stage
......@@ -41,3 +41,9 @@ clang-c++98-Qt5:
tags:
- Linux
- MultiThreads
cppcheck:
script: "CI/ci-cppcheck.sh"
tags:
- Linux
- MultiThreads
......@@ -891,7 +891,6 @@ void MeshCompiler::forceUnsharedFaceVertex()
for (int t = 0; t < numRemainingTris; ++t)
{
// check if the triangle references the good corner by testing the 3 vertices of the triangulation
bool triSkipped = true;
for (int k = 0; k < 3; ++k)
{
int cornerID = -1 - triIndexBuffer_[(triCounter + currentTri->id) * 3 + k];
......@@ -915,7 +914,6 @@ void MeshCompiler::forceUnsharedFaceVertex()
++numTrisCovered;
triSkipped = false;
// remove triangle from the ring list
currentTri->prev->next = currentTri->next;
......
......@@ -149,14 +149,13 @@ bool QtBaseViewer::pick( SceneGraph::PickTarget _pickTarget,
if ( hits > 0 )
{
GLuint *ptr = &selectionBuffer[0],
num_names,
z,
min_z=~(0u),
max_z=0;
for (int i=0; i<hits; ++i)
{
num_names = *ptr++;
const GLuint num_names = *ptr++;
if ( num_names != NAME_STACK_SIZE )
{
std::cerr << "QtBaseViewer::pick() : namestack error\n\n";
......
......@@ -94,11 +94,25 @@ public:
slice_width_(0),
offset_(0)
{
plane0_[0] = 0.0;
plane0_[1] = 0.0;
plane0_[2] = 0.0;
plane0_[3] = 0.0;
plane1_[0] = 0.0;
plane1_[1] = 0.0;
plane1_[2] = 0.0;
plane1_[3] = 0.0;
offset_plane0_[0] = 0.0;
offset_plane0_[1] = 0.0;
offset_plane0_[2] = 0.0;
offset_plane0_[3] = 0.0;
offset_plane1_[0] = 0.0;
offset_plane1_[1] = 0.0;
offset_plane1_[2] = 0.0;
offset_plane1_[3] = 0.0;
}
......
#!/bin/bash
# Exit script on any error
set -e
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
WARNING='\033[0;93m'
echo -e "${OUTPUT}"
echo "=============================================================================="
echo "Running cppcheck"
echo "=============================================================================="
echo -e "${NC}"
echo "Started: $(date)"
echo "Please Wait ..."
# Run cppcheck and output into file
cppcheck --enable=all \
-j4 \
--quiet \
-i libs_required \
-i build-release \
-i build-debug \
-i .svn \
-i .git \
--force \
-UDOXY_IGNORE_THIS \
--suppress=unusedPrivateFunction \
--suppress=ConfigurationNotChecked \
--suppress=missingIncludeSystem \
-DOPENMESHDLLEXPORT="" \
-Umin -Umax -UBMPOSTFIX \
-DACGDLLEXPORT=""\
-DDLLEXPORTONLY=""\
-DDLLEXPORT=""\
. &> cppcheck.log
echo "Finished: $(date)"
echo -e "${OUTPUT}"
echo "=============================================================================="
echo "CPPCHECK Messages"
echo "=============================================================================="
echo -e "${NC}"
# Echo output to command line for simple analysis via gitlab
cat cppcheck.log
COUNT=$(wc -l < cppcheck.log )
echo -e "${OUTPUT}"
echo "=============================================================================="
echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
if [ $COUNT -gt 54 ]; then
echo -e ${WARNING}
echo "Total CPPCHECK error Count is $COUNT, which is too High! CPPCHECK Run failed";
echo -e "${NC}"
exit 1;
else
echo "Total CPPCHECK error Count is $COUNT ... OK"
fi
......@@ -607,7 +607,6 @@ void LightNode::setParameters(GLenum _index, LightSource& _light)
glLightfv(_index, GL_SPECULAR, specular);
Vec3d& sd = _light.realSpotDirection_;
GLfloat dir[3] = {(float)sd[0], (float)sd[1], (float)sd[2]};
bool directional = _light.directional();
......@@ -616,7 +615,11 @@ void LightNode::setParameters(GLenum _index, LightSource& _light)
glLightfv(_index, GL_POSITION, realPos);
if(!directional) glLightfv(_index, GL_SPOT_DIRECTION, dir);
if(!directional) {
GLfloat dir[3] = {(float)sd[0], (float)sd[1], (float)sd[2]};
glLightfv(_index, GL_SPOT_DIRECTION, dir);
}
if(!directional) glLightf(_index, GL_SPOT_EXPONENT, _light.spotExponent_);
if(!directional) glLightf(_index, GL_SPOT_CUTOFF, _light.spotCutoff_);
......
......@@ -53,7 +53,8 @@
PostProcessorInput::PostProcessorInput( GLuint _colTex, GLuint _depthTex, int _width, int _height) : colorTex_(_colTex), depthTex_(_depthTex), width(_width), height(_height), sampleCount_(0)
PostProcessorInput::PostProcessorInput( GLuint _colTex, GLuint _depthTex, int _width, int _height) :
colorTex_(_colTex), depthTex_(_depthTex), width(_width), height(_height), sampleCount_(0), texfmt_(0)
{
view_.identity();
proj_.identity();
......
......@@ -82,7 +82,6 @@ struct DLLEXPORT PostProcessorInput
// format of color tex
GLuint texfmt_;
// view and projection matrix
ACG::GLMatrixf view_;
ACG::GLMatrixf proj_;
......
......@@ -502,10 +502,10 @@ bool LicenseManager::authenticate() {
// ===============================================================================================
// Check License or generate request
// ===============================================================================================
bool alreadyExpired = true;
if (!elements.empty()) //valid file was found
{
// Check expiry date
QDate currentDate = QDate::currentDate();
QDate expiryDate = QDate::fromString(elements[1],Qt::ISODate);
......@@ -522,16 +522,11 @@ bool LicenseManager::authenticate() {
macFound = true;
}
if (timestampOk()) {
alreadyExpired = false;
}
if ( !signatureOk ) {
authstring_ += tr("License Error: The license file signature for Plugin \"") + name() + tr("\" is invalid!\n\n");
} else if ( expired ) {
authstring_ += tr("License Error: The license for plugin \"") + name() + tr("\" has expired on ") + elements[1] + "!\n\n";
} else if ( alreadyExpired ) {
} else if ( !timestampOk() ) {
authstring_ += tr("License Error: System time has been reset. The license for plugin \"") + name() + tr("\" has been expired!\n\n");
} else if ( elements[2] != pluginFileName() ) {
authstring_ += tr("License Error: The license file contains plugin name\"") + elements[2] + tr("\" but this is plugin \"") + name() + "\"!\n\n";
......
......@@ -114,7 +114,8 @@ FileOBJPlugin::FileOBJPlugin()
loadDefaultButton_(0),
forceTriangleMesh_(false),
forcePolyMesh_(false),
textureIndexPropFetched_(false)
textureIndexPropFetched_(false),
trimeshOptions_(OBJImporter::NONE)
{
}
......@@ -1750,9 +1751,9 @@ void FileOBJPlugin::checkTypes(QByteArray& _bufferedFile, QString _filename, OBJ
case TYPEASK: //ask
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
if (trimeshOptions == OBJImporter::TRIMESH )
if (trimeshOptions_ == OBJImporter::TRIMESH )
_importer.forceMeshType( OBJImporter::TRIMESH );
else if (trimeshOptions == OBJImporter::POLYMESH)
else if (trimeshOptions_ == OBJImporter::POLYMESH)
_importer.forceMeshType( OBJImporter::POLYMESH );
break;
......@@ -1784,9 +1785,9 @@ void FileOBJPlugin::handleTrimeshDialog()
if (msgBox.clickedButton() == triButton)
trimeshOptions = OBJImporter::TRIMESH ;
trimeshOptions_ = OBJImporter::TRIMESH ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = OBJImporter::POLYMESH ;
trimeshOptions_ = OBJImporter::POLYMESH ;
}
//-----------------------------------------------------------------------------------------------------
......
......@@ -253,7 +253,7 @@ class FileOBJPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
QString textureIndexPropertyName_;
bool textureIndexPropFetched_;
std::map<int,QString> texIndexFileMap_;
OBJImporter::ObjectOptionsE trimeshOptions;
OBJImporter::ObjectOptionsE trimeshOptions_;
};
......
......@@ -93,7 +93,9 @@ FileOFFPlugin::FileOFFPlugin()
userWriteOptions_(0),
forceTriangleMesh_(false),
forcePolyMesh_(false),
readColorComp_(false) {
readColorComp_(false),
trimeshOptions_(OFFImporter::NONE)
{
}
//-----------------------------------------------------------------------------------------------------
......@@ -534,9 +536,9 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
// Create message box
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
if (trimeshOptions == OFFImporter::TRIMESH)
if (trimeshOptions_ == OFFImporter::TRIMESH)
type = DATA_TRIANGLE_MESH;
else if (trimeshOptions == OFFImporter::POLYMESH)
else if (trimeshOptions_ == OFFImporter::POLYMESH)
type = DATA_POLY_MESH;
else
type = _importer.isTriangleMesh() ? DATA_TRIANGLE_MESH : DATA_POLY_MESH;
......@@ -579,9 +581,9 @@ void FileOFFPlugin::handleTrimeshDialog()
if (msgBox.clickedButton() == triButton)
trimeshOptions = OFFImporter::TRIMESH ;
trimeshOptions_ = OFFImporter::TRIMESH ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = OFFImporter::POLYMESH ;
trimeshOptions_ = OFFImporter::POLYMESH ;
}
//-----------------------------------------------------------------------------------------------------
......
......@@ -269,7 +269,7 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
bool forceTriangleMesh_;
bool forcePolyMesh_;
bool readColorComp_;
OFFImporter::ObjectOptionsE trimeshOptions;
OFFImporter::ObjectOptionsE trimeshOptions_;
};
#if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
......
......@@ -85,7 +85,8 @@ FileOMPlugin::FileOMPlugin() :
loadVertexColor_(0),
loadFaceColor_(0),
loadFaceNormal_(0),
loadDefaultButton_(0)
loadDefaultButton_(0),
trimeshOptions_(0)
{
}
......@@ -189,8 +190,8 @@ int FileOMPlugin::loadObject(QString _filename) {
// Note: If in non-gui mode, we will never enter this case branch
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
if ((trimeshOptions == TYPEPOLY) ||
(trimeshOptions == TYPEASK && !triMesh)) {
if ((trimeshOptions_ == TYPEPOLY) ||
(trimeshOptions_ == TYPEASK && !triMesh)) {
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
......@@ -256,11 +257,11 @@ void FileOMPlugin::handleTrimeshDialog()
if (msgBox.clickedButton() == triButton)
trimeshOptions = TYPETRIANGLE ;
trimeshOptions_ = TYPETRIANGLE ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = TYPEPOLY ;
trimeshOptions_ = TYPEPOLY ;
else
trimeshOptions = TYPEASK;
trimeshOptions_ = TYPEASK;
}
//-----------------------------------------------------------------------------------------------------
......
......@@ -169,7 +169,7 @@ class FileOMPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInter
QCheckBox* loadFaceColor_;
QCheckBox* loadFaceNormal_;
QPushButton* loadDefaultButton_;
int trimeshOptions;
int trimeshOptions_;
};
#endif //FILEOMPLUGIN_HH
......@@ -81,7 +81,8 @@ FilePLYPlugin::FilePLYPlugin()
loadVertexTexCoord_(0),
loadFaceNormal_(0),
loadFaceColor_(0),
loadDefaultButton_(0) {
loadDefaultButton_(0),
trimeshOptions_(0) {
}
//-----------------------------------------------------------------------------------------------------
......@@ -250,8 +251,8 @@ int FilePLYPlugin::loadObject(QString _filename) {
// If Ask is selected -> show dialog
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
if ((trimeshOptions == TYPEPOLY) ||
(trimeshOptions == TYPEASK && !isTriMesh)) {
if ((trimeshOptions_ == TYPEPOLY) ||
(trimeshOptions_ == TYPEASK && !isTriMesh)) {
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
......@@ -317,11 +318,11 @@ void FilePLYPlugin::handleTrimeshDialog()
if (msgBox.clickedButton() == triButton)
trimeshOptions = TYPETRIANGLE ;
trimeshOptions_ = TYPETRIANGLE ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = TYPEPOLY ;
trimeshOptions_ = TYPEPOLY ;
else
trimeshOptions = TYPEASK;
trimeshOptions_ = TYPEASK;
}
//-----------------------------------------------------------------------------------------------------
......
......@@ -175,7 +175,8 @@ class FilePLYPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
QCheckBox* loadFaceNormal_;
QCheckBox* loadFaceColor_;
QPushButton* loadDefaultButton_;
int trimeshOptions;
int trimeshOptions_;
};
#if defined(INCLUDE_TEMPLATES) && !defined(FILEPLYPLUGIN_C)
......
......@@ -79,6 +79,9 @@ DepthPeelingPlugin::DepthPeelingPlugin() :
for (unsigned int i = 0; i < 4; ++i)
blendDualPeelProg_[i] = 0;
for (unsigned int i = 0; i < 16; ++i)
glLightIDs_[i] = 0;
}
......@@ -255,7 +258,7 @@ void DepthPeelingPlugin::generatePeelingShaders(GLSL::StringList* _strVertexShad
std::string strMaterial = "gl_FrontLightProduct[";
{
char szTmp[8];
sprintf(szTmp, "%d]", glLightIDs_[i]);
sprintf(szTmp, "%u]", glLightIDs_[i]);
strLight += szTmp;
strMaterial += szTmp;
......
......@@ -36,3 +36,6 @@ redundantAssignment:OpenFlipper/LicenseManager/LicenseManagerActive.cc:310
// purgedConfiguration
purgedConfiguration
// Missing includes from system libraries
missingIncludeSystem
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