VirtualBox

Changeset 45391 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Apr 7, 2013 5:15:29 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84816
Message:

IPRT: Changed the RTPATHPARSE_FLAGS_ into generic ones as they will be shared with RTPathSplit*. Introduced a new character called RTPATH_STYLE with can have two values (currently) RTPATH_STR_F_STYLE_DOS or RTPATH_STR_F_STYLE_UNIX. Some other minor adjustments.

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

Legend:

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

    r45390 r45391  
    5050    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
    5151    AssertReturn(*pszPath, VERR_PATH_ZERO_LENGTH);
    52     AssertReturn(!(fFlags & ~RTPATHPARSE_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
     52    AssertReturn(RTPATH_STR_F_IS_VALID(fFlags, 0), VERR_INVALID_FLAGS);
    5353
    5454    /*
    5555     * Invoke the worker for the selected path style.
    5656     */
    57     switch (fFlags & RTPATHPARSE_FLAGS_STYLE_MASK)
     57    switch (fFlags & RTPATH_STR_F_STYLE_MASK)
    5858    {
    5959#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
    60         case RTPATHPARSE_FLAGS_STYLE_HOST:
     60        case RTPATH_STR_F_STYLE_HOST:
    6161#endif
    62         case RTPATHPARSE_FLAGS_STYLE_DOS:
     62        case RTPATH_STR_F_STYLE_DOS:
    6363            return rtPathParseStyleDos(pszPath, pParsed, cbParsed, fFlags);
    6464
    6565#if !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
    66         case RTPATHPARSE_FLAGS_STYLE_HOST:
     66        case RTPATH_STR_F_STYLE_HOST:
    6767#endif
    68         case RTPATHPARSE_FLAGS_STYLE_UNIX:
     68        case RTPATH_STR_F_STYLE_UNIX:
    6969            return rtPathParseStyleUnix(pszPath, pParsed, cbParsed, fFlags);
    7070
    7171        default:
    72             AssertFailedReturn(VERR_INVALID_FLAGS);
     72            AssertFailedReturn(VERR_INVALID_FLAGS); /* impossible */
    7373    }
    7474}
  • trunk/src/VBox/Runtime/common/path/RTPathParse.cpp.h

    r45389 r45391  
    4848    if (RTPATH_IS_SLASH(pszPath[0]))
    4949    {
    50         if (fFlags & RTPATHPARSE_FLAGS_NO_START)
     50        if (fFlags & RTPATH_STR_F_NO_START)
    5151        {
    5252            offCur = 1;
     
    5858            cchPath = 0;
    5959        }
    60 #ifdef RTPATH_STYLE_DOS
     60#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS
    6161        else if (   RTPATH_IS_SLASH(pszPath[1])
    6262                 && !RTPATH_IS_SLASH(pszPath[2])
     
    8484        else
    8585        {
    86 #ifdef RTPATH_STYLE_DOS
     86#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS
    8787            fProps = RTPATH_PROP_ROOT_SLASH | RTPATH_PROP_RELATIVE;
    8888#else
     
    9292        }
    9393    }
    94 #ifdef RTPATH_STYLE_DOS
     94#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS
    9595    else if (RT_C_IS_ALPHA(pszPath[0]) && pszPath[1] == ':')
    9696    {
     
    115115
    116116    /*  Add it to the component array . */
    117     if (offCur && !(fFlags & RTPATHPARSE_FLAGS_NO_START))
     117    if (offCur && !(fFlags & RTPATH_STR_F_NO_START))
    118118    {
    119119        cchPath = offCur;
     
    192192                if (ch)
    193193                {
    194                     if (!(fFlags & RTPATHPARSE_FLAGS_NO_END))
     194                    if (!(fFlags & RTPATH_STR_F_NO_END))
    195195                        fProps |= RTPATH_PROP_DIR_SLASH; /* (not counted) */
    196196                    else
    197197                        fProps |= RTPATH_PROP_EXTRA_SLASHES;
    198198                }
    199                 else if (!(fFlags & RTPATHPARSE_FLAGS_NO_END))
     199                else if (!(fFlags & RTPATH_STR_F_NO_END))
    200200                {
    201201                    fProps |= RTPATH_PROP_FILENAME;
  • trunk/src/VBox/Runtime/common/path/rtpath-expand-template.cpp.h

    r45389 r45391  
    2626 */
    2727
     28#undef  RTPATH_DELIMITER
    2829
    2930/*
    30  * The following should move to a helper header!
     31 * DOS style
    3132 */
    32 #undef  RTPATH_DELIMITER
    33 
    34 /* DOS style */
    35 #undef  RTPATH_STYLE_UNIX
    36 #undef  RTPATH_STYLE_DOS
     33#undef  RTPATH_STYLE
     34#undef  RTPATH_SLASH
    3735#undef  RTPATH_SLASH_STR
    3836#undef  RTPATH_IS_SLASH
     
    4038#undef  RTPATH_STYLE_FN
    4139
    42 #define RTPATH_STYLE_DOS
     40#define RTPATH_STYLE            RTPATH_STR_F_STYLE_DOS
     41#define RTPATH_SLASH            '\\'
    4342#define RTPATH_SLASH_STR        "\\"
    4443#define RTPATH_IS_SLASH(a_ch)   ( (a_ch) == '\\' || (a_ch) == '/' )
     
    4746#include RTPATH_TEMPLATE_CPP_H
    4847
    49 /* Unix style. */
    50 #undef  RTPATH_STYLE_UNIX
    51 #undef  RTPATH_STYLE_DOS
     48/*
     49 * Unix style.
     50 */
     51#undef  RTPATH_STYLE
     52#undef  RTPATH_SLASH
    5253#undef  RTPATH_SLASH_STR
    5354#undef  RTPATH_IS_SLASH
     
    5556#undef  RTPATH_STYLE_FN
    5657
    57 #define RTPATH_STYLE_UNIX
     58#define RTPATH_STYLE            RTPATH_STR_F_STYLE_UNIX
     59#define RTPATH_SLASH            '/'
    5860#define RTPATH_SLASH_STR        "/"
    5961#define RTPATH_IS_SLASH(a_ch)   ( (a_ch) == '/' )
     
    6264#include RTPATH_TEMPLATE_CPP_H
    6365
    64 /* Restore original style. */
     66/*
     67 * Clean up and restore the host style.
     68 */
    6569#undef RTPATH_STYLE_FN
    6670#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
    67 # undef  RTPATH_STYLE_UNIX
    68 # undef  RTPATH_STYLE_DOS
     71# undef  RTPATH_STYLE
    6972# undef  RTPATH_SLASH_STR
    7073# undef  RTPATH_IS_SLASH
    7174# undef  RTPATH_IS_VOLSEP
    72 # define RTPATH_SLASH_STR        "\\"
    73 # define RTPATH_IS_SLASH(a_ch)   ( (a_ch) == '\\' || (a_ch) == '/' )
    74 # define RTPATH_IS_VOLSEP(a_ch)  ( (a_ch) == ':' )
     75# define RTPATH_STYLE           RTPATH_STR_F_STYLE_DOS
     76# define RTPATH_SLASH           '\\'
     77# define RTPATH_SLASH_STR       "\\"
     78# define RTPATH_IS_SLASH(a_ch)  ( (a_ch) == '\\' || (a_ch) == '/' )
     79# define RTPATH_IS_VOLSEP(a_ch) ( (a_ch) == ':' )
    7580#endif
    7681
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