VirtualBox

Changeset 85028 in vbox for trunk/src/VBox/GuestHost


Ignore:
Timestamp:
Jul 1, 2020 2:37:53 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138929
Message:

DnD: DnDPathSanitizeFilename() -> DnDPathSanitize().

Location:
trunk/src/VBox/GuestHost/DragAndDrop
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDDroppedFiles.cpp

    r85027 r85028  
    179179        }
    180180
    181         rc = DnDPathSanitizeFilename(szTime, sizeof(szTime));
     181        rc = DnDPathSanitize(szTime, sizeof(szTime));
    182182        if (RT_FAILURE(rc))
    183183            break;
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp

    r85003 r85028  
    3131
    3232/**
    33  * Sanitizes the file name component so that unsupported characters
    34  * will be replaced by an underscore ("_").
     33 * Sanitizes a path so that unsupported characters will be replaced by an underscore ("_").
    3534 *
    3635 * @return  IPRT status code.
     
    3837 * @param   cbPath              Size (in bytes) of path to sanitize.
    3938 */
    40 int DnDPathSanitizeFilename(char *pszPath, size_t cbPath)
     39int DnDPathSanitize(char *pszPath, size_t cbPath)
    4140{
     41    if (!pszPath) /* No path given? Bail out early. */
     42        return VINF_SUCCESS;
     43
     44    AssertReturn(cbPath, VERR_INVALID_PARAMETER);
     45
    4246    int rc = VINF_SUCCESS;
    4347#ifdef RT_OS_WINDOWS
     
    5761        '\0'
    5862    };
    59     char *pszFilename = RTPathFilename(pszPath);
    60     if (pszFilename)
    61     {
    62         ssize_t cReplaced = RTStrPurgeComplementSet(pszFilename, s_uszValidRangePairs, '_' /* chReplacement */);
    63         if (cReplaced < 0)
    64             rc = VERR_INVALID_UTF8_ENCODING;
    65     }
    66     else
    67         rc = VERR_INVALID_PARAMETER;
     63
     64    ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, s_uszValidRangePairs, '_' /* chReplacement */);
     65    if (cReplaced < 0)
     66        rc = VERR_INVALID_UTF8_ENCODING;
    6867#else
    6968    RT_NOREF2(pszPath, cbPath);
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