Changeset 3917
- Timestamp:
- Oct 24, 2014, 10:02:16 PM (10 years ago)
- Location:
- branches/libc-0.6/src/emx/src/lib/sys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/libc-0.6/src/emx/src/lib/sys/fs.c ¶
r3914 r3917 323 323 && ((psz[0] >= 'A' && psz[0] <= 'Z') || (psz[0] >= 'a' && psz[0] <= 'z')) 324 324 && psz[1] == ':' 325 && (psz[2] == '\\' || psz[2] == '/' )325 && (psz[2] == '\\' || psz[2] == '/' || psz[2] == '\0') 326 326 ) 327 327 { … … 339 339 __libc_gszUnixRoot[0] -= 'a' - 'A'; 340 340 341 size_t off = cch; 342 while (off-- > 0) 343 if (__libc_gszUnixRoot[off] == '\\') 344 __libc_gszUnixRoot[off] = '/'; 341 if (cch == 2) 342 { 343 __libc_gszUnixRoot[cch++] = '/'; 344 __libc_gszUnixRoot[cch] = '\0'; 345 } 346 else 347 { 348 size_t off = cch; 349 while (off-- > 0) 350 if (__libc_gszUnixRoot[off] == '\\') 351 __libc_gszUnixRoot[off] = '/'; 352 353 while (cch > 3 && __libc_gszUnixRoot[cch - 1] == '/') 354 __libc_gszUnixRoot[--cch] = '\0'; 355 } 345 356 346 357 /* Register the rewrite rule. */ -
TabularUnified branches/libc-0.6/src/emx/src/lib/sys/pathrewrite.c ¶
r3780 r3917 660 660 while ((ch = *pszEnd) && ch != '/' && ch != '\\') 661 661 pszEnd++; 662 cch = pszEnd - psz;662 cch = (unsigned)(pszEnd - psz); 663 663 if (cch > 255) 664 664 { … … 707 707 continue; 708 708 } 709 else 710 { 711 /* 712 * Complete match. We're done! 713 */ 714 if ( pEntry->fType == DIRENTRY_TYPE_FILE 715 || pEntry->u.pDir->pRule /* DIRENTRY_TYPE_DIR */) 709 710 /* 711 * Complete match. We're done! 712 */ 713 if ( pEntry->fType == DIRENTRY_TYPE_FILE 714 || pEntry->u.pDir->pRule /* DIRENTRY_TYPE_DIR */) 715 { 716 __LIBC_PPATHREWRITE pRule = pEntry->fType == DIRENTRY_TYPE_FILE 717 ? pEntry->u.pFile : pEntry->u.pDir->pRule; 718 cch = pRule->cchTo + 1; 719 if (pszBuf) 716 720 { 717 __LIBC_PPATHREWRITE pRule = pEntry->fType == DIRENTRY_TYPE_FILE 718 ? pEntry->u.pFile : pEntry->u.pDir->pRule; 719 cch = pRule->cchTo + 1; 720 if (pszBuf) 721 { 722 if (cchBuf < cch) 723 LIBCLOG_ERROR_RETURN(-1, "ret -1 - Buffer is too small (%d < %d)\n", cchBuf, cch); 724 memcpy(pszBuf, pRule->pszTo, cch); 725 LIBCLOG_MSG("rewritten: '%s' (complete)\n", pszBuf); 726 } 727 LIBCLOG_RETURN_INT(cch); 721 if (cchBuf < cch) 722 LIBCLOG_ERROR_RETURN(-1, "ret -1 - Buffer is too small (%d < %d)\n", cchBuf, cch); 723 memcpy(pszBuf, pRule->pszTo, cch); 724 LIBCLOG_MSG("rewritten: '%s' (complete)\n", pszBuf); 728 725 } 729 /* not a match, the directory wasn't rewritten, quit searching. */ 730 } 726 LIBCLOG_RETURN_INT(cch); 727 } 728 /* not a match, the directory wasn't rewritten, quit searching. */ 731 729 } 732 730 /* no match, we're done. */
Note:
See TracChangeset
for help on using the changeset viewer.