aboutsummaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-06 18:48:53 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-06 18:48:53 +0100
commit96a1348a7c8fedf99f05d0bc5da0937d2f0ab54c (patch)
treef54ca7b6a52c8466c39afef5f81c9520b11de11e /c
parentand now it compiles (diff)
downloadsha3sum-96a1348a7c8fedf99f05d0bc5da0937d2f0ab54c.tar.gz
sha3sum-96a1348a7c8fedf99f05d0bc5da0937d2f0ab54c.tar.bz2
sha3sum-96a1348a7c8fedf99f05d0bc5da0937d2f0ab54c.tar.xz
resolve pedantic warnings
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'c')
-rw-r--r--c/sha3sum.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/c/sha3sum.c b/c/sha3sum.c
index 6ff70e7..4e2198b 100644
--- a/c/sha3sum.c
+++ b/c/sha3sum.c
@@ -276,17 +276,22 @@ int main(int argc, char** argv)
char* stdin = null;
char* filename;
char* fn;
- long f, fail = false, _;
+ long f, fail = false, _, bn;
for (f = 0; f < fptr; f++)
{
+ FILE* file;
+ long blksize;
+ char* chunk;
+ char* bs;
+
if (((filename = *(files + f)) == null) && stdin)
{
printf("%s", stdin);
continue;
}
fn = filename ? filename : "/dev/stdin";
- FILE* file = fopen(fn, "r");
+ file = fopen(fn, "r");
if (file == null)
{
fprintf(stderr, "%s: cannot read file: %s\n", cmd, filename);
@@ -295,8 +300,8 @@ int main(int argc, char** argv)
}
initialise(r, c, o);
- int blksize = 4096; /** XXX os.stat(os.path.realpath(fn)).st_size; **/
- char* chunk = malloc(blksize);
+ blksize = 4096; /** XXX os.stat(os.path.realpath(fn)).st_size; **/
+ chunk = malloc(blksize);
for (;;)
{
long read = fread(chunk, 1, blksize, file);
@@ -305,8 +310,8 @@ int main(int argc, char** argv)
update(chunk, read);
}
free(chunk);
- char* bs = digest(null, 0);
- long bn = (o + 7) >> 3;
+ bs = digest(null, 0);
+ bn = (o + 7) >> 3;
for (_ = 1; _ < i; _++)
{
initialise(r, c, o);
@@ -328,10 +333,11 @@ int main(int argc, char** argv)
else
{
long flen = 0, rcptr = 0, b = 0;
+ char* rc;
if (filename != null)
while (*(filename + flen))
flen++;
- char* rc = malloc((bn << 1) + 3 + (filename == null ? 1 : 0) + flen);
+ rc = malloc((bn << 1) + 3 + (filename == null ? 1 : 0) + flen);
for (b = 0; b < bn; b++)
{
*(rc + rcptr++) = "0123456789ABCDEF"[(bs[b] >> 4) & 15];