VirtualBox

Ignore:
Timestamp:
Apr 18, 2017 3:27:30 PM (8 years ago)
Author:
vboxsync
Message:

IPRT/vfs-chains: Pass around an pErrInfo buffer too.

Location:
trunk/src/VBox/Runtime/common/zip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp

    r66601 r66602  
    835835 */
    836836static DECLCALLBACK(int) rtVfsChainGunzip_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec,
    837                                                    PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError)
    838 {
    839     RT_NOREF(pProviderReg, poffError);
     837                                                   PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo)
     838{
     839    RT_NOREF(pProviderReg, poffError, pErrInfo);
    840840
    841841    if (pElement->enmType != RTVFSOBJTYPE_IO_STREAM)
     
    860860static DECLCALLBACK(int) rtVfsChainGunzip_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec,
    861861                                                      PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj,
    862                                                       PRTVFSOBJ phVfsObj, uint32_t *poffError)
    863 {
    864     RT_NOREF(pProviderReg, pSpec, pElement, poffError);
     862                                                      PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo)
     863{
     864    RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo);
    865865    AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE);
    866866
     
    918918 */
    919919static DECLCALLBACK(int) rtVfsChainGzip_Validate(PCRTVFSCHAINELEMENTREG pProviderReg, PRTVFSCHAINSPEC pSpec,
    920                                                  PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError)
     920                                                 PRTVFSCHAINELEMSPEC pElement, uint32_t *poffError, PRTERRINFO pErrInfo)
    921921{
    922922    RT_NOREF(pProviderReg);
     
    955955        {
    956956            *poffError = pElement->paArgs[0].offSpec;
    957             return VERR_VFS_CHAIN_INVALID_ARGUMENT;
     957            return RTErrInfoSet(pErrInfo, VERR_VFS_CHAIN_INVALID_ARGUMENT, "Expected compression level: 1-9, default, or fast");
    958958        }
    959959    }
     
    970970static DECLCALLBACK(int) rtVfsChainGzip_Instantiate(PCRTVFSCHAINELEMENTREG pProviderReg, PCRTVFSCHAINSPEC pSpec,
    971971                                                    PCRTVFSCHAINELEMSPEC pElement, RTVFSOBJ hPrevVfsObj,
    972                                                     PRTVFSOBJ phVfsObj, uint32_t *poffError)
    973 {
    974     RT_NOREF(pProviderReg, pSpec, pElement, poffError);
     972                                                    PRTVFSOBJ phVfsObj, uint32_t *poffError, PRTERRINFO pErrInfo)
     973{
     974    RT_NOREF(pProviderReg, pSpec, pElement, poffError, pErrInfo);
    975975    AssertReturn(hPrevVfsObj != NIL_RTVFSOBJ, VERR_VFS_CHAIN_IPE);
    976976
  • trunk/src/VBox/Runtime/common/zip/tarcmd.cpp

    r65559 r66602  
    195195        && strcmp(pOpts->pszFile, "-") != 0)
    196196    {
    197         const char *pszError;
    198         rc = RTVfsChainOpenIoStream(pOpts->pszFile,
    199                                     RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN,
    200                                     &hVfsIos,
    201                                     &pszError);
     197        uint32_t        offError = 0;
     198        RTERRINFOSTATIC ErrInfo;
     199        rc = RTVfsChainOpenIoStream(pOpts->pszFile, RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN,
     200                                    &hVfsIos, &offError, RTErrInfoInitStatic(&ErrInfo));
    202201        if (RT_FAILURE(rc))
    203         {
    204             if (pszError && *pszError)
    205                 return RTMsgErrorExit(RTEXITCODE_FAILURE,
    206                                       "RTVfsChainOpenIoStream failed with rc=%Rrc:\n"
    207                                       "    '%s'\n"
    208                                       "     %*s^\n",
    209                                       rc, pOpts->pszFile, pszError - pOpts->pszFile, "");
    210             return RTMsgErrorExit(RTEXITCODE_FAILURE,
    211                                   "Failed with %Rrc opening the input archive '%s'", rc, pOpts->pszFile);
    212         }
     202            return RTVfsChainMsgErrorExitFailure("RTVfsChainOpenIoStream", pOpts->pszFile, rc, offError, &ErrInfo.Core);
    213203    }
    214204    else
  • trunk/src/VBox/Runtime/common/zip/unzipcmd.cpp

    r62564 r66602  
    256256     * Open the input file.
    257257     */
    258     RTVFSIOSTREAM hVfsIos;
    259     const char    *pszError;
    260     int rc = RTVfsChainOpenIoStream(pOpts->pszFile,
    261                                     RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN,
    262                                     &hVfsIos,
    263                                     &pszError);
    264     if (RT_FAILURE(rc))
    265     {
    266         if (pszError && *pszError)
    267             return RTMsgErrorExit(RTEXITCODE_FAILURE,
    268                                   "RTVfsChainOpenIoStream failed with rc=%Rrc:\n"
    269                                   "    '%s'\n"
    270                                   "     %*s^\n",
    271                                   rc, pOpts->pszFile, pszError - pOpts->pszFile, "");
    272         return RTMsgErrorExit(RTEXITCODE_FAILURE,
    273                               "Failed with %Rrc opening the input archive '%s'", rc, pOpts->pszFile);
    274     }
     258    RTVFSIOSTREAM   hVfsIos;
     259    uint32_t        offError = 0;
     260    RTERRINFOSTATIC ErrInfo;
     261    int rc = RTVfsChainOpenIoStream(pOpts->pszFile, RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN,
     262                                    &hVfsIos, &offError, RTErrInfoInitStatic(&ErrInfo));
     263    if (RT_FAILURE(rc))
     264        return RTVfsChainMsgErrorExitFailure("RTVfsChainOpenIoStream", pOpts->pszFile, rc, offError, &ErrInfo.Core);
    275265
    276266    rc = RTZipPkzipFsStreamFromIoStream(hVfsIos, 0 /*fFlags*/, phVfsFss);
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