Browse Source

Avoid char literals in auto-generated AppConfig.h files

tags/2021-05-28
hogliux 9 years ago
parent
commit
b6f4d353e8
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      extras/Projucer/Source/Project Saving/jucer_ProjectSaver.cpp

+ 8
- 1
extras/Projucer/Source/Project Saving/jucer_ProjectSaver.cpp View File

@@ -56,7 +56,14 @@ namespace
inline String valueToCharLiteral (const var& v) inline String valueToCharLiteral (const var& v)
{ {
return CppTokeniserFunctions::addEscapeChars (v.toString().trim().substring (0, 4)).quoted ('\'');
String fourCharCode = v.toString().trim().substring (0, 4);
uint32 hexRepresentation = 0;
for (int i = 0; i < 4; ++i)
hexRepresentation = (hexRepresentation << 8U)
| (static_cast<unsigned int> (fourCharCode[i]) & 0xffU);
return String ("0x") + String::toHexString (static_cast<int> (hexRepresentation));
} }
} }


Loading…
Cancel
Save