VirtualBox

Changeset 21810 in vbox for trunk/include


Ignore:
Timestamp:
Jul 27, 2009 1:01:15 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50418
Message:

IPRT: r=bird: RTZip - dunno if anything works after my changes because there isn't any testcase. Please add one.

  • Fixed numerous allocation related issues (missing checks for success and leaks).
  • RTTarList wouldn't set *pcFiles and *ppapszFiles if no files were found.
  • Don't pass pcbRead and pcbWritten to RTFileRead/Write if it is unacceptable to do partial reads and writes.
  • for (;;) instead of do while (0).
  • Always specify all three flag categories for RTFileOpen calls!
  • Adding > 4GB files to a tar file on 32-bit would fill up the disk.
  • Missing rc check in rtTarCheckheader when converting the checksum.
  • Don't override errors with VERR_FILE_IO_ERROR, VERR_FILE_NOT_FOUND or in one case VINF_SUCCESS.
  • Use RT_ZERO instead of memset.
  • Use Assert*Return for input validation. The if (bad) {AssertMsgFailed(); return failure; } style checking found around IPRT is from before the Assert*Return macro was added.
  • Added todos for inefficient 512 bytes at a time copying.
  • Added todos for interface renaming to conform with IPRT conventions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/tar.h

    r21784 r21810  
    4444 * Check if the specified file exists in the Tar archive.
    4545 *
     46 * (The matching is case sensitive.)
     47 *
     48 * @note    Currently only regular files are supported.
     49 *
    4650 * @returns iprt status code.
    47  * @retval VINF_SUCCESS when the file exists in the Tar archive
    48  * @retval VERR_FILE_NOT_FOUND when the file not exists in the Tar archive
    49  *
    50  * @note Currently only regular files are supported.
     51 * @retval  VINF_SUCCESS when the file exists in the Tar archive.
     52 * @retval  VERR_FILE_NOT_FOUND when the file not exists in the Tar archive.
    5153 *
    5254 * @param   pszTarFile      Tar file to check.
    5355 * @param   pszFile         Filename to check for.
     56 *
     57 * @todo    r=bird: rename to RTTarQueryFileExists (or bool RTTarFileExist).
    5458 */
    5559RTR3DECL(int) RTTarExists(const char *pszTarFile, const char *pszFile);
     
    5862 * Create a file list from a Tar archive.
    5963 *
     64 * @note    Currently only regular files are supported.
     65 *
    6066 * @returns iprt status code.
    6167 *
    62  * @note Currently only regular files are supported.
    63  *
    6468 * @param   pszTarFile      Tar file to list files from.
    65  * @param   ppapszFiles     On success the array with the filenames.
     69 * @param   ppapszFiles     On success an array with array with the filenames is
     70 *                          returned. The names must be freed with RTStrFree and
     71 *                          the array with RTMemFree.
    6672 * @param   pcFiles         On success the number of entries in ppapszFiles.
    6773 */
     
    7177 * Extract a set of files from a Tar archive.
    7278 *
    73  * The output directory has to exists. Also note that this function is atomic.
    74  * If an error occurs all previously extracted files will be deleted.
     79 * Also note that this function is atomic. If an error occurs all previously
     80 * extracted files will be deleted.
    7581 *
    76  * @note Currently only regular files are supported. Also some of the header
    77  * fields are not used (uid, gid, uname, gname, mtime).
     82 * (The matching is case sensitive.)
     83 *
     84 * @note    Currently only regular files are supported. Also some of the heade
     85 *          fields are not used (uid, gid, uname, gname, mtime).
    7886 *
    7987 * @returns iprt status code.
    8088 *
    8189 * @param   pszTarFile      Tar file to extract files from.
    82  * @param   pszOutputDir    Where to store the extracted files.
     90 * @param   pszOutputDir    Where to store the extracted files. Must exist.
    8391 * @param   papszFiles      Which files should be extracted.
    8492 * @param   cFiles          The number of files in papszFiles.
     93 *
     94 * @todo    r=bird: Rename to RTTarExtractFiles.
    8595 */
    8696RTR3DECL(int) RTTarExtract(const char *pszTarFile, const char *pszOutputDir, const char * const *papszFiles, size_t cFiles);
     
    8999 * Extract a file by index from a Tar archive.
    90100 *
    91  * The index is starting by zero. The output directory has to exists.
    92  *
    93  * @note Currently only regular files are supported. Also some of the header
    94  * fields are not used (uid, gid, uname, gname, mtime).
     101 * @note    Currently only regular files are supported. Also some of the header
     102 *          fields are not used (uid, gid, uname, gname, mtime).
    95103 *
    96104 * @returns iprt status code.
    97  * @retval VERR_FILE_NOT_FOUND when the index isn't valid
     105 * @retval  VERR_FILE_NOT_FOUND when the index isn't valid.
    98106 *
    99107 * @param   pszTarFile      Tar file to extract the file from.
    100  * @param   pszOutputDir    Where to store the extracted file.
    101  * @param   iIndex          Which file should be extracted.
    102  * @param   ppszFileName    On success the filename of the extracted file.
     108 * @param   pszOutputDir    Where to store the extracted file. Must exist.
     109 * @param   iIndex          Which file should be extracted, 0 based.
     110 * @param   ppszFileName    On success the filename of the extracted file. Must
     111 *                          be freed with RTStrFree.
     112 *
     113 * @todo    r=bird: Rename to RTTarExtractByIndex.
    103114 */
    104 RTR3DECL(int) RTTarExtractIndex(const char *pszTarFile, const char *pszOutputDir, size_t iIndex, char** ppszFileName);
     115RTR3DECL(int) RTTarExtractIndex(const char *pszTarFile, const char *pszOutputDir, size_t iIndex, char **ppszFileName);
    105116
    106117/**
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette