Changeset 96610 in vbox for trunk/src/VBox/Runtime/common/path
- Timestamp:
- Sep 6, 2022 2:17:39 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathAppendEx.cpp
r96609 r96610 51 51 52 52 53 /**54 * Figures the length of the root part of the path.55 *56 * @returns length of the root specifier.57 * @retval 0 if none.58 *59 * @param pszPath The path to investigate.60 *61 * @remarks Unnecessary root slashes will not be counted. The caller will have62 * to deal with it where it matters. (Unlike rtPathRootSpecLen which63 * counts them.)64 */65 static size_t rtPathRootSpecLen2(const char *pszPath)66 {67 /* fend of wildlife. */68 if (!pszPath)69 return 0;70 71 /* Root slash? */72 if (RTPATH_IS_SLASH(pszPath[0]))73 {74 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)75 /* UNC? */76 if ( RTPATH_IS_SLASH(pszPath[1])77 && pszPath[2] != '\0'78 && !RTPATH_IS_SLASH(pszPath[2]))79 {80 /* Find the end of the server name. */81 const char *pszEnd = pszPath + 2;82 pszEnd += 2;83 while ( *pszEnd != '\0'84 && !RTPATH_IS_SLASH(*pszEnd))85 pszEnd++;86 if (RTPATH_IS_SLASH(*pszEnd))87 {88 pszEnd++;89 while (RTPATH_IS_SLASH(*pszEnd))90 pszEnd++;91 92 /* Find the end of the share name */93 while ( *pszEnd != '\0'94 && !RTPATH_IS_SLASH(*pszEnd))95 pszEnd++;96 if (RTPATH_IS_SLASH(*pszEnd))97 pszEnd++;98 return pszPath - pszEnd;99 }100 }101 #endif102 return 1;103 }104 105 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)106 /* Drive specifier? */107 if ( pszPath[0] != '\0'108 && pszPath[1] == ':'109 && RT_C_IS_ALPHA(pszPath[0]))110 {111 if (RTPATH_IS_SLASH(pszPath[2]))112 return 3;113 return 2;114 }115 #endif116 return 0;117 }118 119 120 53 RTDECL(int) RTPathAppendEx(char *pszPath, size_t cbPathDst, const char *pszAppend, size_t cchAppendMax, uint32_t fFlags) 121 54 {
Note:
See TracChangeset
for help on using the changeset viewer.