From 86f52812cd1cdca5f42f65d968a21d8edbd88df6 Mon Sep 17 00:00:00 2001 From: Francis Hart Date: Wed, 29 Aug 2018 04:08:24 +0300 Subject: [PATCH] Fix issue with tab character in shaderc output (#1470) When printing the binary representation of the converted shader, shaderc also prints a comment with the ascii readable characters for each line. For unprintable characters, it relies on isprint() to replace them with the '.' character. Under MSVC 2017, isprint() may incorrectly return true for the tab character. This patch adds a WAR to explicitly test for tabs, to make sure they get replaced with '.'. --- tools/shaderc/shaderc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 1edfccd37..b4d8e9262 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -340,7 +340,7 @@ namespace bgfx bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]); hexPos += 6; - ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; + ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' && data[asciiPos] != '\t' ? data[asciiPos] : '.'; asciiPos++; if (HEX_DUMP_WIDTH == asciiPos)