From 65c74399b0380949963801ff36a7eaf69ad18c81 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Nov 2016 21:15:58 +0100 Subject: [PATCH] Changed: Constification of catches --- code/nel/tools/3d/object_viewer/main_frame.cpp | 4 ++-- code/nel/tools/3d/object_viewer/mesh_dlg.cpp | 2 +- code/nel/tools/3d/object_viewer/object_viewer.cpp | 14 +++++++------- code/nel/tools/3d/object_viewer/particle_dlg.cpp | 10 +++++----- .../tools/3d/object_viewer/particle_tree_ctrl.cpp | 2 +- .../nel/tools/3d/object_viewer/scheme_bank_dlg.cpp | 4 ++-- .../tools/3d/object_viewer/skeleton_scale_dlg.cpp | 4 ++-- .../nel/tools/3d/object_viewer/sound_anim_view.cpp | 2 +- .../nel/tools/3d/object_viewer/texture_chooser.cpp | 2 +- .../mission_compiler_main_window.cpp | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/code/nel/tools/3d/object_viewer/main_frame.cpp b/code/nel/tools/3d/object_viewer/main_frame.cpp index f862160b7..5a9e4099d 100644 --- a/code/nel/tools/3d/object_viewer/main_frame.cpp +++ b/code/nel/tools/3d/object_viewer/main_frame.cpp @@ -590,7 +590,7 @@ void CMainFrame::OnFileLoadconfig() } } } - catch (Exception& e) + catch (const Exception& e) { MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } @@ -762,7 +762,7 @@ void CMainFrame::OnFileSaveconfig() { ObjView->serial(file); } - catch (Exception& e) + catch (const Exception& e) { MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp index 935cb3373..237e01d4b 100644 --- a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp @@ -112,7 +112,7 @@ void CMeshDlg::OnBrowseShape() m_ShapeName = (std::string(fname) + ext).c_str(); touchPSState(); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); } diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 3cefbb9a5..f3c2108fa 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -534,7 +534,7 @@ void CObjectViewer::loadConfigFile() if (var = cf.getVarPtr("cloud_wind_speed")) _CSS.WindSpeed = var->asFloat(); } - catch (Exception& e) + catch (const Exception& e) { ::MessageBox (NULL, utf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK|MB_ICONEXCLAMATION); } @@ -822,7 +822,7 @@ bool CObjectViewer::initUI (HWND parent) { iF.serial(SchemeManager); } - catch (NLMISC::EStream &e) + catch (const NLMISC::EStream &e) { std::string msg = toString("Unable to load the default scheme bank file : %s", e.what()); ::MessageBox(NULL, utf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); @@ -1896,7 +1896,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename) // Append the ig. addInstanceGroup(ig); } - catch (Exception& e) + catch (const Exception& e) { // clean delete ig; @@ -1961,7 +1961,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: // Add the shape shapeSkel=streamShape.getShapePointer(); } - catch (Exception& e) + catch (const Exception& e) { _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); @@ -2014,7 +2014,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: // Add the shape shapeMesh=streamShape.getShapePointer(); } - catch (Exception& e) + catch (const Exception& e) { _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); continue; @@ -3219,7 +3219,7 @@ bool CObjectViewer::createVegetableLandscape() _VegetableCollisionManager->setLandscape(&_VegetableLandscape->Landscape); _VegetableCollisionEntity= _VegetableCollisionManager->createEntity(); } - catch (Exception &e) + catch (const Exception &e) { // close the progress dialog dlgProgress.DestroyWindow(); @@ -3776,7 +3776,7 @@ void CObjectViewer::shootScene() break; } } - catch (Exception &e) + catch (const Exception &e) { std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what()); _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); diff --git a/code/nel/tools/3d/object_viewer/particle_dlg.cpp b/code/nel/tools/3d/object_viewer/particle_dlg.cpp index 86fec1fcc..8a886aa1f 100644 --- a/code/nel/tools/3d/object_viewer/particle_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/particle_dlg.cpp @@ -419,7 +419,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons psNode.setModified(false); setStatusBarText(CString(fullPath.c_str()) + " " + getStrRsc(IDS_SAVED)); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { if (askToContinueWhenError) { @@ -468,7 +468,7 @@ bool CParticleDlg::loadPS(HWND parent, CParticleWorkspace::CNode &psNode, TLoadP setStatusBarText(CString(psNode.getFullPath().c_str()) + " " + getStrRsc(IDS_LOADED)); } } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { switch(behav) { @@ -547,7 +547,7 @@ void CParticleDlg::OnCreateNewPsWorkspace() { newPW->save(); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); } @@ -583,7 +583,7 @@ void CParticleDlg::loadWorkspace(const std::string &fullPath) newPW->load(); setStatusBarText(CString(newPW->getFilename().c_str()) + " " + getStrRsc(IDS_LOADED)); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); @@ -633,7 +633,7 @@ void CParticleDlg::saveWorkspaceStructure() _PW->save(); setStatusBarText(CString(_PW->getFilename().c_str()) + " " + getStrRsc(IDS_SAVED)); } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { localizedMessageBox(*this, utf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); diff --git a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp index 9fb13f51c..c392b1481 100644 --- a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp @@ -1037,7 +1037,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA return false; } } - catch(NLMISC::EStream &e) + catch(const NLMISC::EStream &e) { MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); return TRUE; diff --git a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp index f46c0d7be..2db27bc35 100644 --- a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp @@ -107,7 +107,7 @@ void CSchemeBankDlg::OnSaveBank() iF.open(tStrToUtf8(fd.GetFileName())); iF.serial(SchemeManager); } - catch (std::exception &e) + catch (const std::exception &e) { std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what()); MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); @@ -134,7 +134,7 @@ void CSchemeBankDlg::OnLoadBank() iF.serial(sm); SchemeManager.swap(sm); } - catch (std::exception &e) + catch (const std::exception &e) { std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what()); MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); diff --git a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp index d3debfe98..f111a2e00 100644 --- a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp @@ -1310,7 +1310,7 @@ bool CSkeletonScaleDlg::saveSkelScaleInStream(NLMISC::IStream &f) sint32 ver= f.serialVersion(0); f.serialCont(boneScales); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { MessageBox(_T("Failed to save file!")); return false; @@ -1356,7 +1356,7 @@ bool CSkeletonScaleDlg::loadSkelScaleFromStream(NLMISC::IStream &f) // and update display refreshTextViews(); } - catch(NLMISC::EStream &) + catch(const NLMISC::EStream &) { MessageBox(_T("Failed to save file!")); return false; diff --git a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp index 44926dfce..4435896e8 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp @@ -234,7 +234,7 @@ void CSoundAnimView::save() { CSoundAnimManager::instance()->saveAnimation(anim, filename); } - catch (Exception& e) + catch (const Exception& e) { MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } diff --git a/code/nel/tools/3d/object_viewer/texture_chooser.cpp b/code/nel/tools/3d/object_viewer/texture_chooser.cpp index 982ef4a97..70cc151b0 100644 --- a/code/nel/tools/3d/object_viewer/texture_chooser.cpp +++ b/code/nel/tools/3d/object_viewer/texture_chooser.cpp @@ -192,7 +192,7 @@ void CTextureChooser::OnBrowseTexture() _Texture = tf; textureToBitmap(); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { MessageBox(utf8ToTStr(e.what()), _T("error loading texture")); } diff --git a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index 1abec80fb..e7e9c99c0 100644 --- a/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -93,7 +93,7 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : try{ m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); } - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { nlinfo( "Exception occurred during Mission Compiler LIGO startup: %s", e.what() ); }