Changeset 683
- Timestamp:
- Mar 15, 2010, 6:30:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qfsfileengine_iterator_os2.cpp
r659 r683 128 128 if (!path.endsWith(QLatin1Char('/'))) 129 129 path.append(QLatin1Char('/')); 130 // check that the drive is ready before trying to open it which reduces 131 // delays and noise for drives with no media inserted 132 BYTE drv[3] = { path.at(0).cell(), ':', '\0' }; 133 BYTE buf[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; 134 ULONG bufSize = sizeof(buf); 135 PFSQBUFFER2 pfsq = (PFSQBUFFER2) buf; 136 APIRET arc = DosQueryFSAttach(drv, 0, FSAIL_QUERYNAME, pfsq, &bufSize); 130 APIRET arc = NO_ERROR; 131 if (path.size() >= 2 && path.at(0).isLetter() && path.at(1) == QLatin1Char(':')) { 132 // check that the drive is ready before trying to open it which reduces 133 // delays and noise for drives with no media inserted 134 BYTE drv[3] = { path.at(0).cell(), ':', '\0' }; 135 BYTE buf[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; 136 ULONG bufSize = sizeof(buf); 137 PFSQBUFFER2 pfsq = (PFSQBUFFER2) buf; 138 arc = DosQueryFSAttach(drv, 0, FSAIL_QUERYNAME, pfsq, &bufSize); 139 } 137 140 if (arc != NO_ERROR) { 138 141 that->platform->dir = 0; … … 141 144 that->platform->done = true; 142 145 } else { 143 // ### Race condition; we should use fpathconf and dirfd(). 144 long maxPathName = ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); 145 if ((int) maxPathName == -1) 146 maxPathName = FILENAME_MAX; 146 long maxPathName = CCHMAXPATH; 147 147 maxPathName += sizeof(dirent) + 1; 148 148 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
Note:
See TracChangeset
for help on using the changeset viewer.