New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize syntax around sizeof(foo) #4875
Conversation
@@ -317,7 +317,7 @@ static int CreateSocketPair (int SocketFamily, | |||
/* | |||
** Initialize the socket information | |||
*/ | |||
slen = sizeof (sin); | |||
slen = sizeof(sin); | |||
memset ((char *) &sin, 0, slen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as in #4876, but three occurrences here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If cross-compared to master, it might be more appropriate to dismiss this comment, even in #4876. I mean it's probably more appropriate to address it separately [if at all].
crypto/ec/ec_mult.c
Outdated
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space | ||
wsize = OPENSSL_malloc(totalnum * sizeof(wsize[0])); | ||
wNAF_len = OPENSSL_malloc(totalnum * sizeof(wNAF_len[0])); | ||
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof(wNAF[0])); /* includes space | ||
* for pivot */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jagged comment
test/igetest.c
Outdated
@@ -200,16 +200,16 @@ static int run_test_vectors(void) | |||
assert(v->length <= MAX_VECTOR_SIZE); | |||
|
|||
if (v->encrypt == AES_ENCRYPT) | |||
AES_set_encrypt_key(v->key, 8 * sizeof v->key, &key); | |||
AES_set_encrypt_key(v->key, 8 * sizeof(v)->key, &key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This aint right. It's sizeof(v->key)
, not sizeof(v)->key
.
test/igetest.c
Outdated
else | ||
AES_set_decrypt_key(v->key, 8 * sizeof v->key, &key); | ||
memcpy(iv, v->iv, sizeof iv); | ||
AES_set_decrypt_key(v->key, 8 * sizeof(v)->key, &key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
I don't want to fix anything other than the sizeof uses here. |
Also fixed the "jagged comment" in crypto/ec/ec_mult.c |
crypto/bn/exptest.c
Outdated
@@ -183,7 +183,7 @@ int main(int argc, char *argv[]) | |||
unsigned char c; | |||
BIGNUM *r_mont, *r_mont_const, *r_recp, *r_simple, *a, *b, *m; | |||
|
|||
RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we | |||
RAND_seed(rnd_seed, sizeof(rnd_seed)); /* or BN_rand may fail, and we | |||
* don't even check its return | |||
* value (which we should) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another jagged comment... Even in #4876...
@@ -252,15 +252,15 @@ int OpenSocket(int nPort) | |||
} | |||
|
|||
if (setsockopt | |||
(nSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof one) < 0) { | |||
(nSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an incompliant formatting! Side note!
Reformat comment.
Added commit to fix the exptest comment-wrapping issue. |
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #4875)
Thanks for the feedback; merged to 1.0.2 |
This is the #4872 done for 1.0.2