Commit 9682aa2f authored by Jan Möbius's avatar Jan Möbius

Silence some cppcheck warnings

parent 80785d64
......@@ -164,7 +164,7 @@ int viewerId() {
return viewerId_;
}
void setViewers( std::vector< glViewer* > _viewerWidgets ) {
void setViewers( const std::vector< glViewer* >& _viewerWidgets ) {
PluginFunctions::examiner_widgets_ = _viewerWidgets;
PluginFunctions::examiner_widget_ = examiner_widgets_[0];
......@@ -174,7 +174,7 @@ void setViewers( std::vector< glViewer* > _viewerWidgets ) {
viewerId_ = qrand();
}
void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties ) {
void setViewerProperties( const std::vector< Viewer::ViewerProperties* >& _viewerProperties ) {
PluginFunctions::viewerProperties_ = _viewerProperties;
}
......@@ -221,9 +221,11 @@ void setEncodedExaminerView( QString _view ) {
void setEncodedExaminerView(int _viewerId , QString _view ) {
// Consistency check. If viewer id is wrong, we set the currently active viewer.
if ( _viewerId < 0 || _viewerId >= (int)examiner_widgets_.size() ) {
std::cerr << "Requested unknown viewer with id : " << _viewerId << std::endl;
examiner_widgets_[activeExaminer()]->decodeView ( _view );
return;
}
examiner_widgets_[_viewerId]->decodeView ( _view );
......
......@@ -79,7 +79,7 @@ namespace PluginFunctions {
//=======================================
/// Set the internal Viewer pointer ( DO NOT USE!! )
DLLEXPORT
void setViewers( std::vector< glViewer* > _viewerWidgets );
void setViewers( const std::vector< glViewer* >& _viewerWidgets );
/// Get a Viewer
DLLEXPORT
......@@ -87,7 +87,7 @@ glViewer* viewer(int _viewerId );
/// Set the internal viewerProperties pointer ( DO NOT USE!! )
DLLEXPORT
void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties );
void setViewerProperties( const std::vector< Viewer::ViewerProperties* >& _viewerProperties );
/** Set the internal scenegraph root node pointer. This is the topmost
* node of the whole scenegraph ( DO NOT USE!! )
......
......@@ -587,8 +587,8 @@ Core::init() {
// debug information for this case, print renderer count and their names
const unsigned int rendererCount = renderManager().available();
emit log(LOGERR,tr("Currently ") + QString::number(rendererCount) + tr(" renderers are available:") );
for (unsigned int i = 0 ; i < rendererCount ; ++i )
emit log(LOGERR, tr("Renderer ") + QString::number(i) + ": " + renderManager()[i]->name );
for (unsigned int rendererId = 0 ; rendererId < rendererCount ; ++rendererId )
emit log(LOGERR, tr("Renderer ") + QString::number(rendererId) + ": " + renderManager()[rendererId]->name );
}
} else {
......@@ -1901,8 +1901,8 @@ void Core::slotDeleteAllObjects( ){
bool Core::checkLibraryVersions() {
bool ok = true;
bool warn = false;
// bool ok = true;
// bool warn = false;
QString messages;
......@@ -1916,39 +1916,40 @@ bool Core::checkLibraryVersions() {
messages += tr("Link time QT Version:\t\t") + QString( QT_VERSION_STR ) + "\n";
messages += tr("This inconsistency may lead to an unstable behavior of OpenFlipper!");
warn = true;
// warn = true;
}
if ( !ok ) {
QString message = tr("Error! Library tests failed!\n");
message += tr("The following problems have been found:\n\n");
message += messages;
std::cerr << message.toStdString() << std::endl;
if ( OpenFlipper::Options::gui() ) {
finishSplash();
StaysOnTopMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message );
}
// Unsafe operation, so quit the application
exitFailure();
} else if ( warn ) {
QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
message += tr("The following checks failed:\n\n");
message += messages;
std::cerr << message.toStdString() << std::endl;
if ( OpenFlipper::Options::gui() ) {
finishSplash();
StaysOnTopMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message );
}
// if ( !ok ) {
// QString message = tr("Error! Library tests failed!\n");
// message += tr("The following problems have been found:\n\n");
//
// message += messages;
//
// std::cerr << message.toStdString() << std::endl;
//
// if ( OpenFlipper::Options::gui() ) {
// finishSplash();
// StaysOnTopMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message );
// }
//
// // Unsafe operation, so quit the application
// exitFailure();
//
// } else if ( warn ) {
}
// QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
// message += tr("The following checks failed:\n\n");
// message += messages;
//
// std::cerr << message.toStdString() << std::endl;
//
// if ( OpenFlipper::Options::gui() ) {
// finishSplash();
// StaysOnTopMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message );
// }
//
// }
#ifndef NDEBUG
else {
std::cerr << "Library Check succeeded" << std::endl;
......
......@@ -108,8 +108,8 @@ void Core::readApplicationOptions(INIFile& _ini) {
// Check if the mode already exists
bool found = false;
for (int i=0; i < viewModes_.size(); i++)
if (viewModes_[i]->name == mode)
for (int modeNr = 0; modeNr < viewModes_.size(); modeNr++)
if (viewModes_[modeNr]->name == mode)
found = true;
if (!found){
......
......@@ -66,6 +66,11 @@ void Core::startVideoCapture(QString _baseName, int _fps, bool _captureViewers)
// set track to true;
videoTimer_.setSingleShot(false);
// sanitize input
if (_fps == 0) {
_fps = 25;
}
// 25 fps
videoTimer_.start( 1000 / _fps);
......
......@@ -51,15 +51,15 @@
#include "salt.hh"
KeyGen::KeyGen(QString n, QString cHash, QString pHash, QString cpHash, QString prHash, QStringList mHashes, QString request)
KeyGen::KeyGen(QString n, QString cHash, QString pHash, QString cpHash, QString prHash, QStringList mHashes, QString request) :
name (n),
coreHash(cHash),
pluginHash(pHash),
cpuHash(cpHash),
productHash(prHash),
macHashes(mHashes),
requestSig(request)
{
name = n;
coreHash = cHash;
pluginHash = pHash;
cpuHash = cpHash;
productHash = prHash;
macHashes = mHashes;
requestSig = request;
}
QString KeyGen::computeSignature(const bool _utf8 ) const {
......
......@@ -88,7 +88,7 @@
class StackWalkerToConsole : public StackWalker
{
protected:
virtual void OnOutput(LPCSTR szText)
virtual void OnOutput(LPCSTR szText) override
{
// Writes crash dump to .OpenFlipper config directory
std::ofstream crashFile;
......
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