VirtualBox

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


Ignore:
Timestamp:
Aug 1, 2016 1:02:02 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
109403
Message:

GuestHost/DragAndDrop: warnings

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

Legend:

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

    r62492 r62816  
    111111    {
    112112        char pszDropDir[RTPATH_MAX];
    113         size_t cchDropDir = RTStrPrintf(pszDropDir, sizeof(pszDropDir), "%s", pszPath);
     113        RTStrPrintf(pszDropDir, sizeof(pszDropDir), "%s", pszPath);
    114114
    115115        /** @todo On Windows we also could use the registry to override
     
    229229        if (RT_SUCCESS(rc2))
    230230            this->m_lstFiles.removeAt(i);
    231 
    232         if (RT_SUCCESS(rc))
     231        else if (RT_SUCCESS(rc))
    233232           rc = rc2;
    234233        /* Keep going. */
     
    240239        if (RT_SUCCESS(rc2))
    241240            this->m_lstDirs.removeAt(i);
    242 
    243         if (RT_SUCCESS(rc))
     241        else if (RT_SUCCESS(rc))
    244242            rc = rc2;
    245243        /* Keep going. */
     
    258256            rc2 = RTDirRemove(this->m_strPathAbs.c_str());
    259257        }
    260     }
    261 
    262     if (RT_SUCCESS(rc))
    263         rc = rc2;
    264 
    265     LogFlowFuncLeaveRC(rc);
    266     return rc;
    267 }
    268 
     258        if (RT_SUCCESS(rc))
     259            rc = rc2;
     260    }
     261
     262    LogFlowFuncLeaveRC(rc);
     263    return rc;
     264}
     265
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp

    r62492 r62816  
    11/* $Id$ */
    22/** @file
    3  * DnD: Path handling.
     3 * DnD - Path handling.
    44 */
    55
     
    3838    int rc = VINF_SUCCESS;
    3939#ifdef RT_OS_WINDOWS
     40    RT_NOREF1(cbPath);
    4041    /* Filter out characters not allowed on Windows platforms, put in by
    4142       RTTimeSpecToString(). */
    4243    /** @todo Use something like RTPathSanitize() when available. Later. */
    43     RTUNICP aCpSet[] =
    44         { ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_',
    45           0xa0, 0xd7af, '\0' };
    46     ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, aCpSet, '_' /* Replacement */);
     44    static const RTUNICP s_aCpSet[] =
     45    {
     46        ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_',
     47        0xa0, 0xd7af, '\0'
     48    };
     49    ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, s_aCpSet, '_' /* Replacement */);
    4750    if (cReplaced < 0)
    4851        rc = VERR_INVALID_UTF8_ENCODING;
     52#else
     53    RT_NOREF2(pszPath, cbPath);
    4954#endif
    5055    return rc;
     
    5459{
    5560    /** @todo */
     61    RT_NOREF2(pszPath, cbPath);
    5662    return VINF_SUCCESS;
    5763}
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp

    r62492 r62816  
    129129            rc = addEntry(pcszSrcPath, &pcszDstPath[cchDstBase], fFlags);
    130130
    131             PRTDIR hDir;
    132131            if (RT_SUCCESS(rc))
     132            {
     133                PRTDIR hDir;
    133134                rc = RTDirOpen(&hDir, pcszSrcPath);
    134             if (RT_SUCCESS(rc))
    135             {
    136                 do
     135                if (RT_SUCCESS(rc))
    137136                {
    138                     RTDIRENTRY DirEntry;
    139                     rc = RTDirRead(hDir, &DirEntry, NULL);
    140                     if (RT_FAILURE(rc))
     137                    do
    141138                    {
    142                         if (rc == VERR_NO_MORE_FILES)
    143                             rc = VINF_SUCCESS;
    144                         break;
    145                     }
    146 
    147                     switch (DirEntry.enmType)
    148                     {
    149                         case RTDIRENTRYTYPE_DIRECTORY:
     139                        RTDIRENTRY DirEntry;
     140                        rc = RTDirRead(hDir, &DirEntry, NULL);
     141                        if (RT_FAILURE(rc))
    150142                        {
    151                             /* Skip "." and ".." entries. */
    152                             if (   RTStrCmp(DirEntry.szName, ".")  == 0
    153                                 || RTStrCmp(DirEntry.szName, "..") == 0)
    154                                 break;
    155 
    156                             char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
    157                             if (pszSrc)
    158                             {
    159                                 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
    160                                 if (pszDst)
    161                                 {
    162                                     rc = appendPathRecursive(pszSrc, pszDst, pcszDstBase, cchDstBase, fFlags);
    163                                     RTStrFree(pszDst);
    164                                 }
    165                                 else
    166                                     rc = VERR_NO_MEMORY;
    167 
    168                                 RTStrFree(pszSrc);
    169                             }
    170                             else
    171                                 rc = VERR_NO_MEMORY;
     143                            if (rc == VERR_NO_MORE_FILES)
     144                                rc = VINF_SUCCESS;
    172145                            break;
    173146                        }
    174147
    175                         case RTDIRENTRYTYPE_FILE:
     148                        switch (DirEntry.enmType)
    176149                        {
    177                             char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
    178                             if (pszSrc)
     150                            case RTDIRENTRYTYPE_DIRECTORY:
    179151                            {
    180                                 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
    181                                 if (pszDst)
    182                                 {
    183                                     rc = addEntry(pszSrc, &pszDst[cchDstBase], fFlags);
    184                                     RTStrFree(pszDst);
    185                                 }
    186                                 else
    187                                     rc = VERR_NO_MEMORY;
    188                                 RTStrFree(pszSrc);
    189                             }
    190                             else
    191                                 rc = VERR_NO_MEMORY;
    192                             break;
    193                         }
    194                         case RTDIRENTRYTYPE_SYMLINK:
    195                         {
    196                             if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS)
    197                             {
    198                                 char *pszSrc = RTPathRealDup(pcszDstBase);
     152                                /* Skip "." and ".." entries. */
     153                                if (   RTStrCmp(DirEntry.szName, ".")  == 0
     154                                    || RTStrCmp(DirEntry.szName, "..") == 0)
     155                                    break;
     156
     157                                char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
    199158                                if (pszSrc)
    200159                                {
    201                                     rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING);
    202                                     if (RT_SUCCESS(rc))
     160                                    char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
     161                                    if (pszDst)
    203162                                    {
    204                                         if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
    205                                         {
    206                                             LogFlowFunc(("Directory entry is symlink to directory\n"));
    207                                             rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags);
    208                                         }
    209                                         else if (RTFS_IS_FILE(objInfo.Attr.fMode))
    210                                         {
    211                                             LogFlowFunc(("Directory entry is symlink to file\n"));
    212                                             rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags);
    213                                         }
    214                                         else
    215                                             rc = VERR_NOT_SUPPORTED;
     163                                        rc = appendPathRecursive(pszSrc, pszDst, pcszDstBase, cchDstBase, fFlags);
     164                                        RTStrFree(pszDst);
    216165                                    }
     166                                    else
     167                                        rc = VERR_NO_MEMORY;
    217168
    218169                                    RTStrFree(pszSrc);
     
    220171                                else
    221172                                    rc = VERR_NO_MEMORY;
     173                                break;
    222174                            }
    223                             break;
     175
     176                            case RTDIRENTRYTYPE_FILE:
     177                            {
     178                                char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
     179                                if (pszSrc)
     180                                {
     181                                    char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
     182                                    if (pszDst)
     183                                    {
     184                                        rc = addEntry(pszSrc, &pszDst[cchDstBase], fFlags);
     185                                        RTStrFree(pszDst);
     186                                    }
     187                                    else
     188                                        rc = VERR_NO_MEMORY;
     189                                    RTStrFree(pszSrc);
     190                                }
     191                                else
     192                                    rc = VERR_NO_MEMORY;
     193                                break;
     194                            }
     195                            case RTDIRENTRYTYPE_SYMLINK:
     196                            {
     197                                if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS)
     198                                {
     199                                    char *pszSrc = RTPathRealDup(pcszDstBase);
     200                                    if (pszSrc)
     201                                    {
     202                                        rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING);
     203                                        if (RT_SUCCESS(rc))
     204                                        {
     205                                            if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
     206                                            {
     207                                                LogFlowFunc(("Directory entry is symlink to directory\n"));
     208                                                rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags);
     209                                            }
     210                                            else if (RTFS_IS_FILE(objInfo.Attr.fMode))
     211                                            {
     212                                                LogFlowFunc(("Directory entry is symlink to file\n"));
     213                                                rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags);
     214                                            }
     215                                            else
     216                                                rc = VERR_NOT_SUPPORTED;
     217                                        }
     218
     219                                        RTStrFree(pszSrc);
     220                                    }
     221                                    else
     222                                        rc = VERR_NO_MEMORY;
     223                                }
     224                                break;
     225                            }
     226
     227                            default:
     228                                break;
    224229                        }
    225230
    226                         default:
    227                             break;
    228                     }
    229 
    230                 } while (RT_SUCCESS(rc));
    231 
    232                 RTDirClose(hDir);
     231                    } while (RT_SUCCESS(rc));
     232
     233                    RTDirClose(hDir);
     234                }
    233235            }
    234236        }
     
    446448int DnDURIList::RootFromURIData(const void *pvData, size_t cbData, uint32_t fFlags)
    447449{
     450    Assert(fFlags == 0); RT_NOREF1(fFlags);
    448451    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
    449452    AssertReturn(cbData, VERR_INVALID_PARAMETER);
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp

    r59838 r62816  
    134134                         uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */, uint32_t fFlags /* = 0 */)
    135135{
     136    Assert(fFlags == 0); RT_NOREF1(fFlags);
    136137    int rc = VINF_SUCCESS;
    137138
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