mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-19 19:39:30 -06:00
Fixed more gcc and Cppcheck warnings
This commit is contained in:
@@ -69,7 +69,8 @@ public:
|
||||
* Adds the passed option to the list of available options. The <code>value</code> of
|
||||
* the <code>option</code> must not have been registered previously, or a warning will
|
||||
* be logged.
|
||||
* \param option The option that will be added to the list of available options
|
||||
* \param value The option that will be added to the list of available options
|
||||
* \param desc The description of the value that will be added
|
||||
*/
|
||||
void addOption(int value, std::string desc);
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@ private:
|
||||
|
||||
float _increment;
|
||||
float _oldTime = 0;
|
||||
float _dtEt;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -420,7 +420,7 @@ TEST_F(SpiceManagerTest, getSubObserverPoint){
|
||||
double targetEt;
|
||||
double subObserverPoint_ref[3];
|
||||
double vectorToSurfacePoint_ref[3];
|
||||
static SpiceChar * method[2] = { "Intercept: ellipsoid", "Near point: ellipsoid" };
|
||||
static SpiceChar* method[2] = { static_cast<char*>("Intercept: ellipsoid"), static_cast<char*>("Near point: ellipsoid") };
|
||||
|
||||
str2et_c("2004 jun 11 19:32:00", &et);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
PowerScaledSphere(const PowerScaledScalar& radius,
|
||||
int segments = 8);
|
||||
~PowerScaledSphere();
|
||||
PowerScaledSphere(const PowerScaledSphere& cpy);
|
||||
|
||||
bool initialize();
|
||||
|
||||
|
||||
@@ -345,8 +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);
|
||||
float intensity = stringToNumber<float>(tokens.at(1), intensityValidator);
|
||||
for(int i = 0; i < 4; ++i)
|
||||
rgba[i] = stringToNumber<float>(tokens.at(i+2));
|
||||
|
||||
|
||||
@@ -124,6 +124,8 @@ namespace openspace {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
|
||||
const int type = lua_type(L, -1);
|
||||
if (type != LUA_TBOOLEAN)
|
||||
return luaL_error(L, "Expected argument of type 'bool'");
|
||||
bool b = lua_toboolean(L, -1) != 0;
|
||||
OsEng.renderEngine()->toggleVisualizeABuffer(b);
|
||||
return 0;
|
||||
@@ -140,6 +142,8 @@ namespace openspace {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
|
||||
const int type = lua_type(L, -1);
|
||||
if (type != LUA_TBOOLEAN)
|
||||
return luaL_error(L, "Expected argument of type 'bool'");
|
||||
bool b = lua_toboolean(L, -1) != 0;
|
||||
OsEng.renderEngine()->toggleInfoText(b);
|
||||
return 0;
|
||||
@@ -508,8 +512,7 @@ namespace openspace {
|
||||
PrintText(i++, "Scaling: (% .5f, % .5f)", scaling[0], scaling[1]);
|
||||
|
||||
double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - Time::ref().currentTime();
|
||||
double t = 0.0;
|
||||
t = 1.f - remaining / openspace::ImageSequencer::ref().getIntervalLength();
|
||||
double t = 1.f - remaining / openspace::ImageSequencer::ref().getIntervalLength();
|
||||
std::string progress = "|";
|
||||
int g = ((t)* 20) + 1;
|
||||
for (int i = 0; i < g; i++) progress.append("-"); progress.append(">");
|
||||
|
||||
@@ -125,8 +125,22 @@ PowerScaledSphere::PowerScaledSphere(const PowerScaledScalar& radius, int segmen
|
||||
}
|
||||
}
|
||||
|
||||
PowerScaledSphere::~PowerScaledSphere()
|
||||
PowerScaledSphere::PowerScaledSphere(const PowerScaledSphere& cpy)
|
||||
: _vaoID(cpy._vaoID)
|
||||
, _vBufferID(cpy._vBufferID)
|
||||
, _iBufferID(cpy._iBufferID)
|
||||
, _isize(cpy._isize)
|
||||
, _vsize(cpy._vsize)
|
||||
, _varray(new Vertex[_vsize])
|
||||
, _iarray(new int[_isize])
|
||||
{
|
||||
// @TODO This needs to be tested ---abock
|
||||
|
||||
std::memcpy(_varray, cpy._varray, _vsize * sizeof(Vertex));
|
||||
std::memcpy(_iarray, cpy._iarray, _isize * sizeof(int));
|
||||
}
|
||||
|
||||
PowerScaledSphere::~PowerScaledSphere() {
|
||||
if (_varray)
|
||||
delete[] _varray;
|
||||
if (_iarray)
|
||||
@@ -140,10 +154,8 @@ PowerScaledSphere::~PowerScaledSphere()
|
||||
glDeleteVertexArrays(1, &_vaoID);
|
||||
}
|
||||
|
||||
bool PowerScaledSphere::initialize()
|
||||
{
|
||||
bool PowerScaledSphere::initialize() {
|
||||
// Initialize and upload to graphics card
|
||||
GLuint errorID;
|
||||
if (_vaoID == 0)
|
||||
glGenVertexArrays(1, &_vaoID);
|
||||
|
||||
@@ -188,8 +200,7 @@ bool PowerScaledSphere::initialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void PowerScaledSphere::render()
|
||||
{
|
||||
void PowerScaledSphere::render() {
|
||||
glBindVertexArray(_vaoID); // select first VAO
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID);
|
||||
glDrawElements(GL_TRIANGLES, _isize, GL_UNSIGNED_INT, 0);
|
||||
|
||||
@@ -46,9 +46,9 @@ void SpiceManager::initialize() {
|
||||
_manager->_lastAssignedKernel = 0;
|
||||
|
||||
// Set the SPICE library to not exit the program if an error occurs
|
||||
erract_c("SET", 0, "REPORT");
|
||||
erract_c("SET", 0, static_cast<char*>("REPORT"));
|
||||
// But we do not want SPICE to print the errors, we will fetch them ourselves
|
||||
errprt_c("SET", 0, "NONE");
|
||||
errprt_c("SET", 0, static_cast<char*>("NONE"));
|
||||
}
|
||||
|
||||
void SpiceManager::deinitialize() {
|
||||
@@ -59,8 +59,8 @@ void SpiceManager::deinitialize() {
|
||||
_manager = nullptr;
|
||||
|
||||
// Set values back to default
|
||||
erract_c("SET", 0, "DEFAULT");
|
||||
errprt_c("SET", 0, "DEFAULT");
|
||||
erract_c("SET", 0, static_cast<char*>("DEFAULT"));
|
||||
errprt_c("SET", 0, static_cast<char*>("DEFAULT"));
|
||||
}
|
||||
|
||||
SpiceManager& SpiceManager::ref() {
|
||||
@@ -307,12 +307,12 @@ bool SpiceManager::getTargetPosition(const std::string& target,
|
||||
psc& position,
|
||||
double& lightTime) const
|
||||
{
|
||||
double pos[3] = { NULL, NULL, NULL };
|
||||
double pos[3] = { 0.0, 0.0, 0.0};
|
||||
|
||||
spkpos_c(target.c_str(), ephemerisTime, referenceFrame.c_str(),
|
||||
aberrationCorrection.c_str(), observer.c_str(), pos, &lightTime);
|
||||
|
||||
if (pos[0] == NULL || pos[1] == NULL || pos[2] == NULL)
|
||||
if (pos[0] == 0.0 || pos[1] == 0.0|| pos[2] == 0.0)
|
||||
return false;
|
||||
|
||||
position = PowerScaledCoordinate::CreatePowerScaledCoordinate(pos[0], pos[1], pos[2]);
|
||||
@@ -507,7 +507,7 @@ bool SpiceManager::getPositionPrimeMeridian(const std::string& fromFrame,
|
||||
glm::dmat3& positionMatrix) const{
|
||||
|
||||
int id;
|
||||
getNaifId(body.c_str(), id);
|
||||
getNaifId(body, id);
|
||||
tipbod_c(fromFrame.c_str(), id, ephemerisTime, (double(*)[3])glm::value_ptr(positionMatrix));
|
||||
|
||||
bool hasError = checkForError("Error retrieving position transform matrix from "
|
||||
@@ -690,10 +690,10 @@ void SpiceManager::applyTransformationMatrix(glm::dvec3& position,
|
||||
}
|
||||
|
||||
bool SpiceManager::checkForError(std::string errorMessage) {
|
||||
static char msg[1024];
|
||||
|
||||
int failed = failed_c();
|
||||
if (failed) {
|
||||
static char msg[1024];
|
||||
if (!errorMessage.empty()) {
|
||||
getmsg_c("LONG", 1024, msg);
|
||||
LERROR(errorMessage);
|
||||
|
||||
Reference in New Issue
Block a user