Skip to content

Commit

Permalink
fix: Made use of resolu.h more consistent and reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed May 16, 2024
1 parent e6f6be8 commit 7fade2f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/util/rcomb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: rcomb.c,v 2.7 2024/02/23 03:47:57 greg Exp $";
static const char RCSid[] = "$Id: rcomb.c,v 2.8 2024/05/16 18:59:19 greg Exp $";
#endif
/*
* General component matrix combiner, operating on a row at a time.
Expand All @@ -9,7 +9,6 @@ static const char RCSid[] = "$Id: rcomb.c,v 2.7 2024/02/23 03:47:57 greg Exp $";
#include <math.h>
#include "platform.h"
#include "rtio.h"
#include "resolu.h"
#include "rmatrix.h"
#include "calcomp.h"
#include "paths.h"
Expand Down
10 changes: 5 additions & 5 deletions src/util/rcrop.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: rcrop.c,v 1.14 2023/11/21 02:06:14 greg Exp $";
static const char RCSid[] = "$Id: rcrop.c,v 1.15 2024/05/16 18:59:19 greg Exp $";
#endif
/*
* rcrop.c - crop a Radiance picture or matrix data
Expand Down Expand Up @@ -97,7 +97,7 @@ binary_copyf(FILE *fp, int asize)
int y;
/* check if fseek() useful */
if (skip_len > skip_thresh &&
fseek(fp, (rmin*width + cmin)*elsiz, SEEK_CUR) == 0) {
fseek(fp, ((long)rmin*width + cmin)*elsiz, SEEK_CUR) == 0) {
off_t curpos;
buf = (char *)malloc(ncols*elsiz);
if (!buf)
Expand Down Expand Up @@ -134,7 +134,7 @@ binary_copyf(FILE *fp, int asize)
goto memerr;
/* skip rows as requested */
if (skip_len > skip_thresh ||
(rmin && fseek(fp, rmin*width*elsiz, SEEK_CUR) < 0))
(rmin && fseek(fp, (long)rmin*width*elsiz, SEEK_CUR) < 0))
for (y = 0; y < rmin; y++)
if (getbinary(buf, elsiz, width, fp) != width)
goto readerr;
Expand Down Expand Up @@ -163,7 +163,7 @@ binary_copyf(FILE *fp, int asize)

/* Read (and copy) specified number of white-space-separated words */
static int
readwords(FILE *finp, int nwords, FILE *fout)
readwords(FILE *finp, long nwords, FILE *fout)
{
while (nwords-- > 0) {
int c;
Expand Down Expand Up @@ -192,7 +192,7 @@ ascii_copyf(FILE *fp)
SET_FILE_TEXT(fp); /* started as binary */
SET_FILE_TEXT(stdout);
/* skip rows as requested */
if (readwords(fp, rmin*width*ncomp, NULL) < 0)
if (readwords(fp, (long)rmin*width*ncomp, NULL) < 0)
goto io_err;
for (y = 0; y < nrows; y++) { /* copy part */
if (readwords(fp, cmin*ncomp, NULL) < 0)
Expand Down
3 changes: 1 addition & 2 deletions src/util/rmtxop.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#ifndef lint
static const char RCSid[] = "$Id: rmtxop.c,v 2.32 2023/12/19 16:09:20 greg Exp $";
static const char RCSid[] = "$Id: rmtxop.c,v 2.33 2024/05/16 18:59:19 greg Exp $";
#endif
/*
* General component matrix operations.
*/

#include <errno.h>
#include "rtio.h"
#include "resolu.h"
#include "rmatrix.h"
#include "platform.h"

Expand Down

0 comments on commit 7fade2f

Please sign in to comment.