VirtualBox

Changeset 15809 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Jan 5, 2009 3:49:05 PM (16 years ago)
Author:
vboxsync
Message:

iprt: style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/path-win.cpp

    r15808 r15809  
    122122    rc = GetFullPathNameW(pwszPath, RT_ELEMENTS(wsz), &wsz[0], &pwszFile);
    123123    if (rc > 0 && rc < RT_ELEMENTS(wsz))
    124         rc = RTUtf16ToUtf8Ex(&wsz[0], RTSTR_MAX, &pszAbsPath, cchAbsPath, NULL);
     124    {
     125        size_t cch;
     126        rc = RTUtf16ToUtf8Ex(&wsz[0], RTSTR_MAX, &pszAbsPath, cchAbsPath, &cch);
     127        if (RT_SUCCESS(rc))
     128        {
     129            /*
     130             * Remove trailing slash if the path may be pointing to a directory.
     131             * (See posix variant.)
     132             */
     133            if (    cch > 1
     134                &&  RTPATH_IS_SLASH(pszAbsPath[cch - 1])
     135                &&  !RTPATH_IS_VOLSEP(pszAbsPath[cch - 2])
     136                &&  !RTPATH_IS_SLASH(pszAbsPath[cch - 2]))
     137                pszAbsPath[cch - 1] = '\0';
     138        }
     139    }
    125140    else if (rc <= 0)
    126141        rc = RTErrConvertFromWin32(GetLastError());
     
    129144
    130145    RTUtf16Free(pwszPath);
    131 
    132     if (RT_SUCCESS(rc))
    133     {
    134         /*
    135          * Remove trailing slash if the path may be pointing to a directory.
    136          */
    137         size_t cch = strlen(pszAbsPath);
    138         if (    cch > 1
    139             &&  RTPATH_IS_SLASH(pszAbsPath[cch - 1])
    140             &&  !RTPATH_IS_VOLSEP(pszAbsPath[cch - 2])
    141             &&  !RTPATH_IS_SLASH(pszAbsPath[cch - 2]))
    142             pszAbsPath[cch - 1] = '\0';
    143     }
    144 
    145146    return rc;
    146147}
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