Changeset 1005 in kBuild
- Timestamp:
- Jun 2, 2007 1:54:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kObjCache/kObjCache.c
r1003 r1005 62 62 /** The max line length in a cache file. */ 63 63 #define KOBJCACHE_MAX_LINE_LEN 16384 64 #if defined(__WIN__) 65 # define PATH_SLASH '\\' 66 #else 67 # define PATH_SLASH '/' 68 #endif 69 #if defined(__OS2__) || defined(__WIN__) 70 # define IS_SLASH(ch) ((ch) == '/' || (ch) == '\\') 71 # define IS_SLASH_DRV(ch) ((ch) == '/' || (ch) == '\\' || (ch) == ':') 72 #else 73 # define IS_SLASH(ch) ((ch) == '/') 74 # define IS_SLASH_DRV(ch) ((ch) == '/') 75 #endif 76 64 77 65 78 … … 578 591 kObjCacheVerbose(pEntry, "precompiled file is %lu bytes long\n", (unsigned long)pEntry->cbNewCppMapping); 579 592 593 memset(&pEntry->NewSum, 0, sizeof(pEntry->NewSum)); 580 594 pEntry->NewSum.crc32 = crc32(0, pEntry->pszNewCppMapping, pEntry->cbNewCppMapping); 581 595 MD5Init(&MD5Ctx); … … 827 841 const char *pszFilename = strchr(pszPath, '\0') - 1; 828 842 while ( pszFilename > pszPath 829 #if defined(__OS2__) || defined(__WIN__) 830 && pszFilename[-1] != ':' && pszFilename[-1] != '/' && pszFilename[-1] != '\\') 831 #else 832 && pszFilename[-1] != '/') 833 #endif 843 && !IS_SLASH_DRV(pszFilename[-1])) 834 844 pszFilename--; 835 845 return pszFilename; … … 850 860 char *pszBuf = xmalloc(cchName + cchDir + 2); 851 861 memcpy(pszBuf, pszDir, cchDir); 852 #if defined(__OS2__) || defined(__WIN__) 853 if (cchDir > 0 && pszDir[cchDir - 1] != '/' && pszDir[cchDir - 1] != '\\' && pszDir[cchDir - 1] != ':') 854 #else 855 if (cchDir > 0 && pszDir[cchDir - 1] != '/') 856 #endif 857 pszBuf[cchDir++] = '/'; 862 if (cchDir > 0 && !IS_SLASH_DRV(pszDir[cchDir - 1])) 863 pszBuf[cchDir++] = PATH_SLASH; 858 864 memcpy(pszBuf + cchDir, pszName, cchName + 1); 859 865 return pszBuf; … … 937 943 if (pszRet) 938 944 { 939 #if defined(__OS2__) || defined(__WIN__) 940 while (*pszRet == ':' || *pszRet == '/' || *pszRet == '\\') 941 #else 942 while (*pszRet == '/') 943 #endif 945 while (IS_SLASH_DRV(*pszRet)) 944 946 pszRet++; 945 947 pszRet = xstrdup(pszRet); … … 1002 1004 char *pszOldPath = MakePathFromDirAndFile(pszOldName, pszDir); 1003 1005 char *pszNewPath = MakePathFromDirAndFile(pszNewName, pszDir); 1004 int rc = rename(pszOld Name, pszNewName);1006 int rc = rename(pszOldPath, pszNewPath); 1005 1007 free(pszOldPath); 1006 1008 free(pszNewPath); … … 1045 1047 int SavedErrno; 1046 1048 char *pszPath = MakePathFromDirAndFile(pszName, pszDir); 1047 int fd = open(psz Name, O_RDONLY | O_BINARY);1049 int fd = open(pszPath, O_RDONLY | O_BINARY); 1048 1050 if (fd >= 0) 1049 1051 {
Note:
See TracChangeset
for help on using the changeset viewer.