From 6462a3a6db8452523b8c07d8394fbc5dc86f7295 Mon Sep 17 00:00:00 2001 From: redfish Date: Wed, 18 May 2016 00:52:01 -0400 Subject: [PATCH] crypto: fix compile error: use named type in sizeof Btw, the warning 4200 remains disabled, but it did not get triggered (GCC 6.1.1, ARM). But, perhaps a better way than disabling the warning would be to do what is suggested here: http://stackoverflow.com/questions/3350852/how-to-correctly-fix-zero-sized-array-in-struct-union-warning-c4200-without%3E --- src/crypto/crypto.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp index e251d0ec2..f5e655274 100644 --- a/src/crypto/crypto.cpp +++ b/src/crypto/crypto.cpp @@ -263,16 +263,17 @@ namespace crypto { PUSH_WARNINGS DISABLE_VS_WARNINGS(4200) + struct ec_point_pair { + ec_point a, b; + }; struct rs_comm { hash h; - struct { - ec_point a, b; - } ab[]; + struct ec_point_pair ab[]; }; POP_WARNINGS static inline size_t rs_comm_size(size_t pubs_count) { - return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]); + return sizeof(rs_comm) + pubs_count * sizeof(ec_point_pair); } void crypto_ops::generate_ring_signature(const hash &prefix_hash, const key_image &image,