VirtualBox

Ignore:
Timestamp:
Oct 14, 2022 8:14:05 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154125
Message:

Main/Guest Control: Resolved some @todos: Hand-in RTDIRENTRYEX in FsList::AddDirFromHost() so that we don't need to re-create this on the stack each and every time we (recursively) call this function. bugref:10286

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r97151 r97152  
    12101210 *                              Needed for recursion.
    12111211 * @param  cbPathReal           Size (in bytes) of \a pszPathReal.
     1212 * @param  pDirEntry            Where to store looked up directory information for handled paths.
     1213 *                              Needed for recursion.
    12121214 */
    12131215int FsList::AddDirFromHost(const Utf8Str &strPath, const Utf8Str &strSubDir,
    1214                            char *pszPathReal, size_t cbPathReal)
     1216                           char *pszPathReal, size_t cbPathReal, PRTDIRENTRYEX pDirEntry)
    12151217{
    12161218    Utf8Str strPathAbs = strPath;
     
    12491251                    {
    12501252                        /* Retrieve the next directory entry. */
    1251                         RTDIRENTRYEX Entry;
    1252                         vrc = RTDirReadEx(hDir, &Entry, NULL, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
     1253                        vrc = RTDirReadEx(hDir, pDirEntry, NULL, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
    12531254                        if (RT_FAILURE(vrc))
    12541255                        {
     
    12581259                        }
    12591260
    1260                         Utf8Str strEntry = strPathSub + Utf8Str(Entry.szName);
     1261                        Utf8Str strEntry = strPathSub + Utf8Str(pDirEntry->szName);
    12611262
    12621263                        LogFlowFunc(("Entry '%s'\n", strEntry.c_str()));
    12631264
    1264                         switch (Entry.Info.Attr.fMode & RTFS_TYPE_MASK)
     1265                        switch (pDirEntry->Info.Attr.fMode & RTFS_TYPE_MASK)
    12651266                        {
    12661267                            case RTFS_TYPE_DIRECTORY:
    12671268                            {
    12681269                                /* Skip "." and ".." entries. */
    1269                                 if (RTDirEntryExIsStdDotLink(&Entry))
     1270                                if (RTDirEntryExIsStdDotLink(pDirEntry))
    12701271                                    break;
    12711272
     
    12751276                                    break;
    12761277
    1277                                 vrc = AddDirFromHost(strPath, strEntry, pszPathReal, cbPathReal);
     1278                                vrc = AddDirFromHost(strPath, strEntry, pszPathReal, cbPathReal, pDirEntry);
    12781279                                break;
    12791280                            }
     
    12831284                                LogRel2(("Guest Control: File '%s'\n", strEntry.c_str()));
    12841285
    1285                                 vrc = AddEntryFromHost(strEntry, &Entry.Info);
     1286                                vrc = AddEntryFromHost(strEntry, &pDirEntry->Info);
    12861287                                break;
    12871288                            }
     
    12911292                                if (mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks)
    12921293                                {
    1293                                     Utf8Str strEntryAbs = strPathAbs + (const char *)Entry.szName;
     1294                                    Utf8Str strEntryAbs = strPathAbs + (const char *)pDirEntry->szName;
    12941295
    12951296                                    vrc = RTPathReal(strEntryAbs.c_str(), pszPathReal, cbPathReal);
     
    13031304                                                LogRel2(("Guest Control: Symbolic link '%s' -> '%s' (directory)\n",
    13041305                                                         strEntryAbs.c_str(), pszPathReal));
    1305                                                 vrc = AddDirFromHost(strPath, strEntry, pszPathReal, cbPathReal);
     1306                                                vrc = AddDirFromHost(strPath, strEntry, pszPathReal, cbPathReal, pDirEntry);
    13061307                                            }
    13071308                                            else if (RTFS_IS_FILE(objInfo.Attr.fMode))
     
    18091810                    {
    18101811                        char szPathReal[RTPATH_MAX];
    1811                         vrc = pFsList->AddDirFromHost(strSrc /* strPath */, "" /* strSubDir */, szPathReal, sizeof(szPathReal));
     1812                        RTDIRENTRYEX DirEntry;
     1813                        vrc = pFsList->AddDirFromHost(strSrc /* strPath */, "" /* strSubDir */,
     1814                                                      szPathReal, sizeof(szPathReal), &DirEntry);
    18121815                    }
    18131816                    else
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