Utils: Don't call mutable expressions inside QTC_ASSERT

In order to conform to the theory: "Removing all
QTC_ASSERTs and QTC_CHECKs should not change anything".

Change-Id: I6f5c4486afb422301562d79c662fdde026e4d788
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-09 00:06:39 +01:00
parent a6b17d127a
commit 36be7b8375
3 changed files with 11 additions and 6 deletions

View File

@@ -560,7 +560,8 @@ bool DesktopDeviceFileAccess::writeFileContents(
qint64 offset) const
{
QFile file(filePath.path());
QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return false);
const bool isOpened = file.open(QFile::WriteOnly | QFile::Truncate);
QTC_ASSERT(isOpened, return false);
if (offset != 0)
file.seek(offset);
qint64 res = file.write(data);