From 441ad9b938d453ccf5bff8867e7d3e6e432f9eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 28 Jul 2017 16:48:35 +0100 Subject: Improve documentation for {QFile, QFileDevice}::resize() - Warn that they can fail if used on non-existent files - Fixed random garbage Change-Id: Ie58aac4a9f4479332ef07d39aecc136b1cfa58e1 Reviewed-by: Thiago Macieira --- src/corelib/io/qfile.cpp | 4 +++- src/corelib/io/qfiledevice.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index f7e711a7cf..64d34aec59 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1038,11 +1038,13 @@ bool QFile::resize(qint64 sz) /*! \overload - Sets \a fileName to size (in bytes) \a sz. Returns \c true if the file if + Sets \a fileName to size (in bytes) \a sz. Returns \c true if the resize succeeds; false otherwise. If \a sz is larger than \a fileName currently is the new bytes will be set to 0, if \a sz is smaller the file is simply truncated. + \warning This function can fail if the file doesn't exist. + \sa resize() */ diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index 715dc7293a..f50949e6c1 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -615,6 +615,8 @@ qint64 QFileDevice::size() const currently is, the new bytes will be set to 0; if \a sz is smaller, the file is simply truncated. + \warning This function can fail if the file doesn't exist. + \sa size() */ bool QFileDevice::resize(qint64 sz) -- cgit v1.2.3