From 25b522589ddfd5e78d261d2c3fba12b06364682f Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 3 Jul 2019 12:58:02 -0400 Subject: [PATCH] Always catch-by-reference in C++11 --- src/CacheDisk.cpp | 2 +- src/CacheMemory.cpp | 2 +- src/ChunkReader.cpp | 6 +++--- src/Clip.cpp | 4 ++-- src/Color.cpp | 2 +- src/Coordinate.cpp | 2 +- src/DecklinkReader.cpp | 2 +- src/DummyReader.cpp | 2 +- src/EffectBase.cpp | 2 +- src/FFmpegReader.cpp | 2 +- src/FrameMapper.cpp | 2 +- src/ImageReader.cpp | 4 ++-- src/KeyFrame.cpp | 4 ++-- src/Point.cpp | 2 +- src/Profiles.cpp | 4 ++-- src/QtImageReader.cpp | 2 +- src/TextReader.cpp | 2 +- src/Timeline.cpp | 4 ++-- src/WriterBase.cpp | 2 +- 19 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/CacheDisk.cpp b/src/CacheDisk.cpp index 4d446746..7d71e100 100644 --- a/src/CacheDisk.cpp +++ b/src/CacheDisk.cpp @@ -522,7 +522,7 @@ void CacheDisk::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/CacheMemory.cpp b/src/CacheMemory.cpp index 4de6bb1f..790f3f98 100644 --- a/src/CacheMemory.cpp +++ b/src/CacheMemory.cpp @@ -377,7 +377,7 @@ void CacheMemory::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/ChunkReader.cpp b/src/ChunkReader.cpp index 8d5b466e..97ab0797 100644 --- a/src/ChunkReader.cpp +++ b/src/ChunkReader.cpp @@ -121,7 +121,7 @@ void ChunkReader::load_json() info.audio_timebase.den = root["audio_timebase"]["den"].asInt(); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON could not be parsed (or is invalid).", path); @@ -235,7 +235,7 @@ std::shared_ptr ChunkReader::GetFrame(int64_t requested_frame) local_reader = new FFmpegReader(chunk_video_path); local_reader->Open(); // open reader - } catch (InvalidFile) + } catch (const InvalidFile& e) { // Invalid Chunk (possibly it is not found) throw ChunkNotFound(path, requested_frame, location.number, location.frame); @@ -298,7 +298,7 @@ void ChunkReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Clip.cpp b/src/Clip.cpp index bddcd0c9..93a246af 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -123,7 +123,7 @@ void Clip::init_reader_rotation() { try { float rotate_metadata = strtof(reader->info.metadata["rotate"].c_str(), 0); rotation = Keyframe(rotate_metadata); - } catch (exception e) {} + } catch (const std::exception& e) {} } else // Default no rotation @@ -809,7 +809,7 @@ void Clip::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Color.cpp b/src/Color.cpp index 21c3f146..932d31f4 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -125,7 +125,7 @@ void Color::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Coordinate.cpp b/src/Coordinate.cpp index 5baeb5bf..2f2dbaa6 100644 --- a/src/Coordinate.cpp +++ b/src/Coordinate.cpp @@ -88,7 +88,7 @@ void Coordinate::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/DecklinkReader.cpp b/src/DecklinkReader.cpp index 230a6689..b9464301 100644 --- a/src/DecklinkReader.cpp +++ b/src/DecklinkReader.cpp @@ -283,7 +283,7 @@ void DecklinkReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/DummyReader.cpp b/src/DummyReader.cpp index aa1e6a56..28b8f2b0 100644 --- a/src/DummyReader.cpp +++ b/src/DummyReader.cpp @@ -161,7 +161,7 @@ void DummyReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/EffectBase.cpp b/src/EffectBase.cpp index 9bf30986..d6cee206 100644 --- a/src/EffectBase.cpp +++ b/src/EffectBase.cpp @@ -117,7 +117,7 @@ void EffectBase::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 10d89051..044fb580 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -2439,7 +2439,7 @@ void FFmpegReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) { + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); } diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index 1f6b7629..3be9f812 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -712,7 +712,7 @@ void FrameMapper::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/ImageReader.cpp b/src/ImageReader.cpp index 62439d82..31afd179 100644 --- a/src/ImageReader.cpp +++ b/src/ImageReader.cpp @@ -67,7 +67,7 @@ void ImageReader::Open() image->backgroundColor(Magick::Color("none")); MAGICK_IMAGE_ALPHA(image, true); } - catch (Magick::Exception e) { + catch (const Magick::Exception& e) { // raise exception throw InvalidFile("File could not be opened.", path); } @@ -174,7 +174,7 @@ void ImageReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 31393d17..75b2c739 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -200,7 +200,7 @@ Point Keyframe::GetPreviousPoint(Point p) { else return Points[0]; - } catch (OutOfBoundsPoint) { + } catch (const OutOfBoundsPoint& e) { // No previous point return Point(-1, -1); } @@ -384,7 +384,7 @@ void Keyframe::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Point.cpp b/src/Point.cpp index b0e85658..8d29b2ac 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -151,7 +151,7 @@ void Point::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Profiles.cpp b/src/Profiles.cpp index 9c2b3014..7d3bbb45 100644 --- a/src/Profiles.cpp +++ b/src/Profiles.cpp @@ -120,7 +120,7 @@ Profile::Profile(string path) { } } - catch (exception e) + catch (const std::exception& e) { // Error parsing profile file throw InvalidFile("Profile could not be found or loaded (or is invalid).", path); @@ -182,7 +182,7 @@ void Profile::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/QtImageReader.cpp b/src/QtImageReader.cpp index bd1c4bc8..b8e17160 100644 --- a/src/QtImageReader.cpp +++ b/src/QtImageReader.cpp @@ -304,7 +304,7 @@ void QtImageReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/TextReader.cpp b/src/TextReader.cpp index 9c664535..b714fb97 100644 --- a/src/TextReader.cpp +++ b/src/TextReader.cpp @@ -235,7 +235,7 @@ void TextReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 7636de7d..359901ac 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -1045,7 +1045,7 @@ void Timeline::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); @@ -1160,7 +1160,7 @@ void Timeline::ApplyJsonDiff(string value) { } } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/WriterBase.cpp b/src/WriterBase.cpp index bc16e7e0..71705529 100644 --- a/src/WriterBase.cpp +++ b/src/WriterBase.cpp @@ -214,7 +214,7 @@ void WriterBase::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", "");