VirtualBox

Changeset 62723 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 30, 2016 12:02:01 AM (8 years ago)
Author:
vboxsync
Message:

RTDirCreateUniqueNumbered: Changed the implementation to count from zero and only do 20 sequential tries before switching to random numbers. Also, don't bother retrying more than 10000 times. Corrected the cchDigits parameter (nobody counts in signed int!).

File:
1 edited

Legend:

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

    r62473 r62723  
    130130 * Creates a new directory with a unique name by appending a number.
    131131 *
    132  * First it is tried to create the directory without any numbers appended.
    133  * When this fails a number string is appended (starting with 1) separated by
    134  * the optional separator. The numbers are zero padded.
     132 * This API differs from RTDirCreateTemp & RTDirCreateTempSecure in that it
     133 * first tries to create the directory without any random bits, thus the best
     134 * case result will be prettier.  It also differs in that it does not take a
     135 * template, but is instead given a template description, and will only use
     136 * digits for the filling.
     137 *
     138 * For sake of convenience and debugging , the current implementation
     139 * starts at 0 and will increment sequentally for a while before switching to
     140 * random numbers.
    135141 *
    136142 * On success @a pszPath contains the path created.
    137143 *
    138144 * @returns iprt status code.
    139  * @param   pszPath     Path to the directory to create.
    140  * @param   cbSize      The size of pszPath. Needs enough space for holding the
    141  *                      digits and the optional separator.
     145 * @param   pszPath     The path to the directory.  On input the base template
     146 *                      name.  On successful return, the unique directory we
     147 *                      created.
     148 * @param   cbSize      The size of the pszPath buffer.  Needs enough space for
     149 *                      holding the digits and the optional separator.
    142150 * @param   fMode       The mode of the new directory.
    143  * @param   cchDigits   How many digits should the number maximal have.
     151 * @param   cchDigits   How many digits should the number have (zero padded).
    144152 * @param   chSep       The separator used between the path and the number. Can
    145153 *                      be zero. (optional)
    146154 */
    147 RTDECL(int) RTDirCreateUniqueNumbered(char *pszPath, size_t cbSize, RTFMODE fMode, signed int cchDigits, char chSep);
     155RTDECL(int) RTDirCreateUniqueNumbered(char *pszPath, size_t cbSize, RTFMODE fMode, size_t cchDigits, char chSep);
    148156
    149157/**
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