diff --git a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala index 0b0ab4814..8a75414d5 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala @@ -905,7 +905,7 @@ class CppCompiler( outHdr.puts(s"static const std::set::type> _values_$enumClass;") val enumClassAbs = types2class(curClass ++ List(enumName)) val valuesSetAbsRef = s"${types2class(curClass)}::_values_$enumClass" - val setEntriesStr = enumColl.map { case (id, _) => s"$id" }.mkString(", ") + val setEntriesStr = enumColl.map { case (id, _) => translator.doIntLiteral(id) }.mkString(", ") outSrc.puts(s"const std::set::type> $valuesSetAbsRef{$setEntriesStr};") } } diff --git a/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala index 20453406f..884737312 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/PHPCompiler.scala @@ -440,7 +440,7 @@ class PHPCompiler(typeProvider: ClassTypeProvider, config: RuntimeConfig) out.puts(s"const ${value2Const(label.name)} = ${translator.doIntLiteral(id)};") } out.puts - val arrayEntriesStr = enumColl.map { case (id, _) => s"$id => true" }.mkString(", ") + val arrayEntriesStr = enumColl.map { case (id, _) => s"${translator.doIntLiteral(id)} => true" }.mkString(", ") out.puts(s"private const _VALUES = [$arrayEntriesStr];") out.puts out.puts("public static function isDefined(int $v): bool {")