[vlc-commits] [Git][videolan/vlc][master] 3 commits: cxx_helpers: url: Mark constructors as explicit

Jean-Baptiste Kempf gitlab at videolan.org
Wed May 19 20:35:20 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
43687100 by Hugo Beauzée-Luyssen at 2021-05-19T20:22:32+00:00
cxx_helpers: url: Mark constructors as explicit

- - - - -
41bea794 by Hugo Beauzée-Luyssen at 2021-05-19T20:22:32+00:00
cxx_helpers: url: Fix leak on error

- - - - -
79b0d4b2 by Hugo Beauzée-Luyssen at 2021-05-19T20:22:32+00:00
cxx_helpers: url: Fix leak on move assignment

- - - - -


1 changed file:

- include/vlc_cxx_helpers.hpp


Changes:

=====================================
include/vlc_cxx_helpers.hpp
=====================================
@@ -407,7 +407,7 @@ public:
     class invalid : public std::runtime_error
     {
     public:
-        invalid( const char* url )
+        explicit invalid( const char* url )
             : std::runtime_error( std::string{ "Invalid url: " } + url )
         {
         }
@@ -420,13 +420,16 @@ public:
         psz_host = nullptr;
     }
 
-    url( const char* str )
+    explicit url( const char* str )
     {
         if ( vlc_UrlParse( this, str ) )
+        {
+            vlc_UrlClean( this );
             throw invalid( str );
+        }
     }
 
-    url( const std::string& str )
+    explicit url( const std::string& str )
         : url( str.c_str() )
     {
     }
@@ -449,6 +452,7 @@ public:
 
     url& operator=( url&& u ) noexcept
     {
+        vlc_UrlClean( this );
         *(static_cast<vlc_url_t*>( this )) = u;
         u.psz_buffer = nullptr;
         u.psz_pathbuffer = nullptr;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4ae85635e5998d1b386b834ad22586e807d60969...79b0d4b284e1eda210f8753d9d88c8c2dafd9e4d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4ae85635e5998d1b386b834ad22586e807d60969...79b0d4b284e1eda210f8753d9d88c8c2dafd9e4d
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list