Repository: xbmc/xbmc
File: xbmc/guilib/guiinfo/VideoGUIInfo.cpp (C++)

Code before:
        value = CURL(value).GetWithoutUserDetails();

        if (info.m_info == LISTITEM_FOLDERNAME)
        {
          URIUtils::RemoveSlashAtEnd(value);
          value = URIUtils::GetFileName(value);
        }
        return true;
      case LISTITEM_FILENAME_AND_PATH:
        if (VIDEO::IsVideoDb(*item))
          value = tag->m_strFileNameAndPath;
        else if (item->HasMusicInfoTag()) // special handling for music videos, which have both a videotag and a musictag
          break;
        else
          value = item->GetPath();

        value = CURL(value).GetWithoutUserDetails();
        return true;
      case LISTITEM_VIDEO_HDR_TYPE:
        value = tag->m_streamDetails.GetVideoHdrType();
        return true;
      case LISTITEM_LABEL:
      {
        //! @todo get rid of "videos with versions as folder" hack!

        // special casing for "show videos with multiple versions as folders", where the label
        // should be the video version, not the movie title.
        if (!item->HasVideoVersions())
          break;

        CGUIWindow* videoNav{
            CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_VIDEO_NAV)};
        if (videoNav && videoNav->GetProperty("VideoVersionsFolderView").asBoolean() &&
            videoNav->IsActive())
        {
          value = tag->GetAssetInfo().GetTitle();
          return true;
        }
        break;
      }
    }
  }

  switch (info.m_info)
  {
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // VIDEOPLAYER_*
    ///////////////////////////////////////////////////////////////////////////////////////////////
    case VIDEOPLAYER_PLAYLISTLEN:
      if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() == PLAYLIST::Id::TYPE_VIDEO)
      {

Review comment (performance):
@78andyp  One of those things I would have suggested to be changed before merge: Evaluate logically ANDed expressions always from cheap to expensive, CPU-clock wise. `value.find('%')  != std::string::npos` is far more expensive than `i < MAX_DECODE_PASSES`. First check i, then presence of '%', not the other way around. 

Code after:
        value = CURL(value).GetWithoutUserDetails();

        if (info.m_info == LISTITEM_FOLDERNAME)
        {
          URIUtils::RemoveSlashAtEnd(value);
          value = URIUtils::GetFileName(value);
        }
        return true;
      case LISTITEM_FILENAME_AND_PATH:
      case LISTITEM_DECODED_FILENAME_AND_PATH:
        if (VIDEO::IsVideoDb(*item))
          value = tag->m_strFileNameAndPath;
        else if (item->HasMusicInfoTag()) // special handling for music videos, which have both a videotag and a musictag
          break;
        else
          value = item->GetPath();

        value = CURL(value).GetWithoutUserDetails();

        // Decode path for readability
        // Loop up to MAX_DECODE_PASSES times as each call to CURL::Decode() decodes one 'layer'
        // ie. bluray://udf://smb:// would require 2 passes to make fully human-readable
        if (info.m_info == LISTITEM_DECODED_FILENAME_AND_PATH)
        {
          static constexpr unsigned int MAX_DECODE_PASSES = 5;
          for (unsigned int i = 0; value.find('%') != std::string::npos && i < MAX_DECODE_PASSES;
               ++i)
            value = CURL::Decode(value);
        }

        return true;
      case LISTITEM_VIDEO_HDR_TYPE:
        value = tag->m_streamDetails.GetVideoHdrType();
        return true;
      case LISTITEM_LABEL:
      {
        //! @todo get rid of "videos with versions as folder" hack!

        // special casing for "show videos with multiple versions as folders", where the label
        // should be the video version, not the movie title.
        if (!item->HasVideoVersions())
          break;

        CGUIWindow* videoNav{
            CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_VIDEO_NAV)};
        if (videoNav && videoNav->GetProperty("VideoVersionsFolderView").asBoolean() &&
            videoNav->IsActive())
        {
          value = tag->GetAssetInfo().GetTitle();
          return true;
        }