diff --git a/Examples/decoder.c b/Examples/decoder.c index bd0b008..229dccc 100644 --- a/Examples/decoder.c +++ b/Examples/decoder.c @@ -62,6 +62,7 @@ same arguments, and encoder.c does error check. #include #include #include +#include #include #include #include @@ -104,12 +105,11 @@ int main (int argc, char **argv) { char *c_tech; int i, j; // loop control variable, s - int blocksize; // size of individual files + int blocksize = 0; // size of individual files int origsize; // size of file before padding int total; // used to write data, not padding to file struct stat status; // used to find size of individual files int numerased; // number of erased files - int dummy; /* Used to recreate file names */ char *temp; @@ -270,11 +270,11 @@ int main (int argc, char **argv) { stat(fname, &status); blocksize = status.st_size; data[i-1] = (char *)malloc(sizeof(char)*blocksize); - dummy = fread(data[i-1], sizeof(char), blocksize, fp); + assert(blocksize == fread(data[i-1], sizeof(char), blocksize, fp)); } else { fseek(fp, blocksize*(n-1), SEEK_SET); - dummy = fread(data[i-1], sizeof(char), buffersize/k, fp); + assert(buffersize/k == fread(data[i-1], sizeof(char), buffersize/k, fp)); } fclose(fp); } @@ -293,11 +293,11 @@ int main (int argc, char **argv) { stat(fname, &status); blocksize = status.st_size; coding[i-1] = (char *)malloc(sizeof(char)*blocksize); - dummy = fread(coding[i-1], sizeof(char), blocksize, fp); + assert(blocksize == fread(coding[i-1], sizeof(char), blocksize, fp)); } else { fseek(fp, blocksize*(n-1), SEEK_SET); - dummy = fread(coding[i-1], sizeof(char), blocksize, fp); + assert(blocksize == fread(coding[i-1], sizeof(char), blocksize, fp)); } fclose(fp); } diff --git a/Examples/encoder.c b/Examples/encoder.c index 8b9184f..367686e 100644 --- a/Examples/encoder.c +++ b/Examples/encoder.c @@ -326,7 +326,7 @@ int main (int argc, char **argv) { /* Get current working directory for construction of file names */ curdir = (char*)malloc(sizeof(char)*1000); - getcwd(curdir, 1000); + assert(curdir == getcwd(curdir, 1000)); if (argv[1][0] != '-') {