From b08ba5b575f484b10663537504e41e0b28df681a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 2 Dec 2012 20:17:25 +0100 Subject: [PATCH] Preprocessor: Refactoring previous fix --- lib/preprocessor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 5b0761cf1..462e9c53b 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -153,11 +153,11 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename) if (ch == '\\') { unsigned char chNext; - unsigned int spaces = 0; + std::string spaces; #ifdef __GNUC__ // gcc-compatibility: ignore spaces - for (;; spaces++) { + for (;; spaces += ' ') { chNext = (unsigned char)istr.peek(); if (chNext != '\n' && chNext != '\r' && (std::isspace(chNext) || std::iscntrl(chNext))) { @@ -175,8 +175,9 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename) if (chNext == '\n' || chNext == '\r') { ++newlines; (void)readChar(istr,bom); // Skip the "" - } else - code << "\\" << (spaces?" ":""); + } else { + code << "\\" << spaces; + } } else { code << char(ch);