git repos / blockattack-game

commit 45ab64ae

Poul Sander · 2026-08-19 22:21
45ab64aeecab95feca775ad163b530d1a668a487 patch · browse files
parent f1f3917908b5f03a24f3f11e8ac0c20fc556753f

Clean the source code from non ascii chars.

Changed files

M source/code/DialogBox.hpp before
M source/misc/lint/runLint.sh before
diff --git a/source/code/DialogBox.hpp b/source/code/DialogBox.hpp index 04ad0cf..76701f8 100644 --- a/source/code/DialogBox.hpp +++ b/source/code/DialogBox.hpp
@@ -32,9 +32,9 @@ http://www.blockattack.net
#include "global.hpp"
struct VirtualKeyboard {
- const std::string leftChar = "‹";
- const std::string rightChar = "›";
- const std::string backspace = "«";
+ const std::string leftChar = "\xe2\x80\xb9"; //UTF-8 for left arrow symbol (U+2039)
+ const std::string rightChar = "\xe2\x80\xba"; //UTF-8 for right arrow symbol (U+203A)
+ const std::string backspace = "\xc2\xab"; //UTF-8 for LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB)
std::string alphabet = std::string(_("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
".,:!?+_^@#%&=*")) + leftChar + rightChar + backspace;
diff --git a/source/misc/lint/runLint.sh b/source/misc/lint/runLint.sh index 5e49ccf..2299e39 100644 --- a/source/misc/lint/runLint.sh +++ b/source/misc/lint/runLint.sh
@@ -6,8 +6,10 @@ TMPFILE=$(mktemp /tmp/sago-lint.XXXXXX)
find ./source/code/ -name "*.cpp" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true
find ./source/code/ -name "*.h*" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number "^ " >> ${TMPFILE} || true
+
+
if [ -s "$TMPFILE" ]
-then
+then
echo "In the following places the lines are indended with spaces. This project uses tabs for indentation."
echo "The rule applies to comments too although the check can be bypassed by using either C++ style comments or \" *\" to start a line (Doxygen comments)"
cat "$TMPFILE"
@@ -17,4 +19,19 @@ rm "$TMPFILE"
exit 1
fi
+>> "${TMPFILE}"
+export LANG=C
+find ./source/code/ -name "*.cpp" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number -aRnP '[\x80-\xFF]' >> ${TMPFILE} || true
+find ./source/code/ -name "*.h*" -not -path "./source/code/Libs/*" | xargs --no-run-if-empty grep --with-filename --line-number -aRnP '[\x80-\xFF]' >> ${TMPFILE} || true
+
+if [ -s "$TMPFILE" ]
+then
+echo "In the following places the lines contain non-ASCII characters."
+cat "$TMPFILE"
+echo ""
+echo "Validation failed"
rm "$TMPFILE"
+exit 1
+fi
+
+rm "$TMPFILE"
\ No newline at end of file