VirtualBox

Changeset 78090 in vbox


Ignore:
Timestamp:
Apr 10, 2019 2:19:04 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129946
Message:

*,IPRT: Use new RTPathAbsExEx function instead of RTPathAbsEx. bugref:9172

Location:
trunk/src/VBox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/vbsfpathabs.cpp

    r76553 r78090  
    9797{
    9898#if defined(RT_OS_WINDOWS)
     99    /** @todo This code is not needed in 6.0 and later as IPRT translates paths
     100     *        to \\.\ format if they're too long.  */
    99101    const char *pszPathStart = pszRoot? pszRoot: pszPath;
    100102
     
    182184
    183185    /* Fallback for the common paths. */
    184     return RTPathAbsEx(pszRoot, pszPath, pszAbsPath, cbAbsPath);
     186
     187    return RTPathAbsExEx(pszRoot, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbAbsPath);
    185188}
  • trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp

    r76592 r78090  
    283283        /* Check whether the path is full (absolute) */
    284284        char hostPathFull[RTPATH_MAX];
    285         int vrc = RTPathAbsEx(NULL,
    286                               hostPath.c_str(),
    287                               hostPathFull,
    288                               sizeof (hostPathFull));
     285        int vrc = RTPathAbs(hostPath.c_str(),
     286                            hostPathFull,
     287                            sizeof(hostPathFull));
    289288        if (RT_FAILURE(vrc))
    290289            return setErrorBoth(E_INVALIDARG, vrc, tr("Invalid shared folder path: '%s' (%Rrc)"), hostPath.c_str(), vrc);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r77910 r78090  
    86648664     */
    86658665    char szAbsHostPath[RTPATH_MAX];
    8666     int vrc = RTPathAbsEx(NULL, aData.m_strHostPath.c_str(), szAbsHostPath, sizeof(szAbsHostPath));
     8666    int vrc = RTPathAbs(aData.m_strHostPath.c_str(), szAbsHostPath, sizeof(szAbsHostPath));
    86678667    if (RT_FAILURE(vrc))
    86688668        return setErrorBoth(E_INVALIDARG, vrc, tr("Invalid shared folder path: '%s' (%Rrc)"), aData.m_strHostPath.c_str(), vrc);
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r78072 r78090  
    72587258
    72597259    strSettingsDir.stripFilename();
    7260     char folder[RTPATH_MAX];
    7261     int vrc = RTPathAbsEx(strSettingsDir.c_str(), strPath.c_str(), folder, sizeof(folder));
     7260    char szFolder[RTPATH_MAX];
     7261    size_t cbFolder = sizeof(szFolder);
     7262    int vrc = RTPathAbsExEx(strSettingsDir.c_str(), strPath.c_str(), RTPATH_STR_F_STYLE_HOST, szFolder, &cbFolder);
    72627263    if (RT_SUCCESS(vrc))
    7263         aResult = folder;
     7264        aResult = szFolder;
    72647265
    72657266    return vrc;
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r77436 r78090  
    40104010    AssertComRCReturn(autoCaller.rc(), VERR_GENERAL_FAILURE);
    40114011
    4012     /* no need to lock since mHomeDir is const */
    4013 
    4014     char folder[RTPATH_MAX];
    4015     int vrc = RTPathAbsEx(m->strHomeDir.c_str(),
    4016                           strPath.c_str(),
    4017                           folder,
    4018                           sizeof(folder));
     4012    /* no need to lock since strHomeDir is const */
     4013
     4014    char szFolder[RTPATH_MAX];
     4015    size_t cbFolder = sizeof(szFolder);
     4016    int vrc = RTPathAbsExEx(m->strHomeDir.c_str(),
     4017                            strPath.c_str(),
     4018                            RTPATH_STR_F_STYLE_HOST,
     4019                            szFolder,
     4020                            &cbFolder);
    40194021    if (RT_SUCCESS(vrc))
    4020         aResult = folder;
     4022        aResult = szFolder;
    40214023
    40224024    return vrc;
  • trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp

    r78048 r78090  
    5353RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, char *pszAbsPath, size_t cbAbsPath)
    5454{
    55 #if 1
     55#if 0
    5656    if (    pszBase
    5757        &&  pszPath
  • trunk/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp

    r76553 r78090  
    5050{
    5151    char szPath[RTPATH_MAX];
    52     int rc = RTPathAbsEx(pszBase, pszPath, szPath, sizeof(szPath));
     52    size_t cbPath = sizeof(szPath);
     53    int rc = RTPathAbsExEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, szPath, &cbPath);
    5354    if (RT_SUCCESS(rc))
    5455        return RTStrDup(szPath);
     56
     57    if (rc == VERR_BUFFER_OVERFLOW)
     58    {
     59        size_t   cbPrevPath = sizeof(szPath);
     60        uint32_t cTries = 6;
     61        while (cTries-- > 0)
     62        {
     63            cbPath     = RT_MAX(RT_ALIGN_Z(cbPath + 16, 64), cbPrevPath + 256);
     64            cbPrevPath = cbPath;
     65            char *pszAbsPath = (char *)RTStrAlloc(cbPath);
     66            if (pszAbsPath)
     67            {
     68                rc = RTPathAbsExEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbPath);
     69                if (RT_SUCCESS(rc))
     70                    return pszAbsPath;
     71                RTStrFree(pszAbsPath);
     72            }
     73            else
     74                break;
     75        }
     76    }
    5577    return NULL;
    5678}
  • trunk/src/VBox/Runtime/generic/RTPathAbs-generic.cpp

    r78048 r78090  
    4040#include "internal/fs.h"
    4141
    42 #if 1
     42#if 0
    4343
    4444static char *rtPathSkipRootSpec(char *pszCur)
  • trunk/src/VBox/Runtime/r3/generic/dirrel-r3-generic.cpp

    r76553 r78090  
    8484     * This ASSUMES that pThis->pszPath is an absolute path.
    8585     */
    86     int rc = RTPathAbsEx(pThis->pszPath, pszRelPath, pszPathDst, cbPathDst);
     86    int rc = RTPathAbsExEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
    8787    if (RT_SUCCESS(rc))
    8888    {
  • trunk/src/VBox/Runtime/r3/nt/dirrel-r3-nt.cpp

    r76553 r78090  
    9595     * This ASSUMES that pThis->pszPath is an absolute path.
    9696     */
    97     int rc = RTPathAbsEx(pThis->pszPath, pszRelPath, pszPathDst, cbPathDst);
     97    int rc = RTPathAbsExEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
    9898    if (RT_SUCCESS(rc))
    9999    {
  • trunk/src/VBox/Runtime/testcase/tstRTPath.cpp

    r78048 r78090  
    267267
    268268
     269#if 0
    269270    /*
    270271     * RTPathAbsEx
     
    398399        }
    399400    }
     401#endif
    400402
    401403    /*
Note: See TracChangeset for help on using the changeset viewer.

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