OSDN Git Service

remove redundant QFileSystemEntry constructor
authorIvailo Monev <xakepa10@laimg.moc>
Fri, 13 Dec 2019 01:20:10 +0000 (01:20 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Fri, 13 Dec 2019 01:20:10 +0000 (01:20 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/io/qdir.cpp
src/core/io/qfilesystementry.cpp
src/core/io/qfilesystementry_p.h
src/core/io/qtemporaryfile.cpp

index 7f880ea..cf7e635 100644 (file)
@@ -155,7 +155,7 @@ inline void QDirPrivate::setPath(const QString &path)
         p.truncate(p.length() - 1);
     }
 
-    dirEntry = QFileSystemEntry(p, QFileSystemEntry::FromInternalPath());
+    dirEntry = QFileSystemEntry(p);
     metaData.clear();
     initFileEngine();
     clearFileLists();
@@ -186,7 +186,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
         absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
     }
 
-    absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath());
+    absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName));
 }
 
 /* For sorting */
index bc8ed0f..9a97307 100644 (file)
@@ -68,23 +68,6 @@ QFileSystemEntry::QFileSystemEntry(const QString &filePath)
 
 /*!
    \internal
-   Use this constructor when the path is guaranteed to be in internal format, i.e. all
-   directory separators are '/' and not the native separator.
- */
-QFileSystemEntry::QFileSystemEntry(const QString &filePath, FromInternalPath /* dummy */)
-    : m_filePath(filePath),
-    m_lastSeparator(-2),
-    m_firstDotInFileName(-2),
-    m_lastDotInFileName(0)
-{
-    resolveFilePath();
-    resolveNativeFilePath();
-    findLastSeparator();
-    findFileNameSeparators();
-}
-
-/*!
-   \internal
    Use this constructor when the path comes from a native API
  */
 QFileSystemEntry::QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath /* dummy */)
index cee406d..9e6dd91 100644 (file)
@@ -54,14 +54,11 @@ class QFileSystemEntry
 public:
     typedef QByteArray NativePath;
     struct FromNativePath{};
-    struct FromInternalPath{};
 
     QFileSystemEntry();
     explicit QFileSystemEntry(const QString &filePath);
-
-    QFileSystemEntry(const QString &filePath, FromInternalPath dummy);
-    QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath dummy);
-    QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath);
+    explicit QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath dummy);
+    explicit QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath);
 
     QString filePath() const;
     QString fileName() const;
index 3cd8c18..a45bcef 100644 (file)
@@ -275,9 +275,8 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
         qfilename.append(QLatin1String(".XXXXXX"));
 
     // "Nativify" :-)
-    QFileSystemEntry::NativePath filename = QFileSystemEngine::absoluteName(
-            QFileSystemEntry(qfilename, QFileSystemEntry::FromInternalPath()))
-        .nativeFilePath();
+    QFileSystemEntry::NativePath filename =
+        QFileSystemEngine::absoluteName(QFileSystemEntry(qfilename)).nativeFilePath();
 
     // Find mask in native path
     phPos = filename.length();