From 3ad54f285295590d25a659b052f6f44517a02a31 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 9 Mar 2017 18:06:33 +0100 Subject: [PATCH] Iterate over wxTextFile without using indices Using iterator methods is less error-prone (there is no danger of using an invalid index) and slightly shorter and more clear too. --- src/unix/stdpaths.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unix/stdpaths.cpp b/src/unix/stdpaths.cpp index 76ed1d6b04..4b6140e2f6 100644 --- a/src/unix/stdpaths.cpp +++ b/src/unix/stdpaths.cpp @@ -307,10 +307,10 @@ wxString wxStandardPaths::GetUserDir(Dir userDir) const wxTextFile textFile; if ( textFile.Open(dirsFile.GetFullPath()) ) { - size_t i; - for (i = 0; i < textFile.GetLineCount(); i++) + for ( wxString line = textFile.GetFirstLine(); + !textFile.Eof(); + line = textFile.GetNextLine() ) { - wxString line(textFile[i]); int pos = line.Find(userDirId); if (pos != wxNOT_FOUND) {