libp11 icon indicating copy to clipboard operation
libp11 copied to clipboard

true/false variables compile error

Open dlegaultbbry opened this issue 3 years ago • 2 comments

On platforms which have stdbool.h and the true/false as macros, things like below cause issues

p11_attr.c: In function 'pkcs11_addattr_bool': p11_attr.c:126:18: error: expected identifier or '(' before numeric constant static CK_BBOOL true = CK_TRUE; ^~~~ p11_attr.c:127:18: error: expected identifier or '(' before numeric constant static CK_BBOOL false = CK_FALSE; ^~~~~ p11_attr.c:128:37: error: lvalue required as unary '&' operand pkcs11_addattr(tmpl, type, value ? &true : &false, sizeof(CK_BBOOL)); ^ p11_attr.c:128:45: error: lvalue required as unary '&' operand pkcs11_addattr(tmpl, type, value ? &true : &false, sizeof(CK_BBOOL));

Maybe convert these to _false and _true or some other name to avoid name clashes?

dlegaultbbry avatar Aug 31 '22 11:08 dlegaultbbry

Using _true/_false is common practice. Do you want to submit a PR with such changes?

Jakuje avatar Aug 31 '22 20:08 Jakuje

I can do that. I'll setup everything and send something in the next few days.

dlegaultbbry avatar Aug 31 '22 23:08 dlegaultbbry