From bbafdf58124266db9c4285838f1a300e8afa0371 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 22 May 2012 16:27:47 +0200 Subject: [PATCH] Clarified code documentation for QFileInfo::operator==. QTBUG-4031 mentions that canonicalFilePath() will cause the operator to return true for the following comparison because it returns an empty string if the path is empty or non-existant: QFileInfo("") == QFileInfo("non_existant_file") I'm assuming that the reason for not checking whether one of the files exist is based on performance, and so I've updated the comments for the operator to explicitly state that the result of the above comparison is undefined. Task-number: QTBUG-4031 Change-Id: I9b34f189f1628f9362b3604445706abd2342fd6e Reviewed-by: Thiago Macieira --- src/corelib/io/qfileinfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index e533511a2b..4973ecb773 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -379,7 +379,8 @@ QFileInfo::~QFileInfo() location as \a fileinfo; otherwise returns false. Note that the result of comparing two empty QFileInfo objects, - containing no file references, is undefined. + containing no file references (file paths that do not exist or + are empty), is undefined. \warning This will not compare two different symbolic links pointing to the same file.