diff --git a/src/celcompat/fs.h b/src/celcompat/fs.h index 65473a8e..94e75d04 100644 --- a/src/celcompat/fs.h +++ b/src/celcompat/fs.h @@ -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) : diff --git a/src/celengine/render.cpp b/src/celengine/render.cpp index 4ca1f2b5..7c28c1e9 100644 --- a/src/celengine/render.cpp +++ b/src/celengine/render.cpp @@ -7460,7 +7460,7 @@ void Renderer::renderAnnotations(const vector& annotations, FontStyl switch (annotations[i].valign) { - case AlignCenter: + case VerticalAlignCenter: vOffset = -font[fs]->getHeight() / 2; break; case VerticalAlignTop: diff --git a/src/celengine/shadermanager.cpp b/src/celengine/shadermanager.cpp index 975da57f..6711cf28 100644 --- a/src/celengine/shadermanager.cpp +++ b/src/celengine/shadermanager.cpp @@ -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); } diff --git a/src/celestia/win32/windatepicker.cpp b/src/celestia/win32/windatepicker.cpp index e530246c..0e312c18 100644 --- a/src/celestia/win32/windatepicker.cpp +++ b/src/celestia/win32/windatepicker.cpp @@ -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(dp)); return 0; diff --git a/src/celestia/win32/winmain.cpp b/src/celestia/win32/winmain.cpp index b3c4c985..70ac1f72 100644 --- a/src/celestia/win32/winmain.cpp +++ b/src/celestia/win32/winmain.cpp @@ -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; } diff --git a/src/celestia/win32/wintourguide.cpp b/src/celestia/win32/wintourguide.cpp index 57f727f1..fc142cef 100644 --- a/src/celestia/win32/wintourguide.cpp +++ b/src/celestia/win32/wintourguide.cpp @@ -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++) { diff --git a/src/tools/cmod/3dstocmod/3dstocmod.cpp b/src/tools/cmod/3dstocmod/3dstocmod.cpp index df2ac888..1b8c35c7 100644 --- a/src/tools/cmod/3dstocmod/3dstocmod.cpp +++ b/src/tools/cmod/3dstocmod/3dstocmod.cpp @@ -13,6 +13,7 @@ #include "cmodops.h" #include #include +#include #include #include #include @@ -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) diff --git a/src/tools/cmod/cmodfix/cmodfix.cpp b/src/tools/cmod/cmodfix/cmodfix.cpp index c6bb6d02..1628aa85 100644 --- a/src/tools/cmod/cmodfix/cmodfix.cpp +++ b/src/tools/cmod/cmodfix/cmodfix.cpp @@ -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; } diff --git a/src/tools/cmod/cmodview/modelviewwidget.cpp b/src/tools/cmod/cmodview/modelviewwidget.cpp index 36c401fe..5120a0ec 100644 --- a/src/tools/cmod/cmodview/modelviewwidget.cpp +++ b/src/tools/cmod/cmodview/modelviewwidget.cpp @@ -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; } diff --git a/src/tools/stardb/makexindex.cpp b/src/tools/stardb/makexindex.cpp index 072c4f48..c8dec5bd 100644 --- a/src/tools/stardb/makexindex.cpp +++ b/src/tools/stardb/makexindex.cpp @@ -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;