VirtualBox

Ignore:
Timestamp:
Apr 10, 2019 3:51:59 PM (6 years ago)
Author:
vboxsync
Message:

IPRT,*: Cleaning up RTPathAbsExEx, renaming it to RTPathAbsEx and removing dead code. bugref:9172

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp

    r78097 r78098  
    11/* $Id$ */
    22/** @file
    3  * IPRT - RTPathAbsExEx
     3 * IPRT - RTPathAbsEx and RTPathAbs.
    44 */
    55
     
    4444 * Ensures that the drive letter is capitalized (prereq: RTPATH_PROP_VOLUME).
    4545 */
    46 DECLINLINE(void) rtPathAbsExExUpperCaseDriveLetter(char *pszAbsPath)
     46DECLINLINE(void) rtPathAbsExUpperCaseDriveLetter(char *pszAbsPath)
    4747{
    4848    AssertReturnVoid(pszAbsPath[1] == ':');
     
    5858 * Uses RTPATHABS_F_STOP_AT_BASE for RTPATHABS_F_STOP_AT_CWD.
    5959 */
    60 static int rtPathAbsExExWithCwdOrBaseCommon(const char *pszBase, size_t cchBaseInPlace, PRTPATHPARSED pBaseParsed,
    61                                             const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
    62                                             char *pszAbsPath, size_t *pcbAbsPath)
     60static int rtPathAbsExWithCwdOrBaseCommon(const char *pszBase, size_t cchBaseInPlace, PRTPATHPARSED pBaseParsed,
     61                                          const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
     62                                          char *pszAbsPath, size_t *pcbAbsPath)
    6363{
    6464    AssertReturn(pBaseParsed->cComps > 0, VERR_INVALID_PARAMETER);
     
    199199    {
    200200        if (pBaseParsed->fProps & RTPATH_PROP_VOLUME)
    201             rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     201            rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    202202
    203203        cchBaseInPlace = pBaseParsed->cchPath;
     
    232232 * Handles the no-root-path scenario where we do CWD prefixing.
    233233 */
    234 static int rtPathAbsExExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     234static int rtPathAbsExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    235235{
    236236    /*
     
    313313    else
    314314        fFlags &= ~RTPATHABS_F_STOP_AT_BASE;
    315     rc = rtPathAbsExExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     315    rc = rtPathAbsExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    316316    if (pCwdParsedFree)
    317317        RTMemTmpFree(pCwdParsedFree);
     
    325325 * Handles the no-root-path scenario where we've got a base path.
    326326 */
    327 static int rtPathAbsExExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
    328                                  char *pszAbsPath, size_t *pcbAbsPath)
     327static int rtPathAbsExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
     328                               char *pszAbsPath, size_t *pcbAbsPath)
    329329{
    330330    /*
     
    362362    {
    363363        cchInPlace = *pcbAbsPath;
    364         rc = RTPathAbsExEx(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace);
     364        rc = RTPathAbsEx(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace);
    365365        if (RT_SUCCESS(rc))
    366366        {
     
    400400     * Join paths with the CWD code.
    401401     */
    402     rc = rtPathAbsExExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed,
    403                                           pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     402    rc = rtPathAbsExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed,
     403                                        pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    404404    if (pBaseParsedFree)
    405405        RTMemTmpFree(pBaseParsedFree);
     
    411411 * Handles the RTPATH_PROP_ROOT_SLASH case.
    412412 */
    413 static int rtPathAbsExExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed,
    414                                   uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     413static int rtPathAbsExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed,
     414                                uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    415415{
    416416    /*
     
    482482                    return VERR_BUFFER_OVERFLOW;
    483483                }
    484                 rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     484                rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    485485            }
    486486            else if (uBase.Parsed.fProps & RTPATH_PROP_UNC)
     
    560560 * Handles the RTPATH_PROP_ABSOLUTE case.
    561561 */
    562 static int rtPathAbsExExAbsolute(const char *pszPath, PRTPATHPARSED pParsed,
    563                                  uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     562static int rtPathAbsExAbsolute(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    564563{
    565564    if (pParsed->fProps & RTPATH_PROP_DOT_REFS)
     
    574573    *pcbAbsPath = pParsed->cchPath + (rc == VERR_BUFFER_OVERFLOW);
    575574    if (RT_SUCCESS(rc) && (pParsed->fProps & RTPATH_PROP_VOLUME))
    576         rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     575        rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    577576    return rc;
    578577}
    579578
    580579
    581 RTDECL(int) RTPathAbsExEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     580RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    582581{
    583582    /*
     
    624623     */
    625624    if (pParsed->fProps & RTPATH_PROP_ABSOLUTE)
    626         rc = rtPathAbsExExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     625        rc = rtPathAbsExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    627626    /*
    628627     * What about relative but with a root slash.
    629628     */
    630629    else if (pParsed->fProps & RTPATH_PROP_ROOT_SLASH)
    631         rc = rtPathAbsExExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     630        rc = rtPathAbsExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    632631    /*
    633632     * Not exactly perfect.  No root slash.
     
    646645                )
    647646            )
    648         rc = rtPathAbsExExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    649     else
    650         rc = rtPathAbsExExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     647        rc = rtPathAbsExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     648    else
     649        rc = rtPathAbsExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    651650
    652651    if (pParsedFree)
     
    655654}
    656655
     656
     657RTDECL(int) RTPathAbs(const char *pszPath, char *pszAbsPath, size_t cbAbsPath)
     658{
     659    return RTPathAbsEx(NULL, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbAbsPath);
     660}
     661
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