[vlc-devel] [medialibrary PATCH] Fix compilation error

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Dec 27 09:40:09 CET 2018


On Wed, Dec 26, 2018, at 4:12 AM, Zhao Zhili wrote:
> Until C++17, a function could not return a tuple using
> list-initialization.
> 
> g++ (Debian 6.3.0-18) has no problem with -std=c++11.
> g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) failed with:
> 
> ../src/filesystem/common/CommonDevice.cpp:85:30: error: converting to 
> ‘std::tuple<bool, std::__cxx11::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > >’ from initializer list 
> would use explicit constructor ‘constexpr std::tuple<_T1, 
> _T2>::tuple(_U1&&, _U2&&) [with _U1 = bool; _U2 = const 
> std::__cxx11::basic_string<char>&; <template-parameter-2-3> = void; _T1 
> = bool; _T2 = std::__cxx11::basic_string<char>]’
>              return { true, m };
> ---
> Feel free to simplify the commit message.
> 
>  src/filesystem/common/CommonDevice.cpp   | 4 ++--
>  src/metadata_services/MetadataParser.cpp | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/filesystem/common/CommonDevice.cpp b/src/filesystem/
> common/CommonDevice.cpp
> index b1b3859..b37a557 100644
> --- a/src/filesystem/common/CommonDevice.cpp
> +++ b/src/filesystem/common/CommonDevice.cpp
> @@ -82,9 +82,9 @@ CommonDevice::matchesMountpoint( const std::string& 
> mrl ) const
>      for ( const auto& m : m_mountpoints )
>      {
>          if ( mrl.find( m ) == 0 )
> -            return { true, m };
> +            return std::make_tuple( true, m );
>      }
> -    return { false, "" };
> +    return std::make_tuple( false, "" );
>  }
>  
>  std::string CommonDevice::relativeMrl( const std::string& absoluteMrl ) 
> const
> diff --git a/src/metadata_services/MetadataParser.cpp b/src/
> metadata_services/MetadataParser.cpp
> index 43f6365..def2a3c 100644
> --- a/src/metadata_services/MetadataParser.cpp
> +++ b/src/metadata_services/MetadataParser.cpp
> @@ -517,11 +517,11 @@ std::tuple<bool, bool> 
> MetadataAnalyzer::refreshFile( IItem& item ) const
>              {
>                  LOG_WARN( "Failed to find playlist associated to 
> modified playlist file ",
>                            item.mrl() );
> -                return { false, false };
> +                return std::make_tuple( false, false );
>              }
>              LOG_INFO( "Reloading playlist ", playlist->name(), " on ", 
> item.mrl() );
>              Playlist::destroy( m_ml, playlist->id() );
> -            return { true, true };
> +            return std::make_tuple( true, true );
>          }
>          case IFile::Type::Part:
>          case IFile::Type::Soundtrack:
> @@ -533,7 +533,7 @@ std::tuple<bool, bool> 
> MetadataAnalyzer::refreshFile( IItem& item ) const
>      LOG_WARN( "Refreshing of file type ",
>                
> static_cast<std::underlying_type<IFile::Type>::type>( file->type() ),
>                " is unsupported" );
> -    return { false, false };
> +    return std::make_tuple( false, false );
>  }
>  
>  std::tuple<bool, bool> MetadataAnalyzer::refreshMedia( IItem& item ) const
> -- 
> 2.9.5
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

Merged, thanks!

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list