Fix PVS Studio reported errors (Closes: #425)
parent
e9ae3959eb
commit
7fd01f38b0
|
@ -18,7 +18,7 @@ namespace celestia
|
|||
{
|
||||
namespace filesystem
|
||||
{
|
||||
class filesystem_error : std::system_error
|
||||
class filesystem_error : public std::system_error
|
||||
{
|
||||
public:
|
||||
filesystem_error(std::error_code ec, const char* msg) :
|
||||
|
|
|
@ -7460,7 +7460,7 @@ void Renderer::renderAnnotations(const vector<Annotation>& annotations, FontStyl
|
|||
|
||||
switch (annotations[i].valign)
|
||||
{
|
||||
case AlignCenter:
|
||||
case VerticalAlignCenter:
|
||||
vOffset = -font[fs]->getHeight() / 2;
|
||||
break;
|
||||
case VerticalAlignTop:
|
||||
|
|
|
@ -2845,10 +2845,6 @@ ShaderManager::buildParticleVertexShader(const ShaderProperties& props)
|
|||
{
|
||||
source << "uniform float pointScale;\n";
|
||||
source << "attribute float pointSize;\n";
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::PointSprite)
|
||||
{
|
||||
source << DeclareVarying("pointFade", Shader_Float);
|
||||
}
|
||||
|
||||
|
|
|
@ -622,9 +622,6 @@ static LRESULT
|
|||
DatePickerCreate(HWND hwnd, CREATESTRUCT& cs)
|
||||
{
|
||||
DatePicker* dp = new DatePicker(hwnd, cs);
|
||||
if (dp == NULL)
|
||||
return -1;
|
||||
|
||||
SetWindowLongPtr(hwnd, 0, reinterpret_cast<DWORD_PTR>(dp));
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -2232,7 +2232,7 @@ static void BuildScriptsMenu(HMENU menuBar, const fs::path& scriptsDir)
|
|||
}
|
||||
|
||||
MENUITEMINFO info;
|
||||
memset(&info, sizeof(info), 0);
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(info);
|
||||
info.fMask = MIIM_SUBMENU;
|
||||
|
||||
|
@ -3028,7 +3028,7 @@ static char* skipSpace(char* s)
|
|||
|
||||
static char* skipUntilQuote(char* s)
|
||||
{
|
||||
while (*s != '"' && s != '\0')
|
||||
while (*s != '"' && *s != '\0')
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -45,10 +45,10 @@ BOOL APIENTRY TourGuideProc(HWND hDlg,
|
|||
|
||||
HWND hwnd = GetDlgItem(hDlg, IDC_COMBO_TOURGUIDE);
|
||||
const DestinationList* destinations = guide->appCore->getDestinations();
|
||||
Destination* dest = (*destinations)[0];
|
||||
guide->selectedDest = dest;
|
||||
if (hwnd != NULL && destinations != NULL)
|
||||
{
|
||||
Destination* dest = (*destinations)[0];
|
||||
guide->selectedDest = dest;
|
||||
for (DestinationList::const_iterator iter = destinations->begin();
|
||||
iter != destinations->end(); iter++)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "cmodops.h"
|
||||
#include <celmodel/modelfile.h>
|
||||
#include <cel3ds/3dsread.h>
|
||||
#include <celmath/mathlib.h>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
@ -20,6 +21,7 @@
|
|||
|
||||
using namespace cmod;
|
||||
using namespace std;
|
||||
using namespace celmath;
|
||||
|
||||
|
||||
void usage()
|
||||
|
@ -59,7 +61,7 @@ int main(int argc, char* argv[])
|
|||
double weldTolerance = 1.0e-6;
|
||||
bool weldVertices = true;
|
||||
|
||||
Model* newModel = GenerateModelNormals(*model, float(smoothAngle * 3.14159265 / 180.0), weldVertices, weldTolerance);
|
||||
Model* newModel = GenerateModelNormals(*model, (float)degToRad(smoothAngle), weldVertices, weldTolerance);
|
||||
delete model;
|
||||
|
||||
if (!newModel)
|
||||
|
|
|
@ -375,14 +375,14 @@ bool operator<(const Mesh::VertexDescription& a,
|
|||
|
||||
if (a.nAttributes < b.nAttributes)
|
||||
return true;
|
||||
if (b.nAttributes < b.nAttributes)
|
||||
if (b.nAttributes < a.nAttributes)
|
||||
return false;
|
||||
|
||||
for (uint32_t i = 0; i < a.nAttributes; i++)
|
||||
{
|
||||
if (a.attributes[i] < b.attributes[i])
|
||||
return true;
|
||||
else if (b.attributes[i] < a.attributes[i])
|
||||
if (b.attributes[i] < a.attributes[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1513,6 +1513,7 @@ ModelViewWidget::createShader(const ShaderKey& shaderKey)
|
|||
{
|
||||
qWarning("Vertex shader error: %s", vertexShader->log().c_str());
|
||||
std::cerr << vertexShaderSource.toStdString() << std::endl;
|
||||
delete vertexShader;
|
||||
delete glShader;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1522,6 +1523,8 @@ ModelViewWidget::createShader(const ShaderKey& shaderKey)
|
|||
{
|
||||
qWarning("Fragment shader error: %s", fragmentShader->log().c_str());
|
||||
std::cerr << fragmentShaderSource.toStdString() << std::endl;
|
||||
delete vertexShader;
|
||||
delete fragmentShader;
|
||||
delete glShader;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1536,6 +1539,8 @@ ModelViewWidget::createShader(const ShaderKey& shaderKey)
|
|||
if (!glShader->link())
|
||||
{
|
||||
qWarning("Shader link error: %s", glShader->log().c_str());
|
||||
delete vertexShader;
|
||||
delete fragmentShader;
|
||||
delete glShader;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ bool WriteCrossIndex(istream& in, ostream& out)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (!parseCommandLine(argc, argv) || inputFilename.empty())
|
||||
if (!parseCommandLine(argc, argv)/* || inputFilename.empty()*/)
|
||||
{
|
||||
Usage();
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue