VirtualBox

Changeset 28877 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Apr 28, 2010 7:10:47 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60812
Message:

IPRT: pathhost changes.

Location:
trunk/src/VBox/Runtime
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r28800 r28877  
    609609        darwin/RTErrConvertFromDarwinIO.cpp \
    610610        darwin/RTErrConvertFromDarwinKern.cpp \
    611         generic/pathhost-generic.cpp \
    612611        generic/RTDirQueryInfo-generic.cpp \
    613612        generic/RTDirSetTimes-generic.cpp \
     
    628627        r3/darwin/filelock-darwin.cpp \
    629628        r3/darwin/mp-darwin.cpp \
     629        r3/darwin/pathhost-darwin.cpp \
    630630        r3/darwin/rtProcInitExePath-darwin.cpp \
    631631        r3/darwin/RTSystemQueryDmiString-darwin.cpp \
  • trunk/src/VBox/Runtime/generic/pathhost-generic.cpp

    r28800 r28877  
    4747}
    4848
    49 void rtPathFreeNative(char *pszNativePath)
     49void rtPathFreeNative(char *pszNativePath, const char *pszPath)
    5050{
    5151    if (pszNativePath)
  • trunk/src/VBox/Runtime/include/internal/path.h

    r28800 r28877  
    4848 * Converts a path from IPRT to native representation.
    4949 *
    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.
    5251 *
    5352 * @returns IPRT status code.
    5453 * @param   ppszNativePath  Where to store the pointer to the native path.
    5554 *                          Free by calling rtPathFreeHost(). NULL on failure.
     55 *                          Can be the same as pszPath.
    5656 * @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).
    5860 */
    5961int rtPathToNative(char **ppszNativePath, const char *pszPath);
     
    6264 * Converts a path from IPRT to native representation.
    6365 *
    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.
    6667 *
    6768 * @returns IPRT status code.
    6869 * @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.
    7072 * @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).
    7378 */
    7479int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath);
     
    7883 *
    7984 * @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).
    8190 */
    82 void rtPathFreeNative(char *pszNativePath);
     91void rtPathFreeNative(char *pszNativePath, const char *pszPath);
    8392
    8493/**
     
    8998 *                          Free by calling RTStrFree(). NULL on failure.
    9099 * @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).
    92103 */
    93104int rtPathFromNative(char **ppszPath, const char *pszNativePath);
     
    100111 *                          Free by calling RTStrFree(). NULL on failure.
    101112 * @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).
    105119 */
    106120int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
  • trunk/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp

    r28849 r28877  
    11/* $Id$ */
    22/** @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.
    48 */
    59
    610/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     11 * Copyright (C) 2006-2010 Oracle Corporation
    812 *
    913 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3842int rtPathToNative(char **ppszNativePath, const char *pszPath)
    3943{
    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;
    4148}
     49
    4250
    4351int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath)
    4452{
    4553    NOREF(pszBasePath);
    46     return RTStrUtf8ToCurrentCP(ppszNativePath, pszPath);
     54    return rtPathToNative(ppszNativePath, pszPath);
    4755}
    4856
    49 void rtPathFreeNative(char *pszNativePath)
     57
     58void rtPathFreeNative(char *pszNativePath, const char *pszPath)
    5059{
    51     if (pszNativePath)
    52         RTStrFree(pszNativePath);
     60    Assert((const char *)pszNativePath == pszPath || !pszNativePath);
     61    NOREF(pszNativePath);
     62    NOREF(pszPath);
    5363}
    5464
     
    5666int rtPathFromNative(char **pszPath, const char *pszNativePath)
    5767{
    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);
    5972}
    6073
     
    6376{
    6477    NOREF(pszBasePath);
    65     return RTStrCurrentCPToUtf8(pszPath, pszNativePath);
     78    return rtPathFromNative(ppszPath, pszNativePath);
    6679}
    6780
  • trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp

    r28800 r28877  
    7070            && S_ISDIR(s.st_mode);
    7171
    72         rtPathFreeNative(pszNativePath);
     72        rtPathFreeNative(pszNativePath, pszPath);
    7373    }
    7474
     
    110110        }
    111111
    112         rtPathFreeNative(pszNativePath);
     112        rtPathFreeNative(pszNativePath, pszPath);
    113113    }
    114114    else
     
    131131            rc = RTErrConvertFromErrno(errno);
    132132
    133         rtPathFreeNative(pszNativePath);
     133        rtPathFreeNative(pszNativePath, pszPath);
    134134    }
    135135
     
    196196            rc = RTErrConvertFromErrno(errno);
    197197
    198         rtPathFreeNative(pszNativePath);
     198        rtPathFreeNative(pszNativePath, pDir->pszPath);
    199199    }
    200200
  • trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp

    r28800 r28877  
    100100            && S_ISREG(s.st_mode);
    101101
    102         rtPathFreeNative(pszNativePath);
     102        rtPathFreeNative(pszNativePath, pszPath);
    103103    }
    104104
     
    212212    int fh = open(pszNativeFilename, fOpenMode, fMode);
    213213    int iErr = errno;
    214     rtPathFreeNative(pszNativeFilename);
     214    rtPathFreeNative(pszNativeFilename, pszFilename);
    215215#endif
    216216    if (fh >= 0)
     
    378378        if (unlink(pszNativeFilename) != 0)
    379379            rc = RTErrConvertFromErrno(errno);
    380         rtPathFreeNative(pszNativeFilename);
     380        rtPathFreeNative(pszNativeFilename, pszFilename);
    381381    }
    382382    return rc;
  • trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp

    r28800 r28877  
    8181        else
    8282            rc = RTErrConvertFromErrno(errno);
    83         rtPathFreeNative(pszNativeFsPath);
     83        rtPathFreeNative(pszNativeFsPath, pszFsPath);
    8484    }
    8585
     
    115115        else
    116116            rc = RTErrConvertFromErrno(errno);
    117         rtPathFreeNative(pszNativeFsPath);
     117        rtPathFreeNative(pszNativeFsPath, pszFsPath);
    118118    }
    119119    LogFlow(("RTFsQuerySerial(%p:{%s}, %p:{%RX32}: returns %Rrc\n",
     
    155155        else
    156156            rc = RTErrConvertFromErrno(errno);
    157         rtPathFreeNative(pszNativeFsPath);
     157        rtPathFreeNative(pszNativeFsPath, pszFsPath);
    158158    }
    159159
  • trunk/src/VBox/Runtime/r3/posix/path-posix.cpp

    r28800 r28877  
    512512        else
    513513            rc = RTErrConvertFromErrno(errno);
    514         rtPathFreeNative(pszNativePath);
     514        rtPathFreeNative(pszNativePath, pszPath);
    515515    }
    516516
     
    615615            }
    616616        }
    617         rtPathFreeNative(pszNativePath);
     617        rtPathFreeNative(pszNativePath, pszPath);
    618618    }
    619619
     
    789789                     pszSrc, pszDst, fRename, fFileType, rc, errno));
    790790
    791             rtPathFreeNative(pszNativeDst);
     791            rtPathFreeNative(pszNativeDst, pszDst);
    792792        }
    793         rtPathFreeNative(pszNativeSrc);
     793        rtPathFreeNative(pszNativeSrc, pszSrc);
    794794    }
    795795    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette