diff options
author | redfish <redfish@galactica.pw> | 2016-05-18 00:52:01 -0400 |
---|---|---|
committer | redfish <redfish@galactica.pw> | 2016-05-18 01:01:58 -0400 |
commit | 6462a3a6db8452523b8c07d8394fbc5dc86f7295 (patch) | |
tree | 3d977b16b1780841e385f31ff17a9b299c8eaa1b | |
parent | Merge pull request #842 (diff) | |
download | monero-6462a3a6db8452523b8c07d8394fbc5dc86f7295.tar.xz |
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
Diffstat (limited to '')
-rw-r--r-- | src/crypto/crypto.cpp | 9 |
1 files 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, |