Changeset 28877 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 28, 2010 7:10:47 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60812
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r28800 r28877 609 609 darwin/RTErrConvertFromDarwinIO.cpp \ 610 610 darwin/RTErrConvertFromDarwinKern.cpp \ 611 generic/pathhost-generic.cpp \612 611 generic/RTDirQueryInfo-generic.cpp \ 613 612 generic/RTDirSetTimes-generic.cpp \ … … 628 627 r3/darwin/filelock-darwin.cpp \ 629 628 r3/darwin/mp-darwin.cpp \ 629 r3/darwin/pathhost-darwin.cpp \ 630 630 r3/darwin/rtProcInitExePath-darwin.cpp \ 631 631 r3/darwin/RTSystemQueryDmiString-darwin.cpp \ -
trunk/src/VBox/Runtime/generic/pathhost-generic.cpp
r28800 r28877 47 47 } 48 48 49 void rtPathFreeNative(char *pszNativePath )49 void rtPathFreeNative(char *pszNativePath, const char *pszPath) 50 50 { 51 51 if (pszNativePath) -
trunk/src/VBox/Runtime/include/internal/path.h
r28800 r28877 48 48 * Converts a path from IPRT to native representation. 49 49 * 50 * This may involve querying filesystems what codeset they 51 * speak and so forth. 50 * This may involve querying filesystems what codeset they speak and so forth. 52 51 * 53 52 * @returns IPRT status code. 54 53 * @param ppszNativePath Where to store the pointer to the native path. 55 54 * Free by calling rtPathFreeHost(). NULL on failure. 55 * Can be the same as pszPath. 56 56 * @param pszPath The path to convert. 57 * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32) 57 * 58 * @remark This function is not available on hosts using something else than 59 * byte seqences as names (eg win32). 58 60 */ 59 61 int rtPathToNative(char **ppszNativePath, const char *pszPath); … … 62 64 * Converts a path from IPRT to native representation. 63 65 * 64 * This may involve querying filesystems what codeset they 65 * speak and so forth. 66 * This may involve querying filesystems what codeset they speak and so forth. 66 67 * 67 68 * @returns IPRT status code. 68 69 * @param ppszNativePath Where to store the pointer to the native path. 69 * Free by calling rtPathFreeHost(). NULL on failure. 70 * Free by calling rtPathFreeHost(). NULL on failure. 71 * Can be the same as pszPath. 70 72 * @param pszPath The path to convert. 71 * @param pszBasePath What pszPath is relative to. If NULL the function behaves like rtPathToNative(). 72 * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32) 73 * @param pszBasePath What pszPath is relative to. If NULL the function 74 * behaves like rtPathToNative(). 75 * 76 * @remark This function is not available on hosts using something else than 77 * byte seqences as names (eg win32). 73 78 */ 74 79 int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath); … … 78 83 * 79 84 * @param pszNativePath The host path to free. NULL allowed. 80 * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32) 85 * @param pszPath The original path. This is for checking if 86 * rtPathToNative returned the pointer to the original. 87 * 88 * @remark This function is not available on hosts using something else than 89 * byte seqences as names (eg win32). 81 90 */ 82 void rtPathFreeNative(char *pszNativePath );91 void rtPathFreeNative(char *pszNativePath, const char *pszPath); 83 92 84 93 /** … … 89 98 * Free by calling RTStrFree(). NULL on failure. 90 99 * @param pszNativePath The native path to convert. 91 * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32) 100 * 101 * @remark This function is not available on hosts using something else than 102 * byte seqences as names (eg win32). 92 103 */ 93 104 int rtPathFromNative(char **ppszPath, const char *pszNativePath); … … 100 111 * Free by calling RTStrFree(). NULL on failure. 101 112 * @param pszNativePath The native path to convert. 102 * @param pszBasePath What pszHostPath is relative to - in IPRT representation. 103 * If NULL the function behaves like rtPathFromNative(). 104 * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32) 113 * @param pszBasePath What pszHostPath is relative to - in IPRT 114 * representation. If NULL the function behaves like 115 * rtPathFromNative(). 116 * 117 * @remark This function is not available on hosts using something else than 118 * byte seqences as names (eg win32). 105 119 */ 106 120 int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath); -
trunk/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp
r28849 r28877 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Path Convertions, generic. 3 * IPRT - Path Convertions, Darwin. 4 * 5 * On darwin path names on the disk are decomposed using normalization 6 * form D (NFD). Since this behavior is unique for the Mac, we will precompose 7 * the path name strings we get from the XNU kernel. 4 8 */ 5 9 6 10 /* 7 * Copyright (C) 2006-20 07Oracle Corporation11 * Copyright (C) 2006-2010 Oracle Corporation 8 12 * 9 13 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 42 int rtPathToNative(char **ppszNativePath, const char *pszPath) 39 43 { 40 return RTStrUtf8ToCurrentCP(ppszNativePath, pszPath); 44 /** @todo We should decompose the string here, but the file system will do 45 * that for us if we don't, so why bother. */ 46 *ppszNativePath = (char *)pszPath; 47 return VINF_SUCCESS; 41 48 } 49 42 50 43 51 int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath) 44 52 { 45 53 NOREF(pszBasePath); 46 return RTStrUtf8ToCurrentCP(ppszNativePath, pszPath);54 return rtPathToNative(ppszNativePath, pszPath); 47 55 } 48 56 49 void rtPathFreeNative(char *pszNativePath) 57 58 void rtPathFreeNative(char *pszNativePath, const char *pszPath) 50 59 { 51 if (pszNativePath) 52 RTStrFree(pszNativePath); 60 Assert((const char *)pszNativePath == pszPath || !pszNativePath); 61 NOREF(pszNativePath); 62 NOREF(pszPath); 53 63 } 54 64 … … 56 66 int rtPathFromNative(char **pszPath, const char *pszNativePath) 57 67 { 58 return RTStrCurrentCPToUtf8(pszPath, pszNativePath); 68 /** @todo We must compose the codepoints in the string here. We get file names 69 * in normalization form D so we'll end up with normalization form C 70 * whatever approach we take. */ 71 return RTStrDupEx(ppszPath, pszNativePath); 59 72 } 60 73 … … 63 76 { 64 77 NOREF(pszBasePath); 65 return RTStrCurrentCPToUtf8(pszPath, pszNativePath);78 return rtPathFromNative(ppszPath, pszNativePath); 66 79 } 67 80 -
trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp
r28800 r28877 70 70 && S_ISDIR(s.st_mode); 71 71 72 rtPathFreeNative(pszNativePath );72 rtPathFreeNative(pszNativePath, pszPath); 73 73 } 74 74 … … 110 110 } 111 111 112 rtPathFreeNative(pszNativePath );112 rtPathFreeNative(pszNativePath, pszPath); 113 113 } 114 114 else … … 131 131 rc = RTErrConvertFromErrno(errno); 132 132 133 rtPathFreeNative(pszNativePath );133 rtPathFreeNative(pszNativePath, pszPath); 134 134 } 135 135 … … 196 196 rc = RTErrConvertFromErrno(errno); 197 197 198 rtPathFreeNative(pszNativePath );198 rtPathFreeNative(pszNativePath, pDir->pszPath); 199 199 } 200 200 -
trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
r28800 r28877 100 100 && S_ISREG(s.st_mode); 101 101 102 rtPathFreeNative(pszNativePath );102 rtPathFreeNative(pszNativePath, pszPath); 103 103 } 104 104 … … 212 212 int fh = open(pszNativeFilename, fOpenMode, fMode); 213 213 int iErr = errno; 214 rtPathFreeNative(pszNativeFilename );214 rtPathFreeNative(pszNativeFilename, pszFilename); 215 215 #endif 216 216 if (fh >= 0) … … 378 378 if (unlink(pszNativeFilename) != 0) 379 379 rc = RTErrConvertFromErrno(errno); 380 rtPathFreeNative(pszNativeFilename );380 rtPathFreeNative(pszNativeFilename, pszFilename); 381 381 } 382 382 return rc; -
trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp
r28800 r28877 81 81 else 82 82 rc = RTErrConvertFromErrno(errno); 83 rtPathFreeNative(pszNativeFsPath );83 rtPathFreeNative(pszNativeFsPath, pszFsPath); 84 84 } 85 85 … … 115 115 else 116 116 rc = RTErrConvertFromErrno(errno); 117 rtPathFreeNative(pszNativeFsPath );117 rtPathFreeNative(pszNativeFsPath, pszFsPath); 118 118 } 119 119 LogFlow(("RTFsQuerySerial(%p:{%s}, %p:{%RX32}: returns %Rrc\n", … … 155 155 else 156 156 rc = RTErrConvertFromErrno(errno); 157 rtPathFreeNative(pszNativeFsPath );157 rtPathFreeNative(pszNativeFsPath, pszFsPath); 158 158 } 159 159 -
trunk/src/VBox/Runtime/r3/posix/path-posix.cpp
r28800 r28877 512 512 else 513 513 rc = RTErrConvertFromErrno(errno); 514 rtPathFreeNative(pszNativePath );514 rtPathFreeNative(pszNativePath, pszPath); 515 515 } 516 516 … … 615 615 } 616 616 } 617 rtPathFreeNative(pszNativePath );617 rtPathFreeNative(pszNativePath, pszPath); 618 618 } 619 619 … … 789 789 pszSrc, pszDst, fRename, fFileType, rc, errno)); 790 790 791 rtPathFreeNative(pszNativeDst );791 rtPathFreeNative(pszNativeDst, pszDst); 792 792 } 793 rtPathFreeNative(pszNativeSrc );793 rtPathFreeNative(pszNativeSrc, pszSrc); 794 794 } 795 795 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.