From 37f98eb60572ff72b335616df6959eff95b32517 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 27 Mar 2024 20:14:39 +0800 Subject: [PATCH] fix: char > 127 when test in fix point exponent --- tools/astyle/ASFormatter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/astyle/ASFormatter.cpp b/tools/astyle/ASFormatter.cpp index d14b971b..96c69026 100644 --- a/tools/astyle/ASFormatter.cpp +++ b/tools/astyle/ASFormatter.cpp @@ -3598,7 +3598,7 @@ bool ASFormatter::isInExponent() const return false; int i = charNum - 1; - char prevChar = currentLine[i]; + unsigned char prevChar = currentLine[i]; if (prevChar == 'e' || prevChar == 'E') { i--; @@ -3613,7 +3613,8 @@ bool ASFormatter::isInExponent() const } else if (isDigit(prevChar)) { numCount++; } else { - if (isLetterOrUnderLine(prevChar) || prevChar == '$') + if (isLetterOrUnderLine(prevChar) || prevChar == '$' + || prevChar>127) return false; break; } @@ -3647,7 +3648,8 @@ bool ASFormatter::isInExponent() const return false; hasX = true; } else { - if (isLetterOrUnderLine(prevChar) || prevChar == '$') + if (isLetterOrUnderLine(prevChar) || prevChar == '$' + || prevChar>127) return false; break; }