decoder/encoder: fix compilation warnings

Resolve compilation warnings about unused variables and function return
values being ignored.

Signed-off-by: Loic Dachary <loic@dachary.org>
master
Loic Dachary 2014-12-15 12:28:47 +01:00
parent 63ffdaad49
commit 3785ed2632
2 changed files with 7 additions and 7 deletions

View File

@ -62,6 +62,7 @@ same arguments, and encoder.c does error check.
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -104,12 +105,11 @@ int main (int argc, char **argv) {
char *c_tech; char *c_tech;
int i, j; // loop control variable, s 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 origsize; // size of file before padding
int total; // used to write data, not padding to file int total; // used to write data, not padding to file
struct stat status; // used to find size of individual files struct stat status; // used to find size of individual files
int numerased; // number of erased files int numerased; // number of erased files
int dummy;
/* Used to recreate file names */ /* Used to recreate file names */
char *temp; char *temp;
@ -270,11 +270,11 @@ int main (int argc, char **argv) {
stat(fname, &status); stat(fname, &status);
blocksize = status.st_size; blocksize = status.st_size;
data[i-1] = (char *)malloc(sizeof(char)*blocksize); 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 { else {
fseek(fp, blocksize*(n-1), SEEK_SET); 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); fclose(fp);
} }
@ -293,11 +293,11 @@ int main (int argc, char **argv) {
stat(fname, &status); stat(fname, &status);
blocksize = status.st_size; blocksize = status.st_size;
coding[i-1] = (char *)malloc(sizeof(char)*blocksize); 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 { else {
fseek(fp, blocksize*(n-1), SEEK_SET); 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); fclose(fp);
} }

View File

@ -326,7 +326,7 @@ int main (int argc, char **argv) {
/* Get current working directory for construction of file names */ /* Get current working directory for construction of file names */
curdir = (char*)malloc(sizeof(char)*1000); curdir = (char*)malloc(sizeof(char)*1000);
getcwd(curdir, 1000); assert(curdir == getcwd(curdir, 1000));
if (argv[1][0] != '-') { if (argv[1][0] != '-') {