Changeset 2409 in kBuild for trunk/src/kObjCache/kObjCache.c
- Timestamp:
- Jun 16, 2010 11:46:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kObjCache/kObjCache.c
r2375 r2409 70 70 #if defined(__WIN__) 71 71 # include <Windows.h> 72 # include "quoted_spawn.h" 72 73 #endif 73 74 … … 325 326 * @param pszPath1 The first path. 326 327 * @param pszPath2 The second path. 327 * @param cch The number of characters to compare. 328 */ 329 static int ArePathsIdentical(const char *pszPath1, const char *pszPath2, size_t cch) 328 */ 329 static int ArePathsIdentical(const char *pszPath1, const char *pszPath2) 330 330 { 331 331 #if defined(__OS2__) || defined(__WIN__) 332 if (str nicmp(pszPath1, pszPath2, cch))332 if (stricmp(pszPath1, pszPath2)) 333 333 { 334 334 /* Slashes may differ, compare char by char. */ 335 335 const char *psz1 = pszPath1; 336 336 const char *psz2 = pszPath2; 337 for (;cch; psz1++, psz2++, cch--) 337 for (;;) 338 { 339 if (*psz1 != *psz2) 340 { 341 if ( tolower(*psz1) != tolower(*psz2) 342 && toupper(*psz1) != toupper(*psz2) 343 && *psz1 != '/' 344 && *psz1 != '\\' 345 && *psz2 != '/' 346 && *psz2 != '\\') 347 return 0; 348 } 349 if (!*psz1) 350 break; 351 psz1++; 352 psz2++; 353 } 354 } 355 return 1; 356 #else 357 return !strcmp(pszPath1, pszPath2); 358 #endif 359 } 360 361 /** 362 * Compares two path strings to see if they are identical. 363 * 364 * This doesn't do anything fancy, just the case ignoring and 365 * slash unification. 366 * 367 * @returns 1 if equal, 0 otherwise. 368 * @param pszPath1 The first path. 369 * @param pszPath2 The second path. 370 * @param cch The number of characters to compare. 371 */ 372 static int ArePathsIdenticalN(const char *pszPath1, const char *pszPath2, size_t cch) 373 { 374 #if defined(__OS2__) || defined(__WIN__) 375 if (strnicmp(pszPath1, pszPath2, cch)) 376 { 377 /* Slashes may differ, compare char by char. */ 378 const char *psz1 = pszPath1; 379 const char *psz2 = pszPath2; 380 for ( ; cch; psz1++, psz2++, cch--) 338 381 { 339 382 if (*psz1 != *psz2) … … 372 415 * This is indeed a bit tricky, so we'll try the easy way first... 373 416 */ 374 if (ArePathsIdentical (pszPath, pszDir, cchDir))417 if (ArePathsIdenticalN(pszPath, pszDir, cchDir)) 375 418 { 376 419 if (pszPath[cchDir]) … … 382 425 { 383 426 pszAbsPath = AbsPath(pszPath); 384 if (ArePathsIdentical (pszAbsPath, pszDir, cchDir))427 if (ArePathsIdenticalN(pszAbsPath, pszDir, cchDir)) 385 428 { 386 429 if (pszPath[cchDir]) … … 1144 1187 size_t cch = strlen(papszArgv[i]); 1145 1188 if ( cch < cchIgnorePath 1146 || !ArePathsIdentical (papszArgv[i] + cch - cchIgnorePath, pszIgnorePath, cch))1189 || !ArePathsIdenticalN(papszArgv[i] + cch - cchIgnorePath, pszIgnorePath, cch)) 1147 1190 kOCSumUpdate(pSum, &Ctx, papszArgv[i], cch + 1); 1148 1191 } … … 1581 1624 1582 1625 errno = 0; 1626 # ifdef __WIN__ 1627 rc = quoted_spawnvp(_P_WAIT, papszArgv[0], papszArgv); 1628 # else 1583 1629 rc = _spawnvp(_P_WAIT, papszArgv[0], papszArgv); 1630 # endif 1584 1631 if (rc < 0) 1585 1632 FatalDie("%s - _spawnvp failed (rc=0x%p): %s\n", pszMsg, rc, strerror(errno)); 1586 1633 if (rc > 0) 1587 1634 FatalDie("%s - failed rc=%d\n", pszMsg, (int)rc); 1588 if (fdStdOut )1635 if (fdStdOut != -1) 1589 1636 { 1590 1637 close(STDOUT_FILENO); … … 1684 1731 #if defined(__OS2__) || defined(__WIN__) 1685 1732 errno = 0; 1733 # ifdef __WIN__ 1734 pid = quoted_spawnvp(_P_NOWAIT, papszArgv[0], papszArgv); 1735 # else 1686 1736 pid = _spawnvp(_P_NOWAIT, papszArgv[0], papszArgv); 1737 # endif 1687 1738 if (pid == -1) 1688 1739 FatalDie("precompile - _spawnvp failed: %s\n", strerror(errno)); … … 3490 3541 PKOCDIGEST pDigest = &pCache->paDigests[i]; 3491 3542 if (ArePathsIdentical(kOCDigestAbsPath(pDigest, pCache->pszDir), 3492 kOCEntryAbsPath(pEntry) , ~0U))3543 kOCEntryAbsPath(pEntry))) 3493 3544 { 3494 3545 unsigned cLeft;
Note:
See TracChangeset
for help on using the changeset viewer.