From 935ddbd3a2350dd57978894b00d7a57a7488d571 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 9 Dec 2015 14:37:11 +0100 Subject: qmake: simplify file-reading loop in findMocs Change-Id: If436215c6041551782750f107021fcccbd447b32 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefiledeps.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 635a775cb3..037ad06ad3 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -872,7 +872,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) files_changed = true; file->moc_checked = true; - int buffer_len; + int buffer_len = 0; char *buffer = 0; { struct stat fst; @@ -890,9 +890,9 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) return false; //shouldn't happen } buffer = getBuffer(fst.st_size); - for(int have_read = buffer_len = 0; - (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len)); - buffer_len += have_read) ; + while (int have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len)) + buffer_len += have_read; + QT_CLOSE(fd); } -- cgit v1.2.1