VirtualBox

Changeset 58068 in vbox for trunk/include/iprt/uri.h


Ignore:
Timestamp:
Oct 6, 2015 11:47:43 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103124
Message:

IPRT: Added RTUriFilePathEx, removed RTUriFileNPath as we ignored the cchMax param. Fixed special handling of 'file://localhost/C:/Windows/memory.dmp' style URLs as well as teating '|' as an alternative to the drive letter ':' character. Also extended testcases with windows legacy encodings and taught RTUriFilePathEx to handle them. (RTUriFilePath is calling RTUriFilePathEx of course.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/uri.h

    r58067 r58068  
    297297 *                          pointer to a NULL pointer.  If *ppszUri is NULL or
    298298 *                          cbUri is zero a buffer of at least cbUri chars will
    299  *                          be allocated to hold the URL.  If a buffer was
     299 *                          be allocated to hold the URI.  If a buffer was
    300300 *                          requested it must be freed using RTStrFree().
    301301 * @param   cbUri           The buffer size in bytes (includes terminator).
     
    312312
    313313/**
    314  * Returns the file path encoded in the URI.
     314 * Returns the file path encoded in the file URI.
    315315 *
    316316 * @returns the path if the URI contains one, NULL otherwise.
     
    321321
    322322/**
    323  * Returns the file path encoded in the URI, given a max string length.
    324  *
    325  * @returns the path if the URI contains one, NULL otherwise.
    326  * @param   pszUri              The URI to extract from.
    327  * @param   uFormat             In which format should the path returned.
    328  * @param   cchMax              The max string length to inspect.
    329  */
    330 RTDECL(char *) RTUriFileNPath(const char *pszUri, uint32_t uFormat, size_t cchMax);
     323 * Queries the file path for the given file URI.
     324 *
     325 * This API works like RTStrToUtf16Ex with regard to result allocation or
     326 * buffering (i.e. it's a bit complicated but very flexible).
     327 *
     328 * This differs a quite a bit from RTUriParsedPath in that it tries to be
     329 * compatible with URL produced by older windows version.  This API is basically
     330 * producing the same results as the PathCreateFromUrl API on Windows.
     331 *
     332 * @returns IPRT status code.
     333 * @retval  VERR_URI_NOT_FILE_SCHEME if not file scheme.
     334 *
     335 * @param   pszUri          The alleged file:// URI.
     336 * @param   fPathStyle      The output path style, exactly one of
     337 *                          RTPATH_STR_F_STYLE_HOST, RTPATH_STR_F_STYLE_DOS and
     338 *                          RTPATH_STR_F_STYLE_UNIX.  Must include iprt/path.h.
     339 * @param   ppszPath        If cbPath is non-zero, this must either be pointing
     340 *                          to pointer to a buffer of the specified size, or
     341 *                          pointer to a NULL pointer.  If *ppszPath is NULL or
     342 *                          cbPath is zero a buffer of at least cbPath chars
     343 *                          will be allocated to hold the path.  If a buffer was
     344 *                          requested it must be freed using RTStrFree().
     345 * @param   cbPath          The buffer size in bytes (includes terminator).
     346 * @param   pcchPath        Where to store the length of the path string,
     347 *                          excluding the terminator. (Optional)
     348 *
     349 *                          This may be set under some error conditions,
     350 *                          however, only for VERR_BUFFER_OVERFLOW and
     351 *                          VERR_NO_STR_MEMORY will it contain a valid string
     352 *                          length that can be used to resize the buffer.
     353 * @sa      RTUriParsedPath, RTUriFilePath
     354 */
     355RTDECL(int) RTUriFilePathEx(const char *pszUri, uint32_t fPathStyle, char **ppszPath, size_t cbPath, size_t *pcchPath);
    331356
    332357/** @} */
Note: See TracChangeset for help on using the changeset viewer.

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