summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2017-07-28 16:48:35 +0100
committerSérgio Martins <sergio.martins@kdab.com>2017-08-03 08:42:21 +0000
commit441ad9b938d453ccf5bff8867e7d3e6e432f9eba (patch)
tree2cd8767f7b02cefbb25b98754b10e9c228a906bd
parent85612817685f8b64307276a2ce9ef79d9e048be4 (diff)
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 <thiago.macieira@intel.com>
-rw-r--r--src/corelib/io/qfile.cpp4
-rw-r--r--src/corelib/io/qfiledevice.cpp2
2 files changed, 5 insertions, 1 deletions
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)