- Timestamp:
- Sep 4, 2015 2:43:08 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp
r57613 r57615 203 203 RTDIRENTRY DirEntry; 204 204 /** Padding the buffer to an unreasonably large size. */ 205 uint8_t abPadding[RTPATH_MAX + RT_OFFSETOF(RTDIRENTRY, szName)];205 uint8_t abPadding[RTPATH_MAX + sizeof(RTDIRENTRY)]; 206 206 } u; 207 207 … … 443 443 { 444 444 char *pchSep = strchr(pszPath, chSep); 445 if (iItem > 0) 445 446 /* We ignore empty strings, which is probably not entirely correct, 447 but works better on DOS based system with many entries added 448 without checking whether there is a trailing separator or not. 449 Thus, the current directory is only searched if a '.' is present 450 in the PATH. */ 451 if (pchSep == pszPath) 452 pszPath++; 453 else if (iItem > 0) 446 454 { 447 455 /* If we didn't find a separator, the item doesn't exists. Quit. */ … … 449 457 break; 450 458 451 /* We ignore empty strings, which is probably not entirely correct, 452 but works better on DOS based system with many entries added 453 without checking whether there is a trailing separator or not. 454 Thus, the current directory is only searched if a '.' is present 455 in the PATH. */ 456 if (pchSep != pszPath) 457 { 458 pszPath = pchSep; 459 iItem--; 460 } 461 pszPath++; 459 pszPath = pchSep + 1; 460 iItem--; 462 461 } 463 462 else 464 463 { 465 464 /* We've reached the item we wanted. */ 466 size_t cchComp = pchSep ? p szPath - pchSep: strlen(pszPath);465 size_t cchComp = pchSep ? pchSep - pszPath : strlen(pszPath); 467 466 if (cchComp < cbBuf) 468 467 { … … 474 473 else 475 474 rc = VERR_BUFFER_OVERFLOW; 475 *pcchValue = cchComp; 476 476 break; 477 477 } … … 1072 1072 if (cchPattern == 0) 1073 1073 { 1074 pInstr->enmOpCode = iFirst + 1 == pAllocator->iNext1074 pInstr->enmOpCode = iFirst + 1U == pAllocator->iNext 1075 1075 ? RTPATHMATCHOP_RETURN_MATCH_EXCEPT_DOT_AND_DOTDOT : RTPATHMATCHOP_RETURN_MATCH; 1076 1076 break; 1077 1077 } 1078 1078 1079 pInstr->enmOpCode = iFirst + 1 == pAllocator->iNext1079 pInstr->enmOpCode = iFirst + 1U == pAllocator->iNext 1080 1080 ? RTPATHMATCHOP_ZERO_OR_MORE_EXCEPT_DOT_AND_DOTDOT : RTPATHMATCHOP_ZERO_OR_MORE; 1081 1081 pInstr->uOp2 = (uint16_t)offInput; … … 1225 1225 pchPattern += cchVarNm + 1; 1226 1226 cchPattern -= cchVarNm + 1; 1227 AssertMsgReturn(!g_aVariables[iVar].fFirstOnly || iFirst + 1 == pAllocator->iNext,1227 AssertMsgReturn(!g_aVariables[iVar].fFirstOnly || iFirst + 1U == pAllocator->iNext, 1228 1228 ("Glob variable '%s' should be first\n", g_aVariables[iVar].pszName), 1229 1229 VERR_PATH_MATCH_VARIABLE_MUST_BE_FIRST); … … 1245 1245 while (cchPlain < cchPattern) 1246 1246 { 1247 ch ar const ch= pchPattern[cchPlain];1247 ch = pchPattern[cchPlain]; 1248 1248 if (!ASMBitTest(s_bmMetaChars, (uint8_t)ch)) 1249 1249 { /* probable */ }
Note:
See TracChangeset
for help on using the changeset viewer.