1
0
mirror of https://github.com/mariadb-corporation/libmarias3.git synced 2025-04-18 16:24:01 +03:00

Code cleanups

This commit is contained in:
Andrew Hutchings 2019-05-21 14:38:05 +01:00
parent c45e059683
commit c4cad023b5
4 changed files with 6 additions and 3 deletions

2
ci-scripts/cppcheck.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
cppcheck --quiet --enable=all --error-exitcode=1 . src tests libmarias3

View File

@ -651,7 +651,6 @@ static size_t body_callback(void *buffer, size_t size,
mem->data[mem->length] = '\0';
ms3debug("Read %zu bytes, buffer %zu bytes", realsize, mem->length);
ms3debug("Body: %s", buffer);
return nitems * size;
}

View File

@ -80,8 +80,7 @@ static const uint32_t K[64] =
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
{
uint32_t S[8], W[64], t0, t1;
uint32_t t;
uint32_t S[8], W[64];
int i;
/* copy state into S */
@ -103,6 +102,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
/* Compress */
#define RND(a,b,c,d,e,f,g,h,i) \
uint32_t t0, t1; \
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
t1 = Sigma0(a) + Maj(a, b, c); \
d += t0; \
@ -110,6 +110,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
for (i = 0; i < 64; ++i)
{
uint32_t t;
RND(S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7], i);
t = S[7];
S[7] = S[6];

View File

@ -68,6 +68,7 @@ int main(int argc, char *argv[])
new_buffer_size = 1024;
res = ms3_set_option(ms3, MS3_OPT_BUFFER_CHUNK_SIZE, &new_buffer_size);
ASSERT_EQ_(res, 0, "Result: %u", res);
res = ms3_get(ms3, s3bucket, "test/small_buffer.dat", &data, &length);
ASSERT_EQ_(res, 0, "Result: %u", res);
ASSERT_EQ(length, 64 * 1024);