[vlc-devel] [PATCH 3/3] demux/adaptive: Catch all exceptions

Marvin Scholz epirat07 at gmail.com
Mon Oct 29 12:42:24 CET 2018


These catches look like they intend to catch all exceptions, not just
exceptions of integer type (which is not a common exception type).
For example all exceptions derived from std::exception would not be
caught by catch(int).
---
 modules/demux/adaptive/tools/Conversions.cpp | 2 +-
 modules/demux/adaptive/tools/Conversions.hpp | 2 +-
 modules/demux/adaptive/tools/Retrieve.cpp    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/adaptive/tools/Conversions.cpp b/modules/demux/adaptive/tools/Conversions.cpp
index e0e3764b20..92b6b99ef7 100644
--- a/modules/demux/adaptive/tools/Conversions.cpp
+++ b/modules/demux/adaptive/tools/Conversions.cpp
@@ -169,7 +169,7 @@ UTCTime::UTCTime(const std::string &str)
             // Failure parsing time string
             t = 0;
         }
-    } catch(int) {
+    } catch(...) {
         t = 0;
     }
 }
diff --git a/modules/demux/adaptive/tools/Conversions.hpp b/modules/demux/adaptive/tools/Conversions.hpp
index 4e4acee80a..1d95cfdf4e 100644
--- a/modules/demux/adaptive/tools/Conversions.hpp
+++ b/modules/demux/adaptive/tools/Conversions.hpp
@@ -57,7 +57,7 @@ template<typename T> class Integer
                 in >> value;
                 if (in.fail() || in.bad())
                     value = 0;
-            } catch (int) {
+            } catch (...) {
                 value = 0;
             }
         }
diff --git a/modules/demux/adaptive/tools/Retrieve.cpp b/modules/demux/adaptive/tools/Retrieve.cpp
index c14f2fcb94..a6171e5507 100644
--- a/modules/demux/adaptive/tools/Retrieve.cpp
+++ b/modules/demux/adaptive/tools/Retrieve.cpp
@@ -38,7 +38,7 @@ block_t * Retrieve::HTTP(vlc_object_t *obj, AuthStorage *auth, const std::string
     try
     {
         datachunk = new HTTPChunk(uri, &connManager, ID(), true);
-    } catch (int) {
+    } catch (...) {
         return NULL;
     }
 
-- 
2.17.1 (Apple Git-112)



More information about the vlc-devel mailing list