Repository: xbmc/xbmc
File: xbmc/filesystem/IFile.h (C/C++)

Code before:
#include <limits.h>
#ifndef SIZE_MAX
#define SIZE_MAX UINTPTR_MAX
#endif // ! SIZE_MAX
#ifndef SSIZE_MAX
#define SSIZE_MAX INTPTR_MAX
#endif // ! SSIZE_MAX
#endif // ! SIZE_MAX || ! SSIZE_MAX

#include "IFileTypes.h"

class CURL;

namespace XFILE
{

class IFile
{
public:
  IFile();
  virtual ~IFile();

  virtual bool Open(const CURL& url) = 0;
  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false) { return false; }
  virtual bool ReOpen(const CURL& url) { return false; }
  virtual bool Exists(const CURL& url) { return false; }
  /*!
   * \brief Fills struct __stat64 with information about file specified by url.
   *
   * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
   * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
   * information is available. Function may set st_size (file size), st_atime,
   * st_mtime, st_ctime (access, modification, creation times).
   * Any other flags and members of __stat64 that didn't updated with actual file
   * information will be set to zero (st_nlink can be set ether to 1 or zero).
   *
   * \param[in] url specifies requested file. Ends with a directory separator for directories.
   * \param[out] buffer pointer to __stat64 buffer to receive information about file
   * \return zero for success, -1 otherwise.
   */
  virtual int Stat(const CURL& url, struct __stat64* buffer) = 0;
  /**
  * Fills struct __stat64 with information about currently open file
  * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
  * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
  * information is available. Function may set st_size (file size), st_atime,
  * st_mtime, st_ctime (access, modification, creation times).
  * Any other flags and members of __stat64 that didn't updated with actual file
  * information will be set to zero (st_nlink can be set ether to 1 or zero).
  * @param buffer      pointer to __stat64 buffer to receive information about file
  * @return zero of success, -1 otherwise.

Review comment (suggestion):
Can this change be avoided? We shouldn't need to update the interface, as that affects like 50 implementations.

Code after:
#include <limits.h>
#ifndef SIZE_MAX
#define SIZE_MAX UINTPTR_MAX
#endif // ! SIZE_MAX
#ifndef SSIZE_MAX
#define SSIZE_MAX INTPTR_MAX
#endif // ! SSIZE_MAX
#endif // ! SIZE_MAX || ! SSIZE_MAX

#include "IFileTypes.h"

class CURL;

namespace XFILE
{

class IFile
{
public:
  IFile();
  virtual ~IFile();

  virtual bool Open(const CURL& url) = 0;
  virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false) { return false; }
  virtual bool ReOpen(const CURL& url) { return false; }
  virtual bool Exists(const CURL& url) = 0;
  /*!
   * \brief Fills struct __stat64 with information about file specified by url.
   *
   * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
   * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
   * information is available. Function may set st_size (file size), st_atime,
   * st_mtime, st_ctime (access, modification, creation times).
   * Any other flags and members of __stat64 that didn't updated with actual file
   * information will be set to zero (st_nlink can be set ether to 1 or zero).
   *
   * \param[in] url specifies requested file. Ends with a directory separator for directories.
   * \param[out] buffer pointer to __stat64 buffer to receive information about file
   * \return zero for success, -1 otherwise.
   */
  virtual int Stat(const CURL& url, struct __stat64* buffer) = 0;
  /**
  * Fills struct __stat64 with information about currently open file
  * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
  * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
  * information is available. Function may set st_size (file size), st_atime,
  * st_mtime, st_ctime (access, modification, creation times).
  * Any other flags and members of __stat64 that didn't updated with actual file
  * information will be set to zero (st_nlink can be set ether to 1 or zero).
  * @param buffer      pointer to __stat64 buffer to receive information about file
  * @return zero of success, -1 otherwise.