summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-07-08 15:34:00 +0200
committerMatthias Melcher <github@matthiasm.com>2025-07-08 15:34:11 +0200
commit16aa61efb509a30d4353b7c6a219ceebe9138156 (patch)
tree374e1bfec9c3ac0a291aa038c6b18d5cf3bfd2c5 /fluid
parent5d68428a0058649f07c9be3053bd58fd3462d6d9 (diff)
Fluid: Fix include guard between 0 and 127
if the UCS is not a number or letter
Diffstat (limited to 'fluid')
-rw-r--r--fluid/io/Code_Writer.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/fluid/io/Code_Writer.cxx b/fluid/io/Code_Writer.cxx
index 8bcef2f33..7f265bafa 100644
--- a/fluid/io/Code_Writer.cxx
+++ b/fluid/io/Code_Writer.cxx
@@ -659,12 +659,12 @@ int Code_Writer::write_code(const char *s, const char *t, bool to_codeview) {
macro_name << '_';
while (a < b) {
ucs = fl_utf8decode(a, b, &len);
- if ((ucs == '.') || (ucs == '_')) {
- macro_name << '_';
- } else if (ucs > 0x0000ffff) { // large unicode character
+ if (ucs > 0x0000ffff) { // large unicode character
macro_name << "\\U" << std::setw(8) << std::setfill('0') << std::hex << ucs;
- } else if ((ucs > 127) || !isalnum(ucs)) { // small unicode character or not an ASCI letter or digit
+ } else if (ucs > 127) { // small unicode character or not an ASCI letter or digit
macro_name << "\\u" << std::setw(4) << std::setfill('0') << std::hex << ucs;
+ } else if (!isalnum(ucs)) {
+ macro_name << '_';
} else {
macro_name << (char)ucs;
}