From 1fa95de554b35340816a18750be87eea993ca06d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 14 Jul 2014 22:58:49 -0400 Subject: [PATCH] cdvdGigaherz: Simplify the loops within readLine and readLineW --- plugins/cdvdGigaherz/src/FileStream.cpp | 34 ++++++++++--------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/plugins/cdvdGigaherz/src/FileStream.cpp b/plugins/cdvdGigaherz/src/FileStream.cpp index f8a21ca906..ddf3b196aa 100644 --- a/plugins/cdvdGigaherz/src/FileStream.cpp +++ b/plugins/cdvdGigaherz/src/FileStream.cpp @@ -98,20 +98,17 @@ int FileStream::read(byte* b, int len) string FileStream::readLine() { string s; - char c; s.clear(); - do { - if(eof()) + while (!eof()) + { + char c = read(); + + if ((c == '\n') || (c == '\r') || (c == '\0')) break; - c = read(); - - if((c=='\n')||(c=='\r')||(c==0)) - break; - - s.append(1,c); - } while(true); + s.append(1, c); + } return s; } @@ -119,20 +116,17 @@ string FileStream::readLine() wstring FileStream::readLineW() { wstring s; - wchar_t c; s.clear(); - do { - if(eof()) + while (!eof()) + { + wchar_t c = read(); + + if ((c == L'\n') || (c == L'\r') || (c == L'\0')) break; - c = read(); - - if((c==L'\n')||(c==L'\r')||(c==0)) - break; - - s.append(1,c); - } while(true); + s.append(1, c); + } return s; }