[Python-checkins] cpython: Issue #26798: for loop initial declarations are only allowed in C99 or C11 mode
christian.heimes
python-checkins at python.org
Tue Sep 6 17:18:11 EDT 2016
https://hg.python.org/cpython/rev/be6f3449ac13
changeset: 103145:be6f3449ac13
user: Christian Heimes <christian at python.org>
date: Tue Sep 06 23:18:03 2016 +0200
summary:
Issue #26798: for loop initial declarations are only allowed in C99 or C11 mode
files:
Modules/_blake2/impl/blake2b-ref.c | 6 ++++--
Modules/_blake2/impl/blake2b.c | 6 ++++--
Modules/_blake2/impl/blake2s-ref.c | 6 ++++--
Modules/_blake2/impl/blake2s.c | 9 ++++++---
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Modules/_blake2/impl/blake2b-ref.c b/Modules/_blake2/impl/blake2b-ref.c
--- a/Modules/_blake2/impl/blake2b-ref.c
+++ b/Modules/_blake2/impl/blake2b-ref.c
@@ -145,9 +145,10 @@
BLAKE2_LOCAL_INLINE(int) blake2b_init0( blake2b_state *S )
{
+ int i;
memset( S, 0, sizeof( blake2b_state ) );
- for( int i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
+ for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
return 0;
}
@@ -319,6 +320,7 @@
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
{
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
+ int i;
if( out == NULL || outlen == 0 || outlen > BLAKE2B_OUTBYTES )
return -1;
@@ -339,7 +341,7 @@
memset( S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
blake2b_compress( S, S->buf );
- for( int i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
+ for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );
diff --git a/Modules/_blake2/impl/blake2b.c b/Modules/_blake2/impl/blake2b.c
--- a/Modules/_blake2/impl/blake2b.c
+++ b/Modules/_blake2/impl/blake2b.c
@@ -174,9 +174,10 @@
BLAKE2_LOCAL_INLINE(int) blake2b_init0( blake2b_state *S )
{
+ int i;
memset( S, 0, sizeof( blake2b_state ) );
- for( int i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
+ for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
return 0;
}
@@ -188,10 +189,11 @@
const uint8_t * v = ( const uint8_t * )( blake2b_IV );
const uint8_t * p = ( const uint8_t * )( P );
uint8_t * h = ( uint8_t * )( S->h );
+ int i;
/* IV XOR ParamBlock */
memset( S, 0, sizeof( blake2b_state ) );
- for( int i = 0; i < BLAKE2B_OUTBYTES; ++i ) h[i] = v[i] ^ p[i];
+ for( i = 0; i < BLAKE2B_OUTBYTES; ++i ) h[i] = v[i] ^ p[i];
return 0;
}
diff --git a/Modules/_blake2/impl/blake2s-ref.c b/Modules/_blake2/impl/blake2s-ref.c
--- a/Modules/_blake2/impl/blake2s-ref.c
+++ b/Modules/_blake2/impl/blake2s-ref.c
@@ -138,9 +138,10 @@
BLAKE2_LOCAL_INLINE(int) blake2s_init0( blake2s_state *S )
{
+ int i;
memset( S, 0, sizeof( blake2s_state ) );
- for( int i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
+ for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
return 0;
}
@@ -308,6 +309,7 @@
int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )
{
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
+ int i;
if( out == NULL || outlen == 0 || outlen > BLAKE2S_OUTBYTES )
return -1;
@@ -329,7 +331,7 @@
memset( S->buf + S->buflen, 0, 2 * BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
blake2s_compress( S, S->buf );
- for( int i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
+ for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );
diff --git a/Modules/_blake2/impl/blake2s.c b/Modules/_blake2/impl/blake2s.c
--- a/Modules/_blake2/impl/blake2s.c
+++ b/Modules/_blake2/impl/blake2s.c
@@ -161,9 +161,10 @@
BLAKE2_LOCAL_INLINE(int) blake2s_init0( blake2s_state *S )
{
+ int i;
memset( S, 0, sizeof( blake2s_state ) );
- for( int i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
+ for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
return 0;
}
@@ -175,10 +176,11 @@
const uint8_t * v = ( const uint8_t * )( blake2s_IV );
const uint8_t * p = ( const uint8_t * )( P );
uint8_t * h = ( uint8_t * )( S->h );
+ int i;
/* IV XOR ParamBlock */
memset( S, 0, sizeof( blake2s_state ) );
- for( int i = 0; i < BLAKE2S_OUTBYTES; ++i ) h[i] = v[i] ^ p[i];
+ for( i = 0; i < BLAKE2S_OUTBYTES; ++i ) h[i] = v[i] ^ p[i];
return 0;
}
@@ -333,6 +335,7 @@
int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )
{
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
+ int i;
if( outlen > BLAKE2S_OUTBYTES )
return -1;
@@ -353,7 +356,7 @@
memset( S->buf + S->buflen, 0, 2 * BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
blake2s_compress( S, S->buf );
- for( int i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
+ for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list