From e0e36fffbfe8ae687583eb260ec2cb76141012a2 Mon Sep 17 00:00:00 2001 From: ellson Date: Fri, 1 Aug 2008 19:52:09 +0000 Subject: [PATCH] deal with return value from fread() to clean up compiler warnings. --- lib/sparse/SparseMatrix.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index 2dc2e2275..d53f1362e 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -13,14 +13,16 @@ * AT&T Research, Florham Park NJ * **********************************************************/ #include +#include +#include +#include + #include "SparseMatrix.h" #include "logic.h" -#include "math.h" -#include "string.h" #include "memory.h" #include "arith.h" -#include "assert.h" + #define MALLOC gmalloc #define REALLOC grealloc #define FREE free @@ -605,19 +607,20 @@ void SparseMatrix_export_binary(char *name, SparseMatrix A, int *flag){ SparseMatrix SparseMatrix_import_binary(char *name){ SparseMatrix A = NULL; - int m, n, nz, nzmax, type, format, property; + int m, n, nz, nzmax, type, format, property, rc; FILE *f; f = fopen(name, "rb"); if (!f) return NULL; - fread(&m, sizeof(int), 1, f); - fread(&n, sizeof(int), 1, f); - fread(&nz, sizeof(int), 1, f); - fread(&nzmax, sizeof(int), 1, f); - fread(&type, sizeof(int), 1, f); - fread(&format, sizeof(int), 1, f); - fread(&property, sizeof(int), 1, f); + rc = fread(&m, sizeof(int), 1, f); + rc += fread(&n, sizeof(int), 1, f); + rc += fread(&nz, sizeof(int), 1, f); + rc += fread(&nzmax, sizeof(int), 1, f); + rc += fread(&type, sizeof(int), 1, f); + rc += fread(&format, sizeof(int), 1, f); + rc += fread(&property, sizeof(int), 1, f); + if (rc != 7) return NULL; A = SparseMatrix_new(m, n, nz, type, format); A->nz = nz; A->property = property; -- 2.40.0