Repository: xbmc/xbmc
File: xbmc/Util.h (C/C++)

Code before:
  static std::string GetFrameworksPath(bool forPython = false);

  static bool CanBindPrivileged();
  static bool ValidatePort(int port);

  /*!
   * \brief Thread-safe random number generation
   */
  static int GetRandomNumber();

  static int64_t ConvertSecsToMilliSecs(double secs) { return static_cast<int64_t>(secs * 1000); }
  static double ConvertMilliSecsToSecs(int64_t offset) { return offset / 1000.0; }
  static int64_t ConvertMilliSecsToSecsInt(int64_t offset) { return offset / 1000; }
  static int64_t ConvertMilliSecsToSecsIntRounded(int64_t offset) { return ConvertMilliSecsToSecsInt(offset + 499); }

  /** \brief Copy files from the application bundle over to the user data directory in Application Support/Kodi.
  */
  static void CopyUserDataIfNeeded(const std::string& strPath,
                                   const std::string& file,
                                   const std::string& destname = "");

  /*!
   * \brief Delete a file with/without confirmation.
   *        Depends on confirmation flag in settings.
   */
  static bool FileDelWithConfirm(CFileItemPtr pItem);

#if !defined(TARGET_WINDOWS)
private:
  static unsigned int s_randomSeed;
#endif

  protected:
    /** \brief Retrieves the base path and the filename of a given video.
    *   \param[in]  videoPath The full path of the video file.
    *   \param[out] basePath The base path of the given video.
    *   \param[out] videoFileName The file name of the given video..
    */
    static void GetVideoBasePathAndFileName(const std::string& videoPath,
                                            std::string& basePath,
                                            std::string& videoFileName);

    /** \brief Retrieves FileItems that could contain associated files of a given video.
    *   \param[in]  videoPath The full path of the video file.
    *   \param[in]  item_exts A | separated string of extensions specifying the associated files.
    *   \param[in]  sub_dirs A vector of sub directory names to look for.
    *   \param[out] items A List of FileItems to scan for associated files.
    */
    static void GetItemsToScan(const std::string& videoPath,
                               const std::string& item_exts,
                               const std::vector<std::string>& sub_dirs,

Review comment (suggestion):
1) I think this function fits better into `CFileUtils`, not `CUtil`, please move it.
2) We are not short on letters. Please change function name to `DeleteWithConfirmation`
3) Change param type to `const std::shared_ptr<CFileItem>&`, please. by-ref instead by-value and use native type, not the typedef `CFileItemPtr`as we want to get rid of it.
4) Remove the type prefix `p` from variable name (coding convention for new code). => `item`

Code after:
  static std::string GetFrameworksPath(bool forPython = false);

  static bool CanBindPrivileged();
  static bool ValidatePort(int port);

  /*!
   * \brief Thread-safe random number generation
   */
  static int GetRandomNumber();

  static int64_t ConvertSecsToMilliSecs(double secs) { return static_cast<int64_t>(secs * 1000); }
  static double ConvertMilliSecsToSecs(int64_t offset) { return offset / 1000.0; }
  static int64_t ConvertMilliSecsToSecsInt(int64_t offset) { return offset / 1000; }
  static int64_t ConvertMilliSecsToSecsIntRounded(int64_t offset) { return ConvertMilliSecsToSecsInt(offset + 499); }

  /** \brief Copy files from the application bundle over to the user data directory in Application Support/Kodi.
  */
  static void CopyUserDataIfNeeded(const std::string& strPath,
                                   const std::string& file,
                                   const std::string& destname = "");

#if !defined(TARGET_WINDOWS)
private:
  static unsigned int s_randomSeed;
#endif

  protected:
    /** \brief Retrieves the base path and the filename of a given video.
    *   \param[in]  videoPath The full path of the video file.
    *   \param[out] basePath The base path of the given video.
    *   \param[out] videoFileName The file name of the given video..
    */
    static void GetVideoBasePathAndFileName(const std::string& videoPath,
                                            std::string& basePath,
                                            std::string& videoFileName);

    /** \brief Retrieves FileItems that could contain associated files of a given video.
    *   \param[in]  videoPath The full path of the video file.
    *   \param[in]  item_exts A | separated string of extensions specifying the associated files.
    *   \param[in]  sub_dirs A vector of sub directory names to look for.
    *   \param[out] items A List of FileItems to scan for associated files.
    */
    static void GetItemsToScan(const std::string& videoPath,
                               const std::string& item_exts,
                               const std::vector<std::string>& sub_dirs,
                               CFileItemList& items);

    /** \brief Searches for associated files of a given video.
    *   \param[in]  videoName The name of the video file.
    *   \param[in]  items A List of FileItems to scan for associated files.
    *   \param[in]  item_exts A vector of extensions specifying the associated files.