asn1: Generate 1/0 instead of TRUE/FALSE

TRUE/FALSE may not be defined, so emitting those symbols when generating
code for `... BOOLEAN DEFAULT TRUE -- or FALSE` causes the generated
code to fail to compile.  We could move the definitions of TRUE/FALSE to
krb5-types.h, or maybe we could have an asn1_compile option to force
inclusion of more than one header file so we can have headers defining
such constants.  But the simplest fix is to just emit 1/0 instead of
TRUE/FALSE.

This explains why some BOOLEAN DEFAULT usages in PKIX are made OPTIONAL
in Heimdal.
This commit is contained in:
Nicolas Williams
2020-12-17 11:58:22 -06:00
parent 7d5c309eee
commit 23f553ffd5

View File

@@ -324,9 +324,9 @@ gen_assign_defval(const char *var, struct value *val)
break;
case booleanvalue:
if(val->u.booleanvalue)
fprintf(codefile, "%s = TRUE;\n", var);
fprintf(codefile, "%s = 1;\n", var);
else
fprintf(codefile, "%s = FALSE;\n", var);
fprintf(codefile, "%s = 0;\n", var);
break;
default:
abort();