VirtualBox

Ignore:
Timestamp:
Nov 19, 2017 2:27:58 PM (7 years ago)
Author:
vboxsync
Message:

iprt/dir: Morphing PRTDIR into a handle named RTDIR. (Been wanting to correct this for years. Don't know why I makde it a pointer rather than an abstrct handle like everything else.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.cpp

    r69500 r69753  
    120120{
    121121public:
    122     VBRDir(const char *pcszPath)
    123         {
    124             int rc = RTDirOpenFiltered(&m_pDir, pcszPath, RTDIRFILTER_WINNT, 0);
    125             if (RT_FAILURE(rc))
    126                 throw RTCError(com::Utf8StrFmt("Failed to open directory '%s'\n", pcszPath));
    127         };
     122    VBRDir(const char *pcszPath) : m_hDir(NIL_RTDIR)
     123    {
     124        int rc = RTDirOpenFiltered(&m_hDir, pcszPath, RTDIRFILTER_WINNT, 0);
     125        if (RT_FAILURE(rc))
     126            throw RTCError(com::Utf8StrFmt("Failed to open directory '%s'\n", pcszPath));
     127    };
    128128    ~VBRDir()
    129         {
    130             int rc = RTDirClose(m_pDir);
    131             AssertRC(rc);
    132         };
     129    {
     130        int rc = RTDirClose(m_hDir);
     131        AssertRC(rc);
     132    };
    133133    const char *next(void)
    134         {
    135             int rc = RTDirRead(m_pDir, &m_DirEntry, NULL);
    136             if (RT_SUCCESS(rc))
    137                 return m_DirEntry.szName;
    138             else if (rc == VERR_NO_MORE_FILES)
    139                 return NULL;
    140             throw RTCError("Failed to read directory element\n");
    141         };
     134    {
     135        int rc = RTDirRead(m_hDir, &m_DirEntry, NULL);
     136        if (RT_SUCCESS(rc))
     137            return m_DirEntry.szName;
     138        if (rc == VERR_NO_MORE_FILES)
     139            return NULL;
     140        throw RTCError("Failed to read directory element\n");
     141    };
    142142
    143143private:
    144     PRTDIR m_pDir;
     144    RTDIR m_hDir;
    145145    RTDIRENTRY m_DirEntry;
    146146};
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