From 5a174e79804c992fd4583f8f5d60cc15bb5072ba Mon Sep 17 00:00:00 2001 From: Christophe Le Roy Date: Sat, 8 Oct 2016 20:05:03 +0200 Subject: [PATCH] parseColorsStream: fix comment stripping p is incremented too soon to be able to see '#' on first character. Use a conventional for loop. --- TileGenerator.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index e32ab17..74f8fa2 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -261,15 +261,14 @@ void TileGenerator::generate(const std::string &input, const std::string &output void TileGenerator::parseColorsStream(std::istream &in) { - char line[128], *p; + char line[128]; while (in.good()) { in.getline(line, 128); - p = line; - while(*p++ != '\0') { - if(*p != '#') - continue; - *p = '\0'; // Cut off at the first # - break; + for (char *p = line; *p != '\0'; ++p) { + if(*p == '#') { + *p = '\0'; // Cut off at the first # + break; + } } char name[64];