mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 02:48:25 -05:00
Remove cppcheck warnings
This commit is contained in:
+1
-1
Submodule ext/ghoul updated: a6325c0ebe...6c127769c1
@@ -72,7 +72,7 @@ private:
|
||||
|
||||
GLuint _boxArray;
|
||||
GLuint _vertexPositionBuffer;
|
||||
ghoul::opengl::ProgramObject *_boxProgram;
|
||||
ghoul::opengl::ProgramObject* _boxProgram;
|
||||
glm::vec3 _boxScaling;
|
||||
psc _pscOffset;
|
||||
float _w;
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
Renderable* renderable();
|
||||
|
||||
private:
|
||||
bool sphereInsideFrustum(const psc s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
bool sphereInsideFrustum(const psc& s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
|
||||
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
SceneGraphNode* _parent;
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/highresclock.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "KeyboardController";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
namespace interaction {
|
||||
|
||||
@@ -149,8 +153,6 @@ void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier
|
||||
}
|
||||
|
||||
void KeyboardControllerLua::keyPressed(KeyAction action, Key key, KeyModifier modifier) {
|
||||
std::string _loggerCat = "KeyboardControllerLua";
|
||||
|
||||
lua_State* s = luaL_newstate();
|
||||
luaL_openlibs(s);
|
||||
|
||||
|
||||
@@ -328,10 +328,10 @@ void LuaConsole::keyboardCallback(int key, int action) {
|
||||
if (_commands.at(_activeCommand) != "") {
|
||||
|
||||
OsEng.scriptEngine().runScript(_commands.at(_activeCommand));
|
||||
if (_commandsHistory.size() > 0 &&
|
||||
if (!_commandsHistory.empty() &&
|
||||
_commands.at(_activeCommand) != _commandsHistory.at(_commandsHistory.size() - 1))
|
||||
_commandsHistory.push_back(_commands.at(_activeCommand));
|
||||
else if (_commandsHistory.size() == 0)
|
||||
else if (_commandsHistory.empty())
|
||||
_commandsHistory.push_back(_commands.at(_activeCommand));
|
||||
|
||||
_commands = _commandsHistory;
|
||||
|
||||
@@ -52,7 +52,8 @@ const std::string Property::TypeKey = "Type";
|
||||
const std::string Property::MetaDataKey = "MetaData";
|
||||
|
||||
Property::Property(std::string identifier, std::string guiName)
|
||||
: _identifier(std::move(identifier))
|
||||
: _owner(nullptr)
|
||||
, _identifier(std::move(identifier))
|
||||
{
|
||||
if (_identifier.empty())
|
||||
LWARNING("Property identifier is empty");
|
||||
|
||||
@@ -94,7 +94,7 @@ bool RenderableFieldlines::isReady() const {
|
||||
}
|
||||
|
||||
bool RenderableFieldlines::initialize() {
|
||||
if(_filenames.size() == 0) {
|
||||
if(_filenames.empty()) {
|
||||
LWARNING("No proper filenames provided, cannot initialize!");
|
||||
return false;
|
||||
}
|
||||
@@ -192,11 +192,12 @@ std::vector<std::vector<LinePoint> > RenderableFieldlines::getFieldlinesData(std
|
||||
|
||||
// ------ VARIBLES / LORENTZ -----------------
|
||||
if (hintsDictionary.hasKey("Variables")) {
|
||||
bool xVar, yVar, zVar;
|
||||
bool xVar;
|
||||
xVar = hintsDictionary.getValue("Variables.1", xVariable);
|
||||
if (xVar && xVariable == "Lorentz") {
|
||||
lorentz = true;
|
||||
} else {
|
||||
bool yVar, zVar;
|
||||
|
||||
yVar = hintsDictionary.getValue("Variables.2", yVariable);
|
||||
zVar = hintsDictionary.getValue("Variables.3", zVariable);
|
||||
|
||||
@@ -330,7 +330,6 @@ ghoul::opengl::Texture* RenderableVolume::loadTransferFunction(const std::string
|
||||
std::string line;
|
||||
while (std::getline(in, line)) {
|
||||
|
||||
float intensity = 1.0f;
|
||||
glm::vec4 rgba = glm::vec4(0.0f);
|
||||
// tokenize the line
|
||||
std::istringstream iss(line);
|
||||
@@ -346,6 +345,7 @@ ghoul::opengl::Texture* RenderableVolume::loadTransferFunction(const std::string
|
||||
} else if(key == "upper" && tokenSize == 2) {
|
||||
upper = stringToNumber<float>(tokens.at(1),upperLowerValidator);
|
||||
} else if(key == "mappingkey" && tokenSize == 6) {
|
||||
float intensity = 1.0f;
|
||||
intensity = stringToNumber<float>(tokens.at(1), intensityValidator);
|
||||
for(int i = 0; i < 4; ++i)
|
||||
rgba[i] = stringToNumber<float>(tokens.at(i+2));
|
||||
|
||||
@@ -52,6 +52,9 @@ RenderableVolumeGL::RenderableVolumeGL(const ghoul::Dictionary& dictionary)
|
||||
, _volumeName("")
|
||||
, _boxArray(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
, _volume(nullptr)
|
||||
, _transferFunction(nullptr)
|
||||
, _boxProgram(nullptr)
|
||||
, _boxScaling(1.0, 1.0, 1.0)
|
||||
, _w(0.f)
|
||||
, _updateTransferfunction(false)
|
||||
|
||||
@@ -126,7 +126,7 @@ RenderableStars::~RenderableStars() {
|
||||
}
|
||||
|
||||
bool RenderableStars::isReady() const {
|
||||
return (_program != nullptr) && (_fullData.size() > 0);
|
||||
return (_program != nullptr) && (!_fullData.empty());
|
||||
}
|
||||
|
||||
bool RenderableStars::initialize() {
|
||||
|
||||
@@ -319,7 +319,7 @@ PowerScaledScalar SceneGraphNode::calculateBoundingSphere(){
|
||||
// set the bounding sphere to 0.0
|
||||
_boundingSphere = 0.0;
|
||||
|
||||
if (_children.size() > 0) { // node
|
||||
if (!_children.empty()) { // node
|
||||
PowerScaledScalar maxChild;
|
||||
|
||||
// loop though all children and find the one furthest away/with the largest
|
||||
@@ -367,7 +367,7 @@ Renderable* SceneGraphNode::renderable() {
|
||||
}
|
||||
|
||||
// private helper methods
|
||||
bool SceneGraphNode::sphereInsideFrustum(const psc s_pos, const PowerScaledScalar& s_rad,
|
||||
bool SceneGraphNode::sphereInsideFrustum(const psc& s_pos, const PowerScaledScalar& s_rad,
|
||||
const Camera* camera)
|
||||
{
|
||||
// direction the camera is looking at in power scale
|
||||
|
||||
@@ -512,7 +512,6 @@ bool ScriptEngine::registerLuaLibrary(lua_State* state, const LuaLibrary& librar
|
||||
bool ScriptEngine::writeDocumentation(const std::string& filename, const std::string& type) const {
|
||||
if (type == "text") {
|
||||
// The additional space between the longest function name and the descriptions
|
||||
const size_t AdditionalSpace = 5;
|
||||
LDEBUG("Writing Lua documentation of type '" << type <<
|
||||
"' to file '" << filename << "'");
|
||||
std::ofstream file(filename);
|
||||
|
||||
+9
-1
@@ -35,7 +35,15 @@ namespace openspace {
|
||||
|
||||
|
||||
Camera::Camera()
|
||||
: _cameraDirection(0.f, 0.f, 0.f)
|
||||
: _maxFov(0.f)
|
||||
, _sinMaxFov(0.f)
|
||||
, _position()
|
||||
, _viewProjectionMatrix()
|
||||
, _modelMatrix()
|
||||
, _viewMatrix()
|
||||
, _projectionMatrix()
|
||||
, _viewDirection()
|
||||
, _cameraDirection(0.f, 0.f, 0.f)
|
||||
, _scaling(1.f, 0.f)
|
||||
//, _viewRotation(glm::quat(glm::vec3(0.f, 0.f, 0.f)))
|
||||
, _viewRotationMatrix(1.f)
|
||||
|
||||
@@ -53,6 +53,21 @@ KameleonWrapper::KameleonWrapper()
|
||||
, _model(nullptr)
|
||||
, _type(Model::Unknown)
|
||||
, _interpolator(nullptr)
|
||||
, _xMin(0.f)
|
||||
, _xMax(0.f)
|
||||
, _yMin(0.f)
|
||||
, _yMax(0.f)
|
||||
, _zMin(0.f)
|
||||
, _zMax(0.f)
|
||||
, _xValidMin(0.f)
|
||||
, _xValidMax(0.f)
|
||||
, _yValidMin(0.f)
|
||||
, _yValidMax(0.f)
|
||||
, _zValidMin(0.f)
|
||||
, _zValidMax(0.f)
|
||||
, _xCoordVar("")
|
||||
, _yCoordVar("")
|
||||
, _zCoordVar("")
|
||||
, _gridType(GridType::Unknown)
|
||||
{}
|
||||
|
||||
@@ -61,6 +76,21 @@ KameleonWrapper::KameleonWrapper(const std::string& filename)
|
||||
, _model(nullptr)
|
||||
, _type(Model::Unknown)
|
||||
, _interpolator(nullptr)
|
||||
, _xMin(0.f)
|
||||
, _xMax(0.f)
|
||||
, _yMin(0.f)
|
||||
, _yMax(0.f)
|
||||
, _zMin(0.f)
|
||||
, _zMax(0.f)
|
||||
, _xValidMin(0.f)
|
||||
, _xValidMax(0.f)
|
||||
, _yValidMin(0.f)
|
||||
, _yValidMax(0.f)
|
||||
, _zValidMin(0.f)
|
||||
, _zValidMax(0.f)
|
||||
, _xCoordVar("")
|
||||
, _yCoordVar("")
|
||||
, _zCoordVar("")
|
||||
, _gridType(GridType::Unknown)
|
||||
{
|
||||
open(filename);
|
||||
|
||||
@@ -33,6 +33,7 @@ ProgressBar::ProgressBar(int end, int width)
|
||||
|
||||
ProgressBar::ProgressBar(int end, int width, std::ostream& stream)
|
||||
: _width(width)
|
||||
, _previous(-1)
|
||||
, _end(end)
|
||||
, _stream(stream)
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ bool SpiceManager::getValue(const std::string& body, const std::string& value,
|
||||
LERROR("No value was provided");
|
||||
return false;
|
||||
}
|
||||
if (v.size() == 0) {
|
||||
if (v.empty()) {
|
||||
LERROR("Array for values has to be preallocaed");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user