--- ray/src/util/rcollate.c 2013/09/06 21:34:39 2.4 +++ ray/src/util/rcollate.c 2013/11/18 22:02:12 2.7 @@ -1,18 +1,22 @@ #ifndef lint -static const char RCSid[] = "$Id: rcollate.c,v 2.4 2013/09/06 21:34:39 greg Exp $"; +static const char RCSid[] = "$Id: rcollate.c,v 2.7 2013/11/18 22:02:12 greg Exp $"; #endif /* * Utility to re-order records in a binary or ASCII data file (matrix) */ #include -#include #include #include #include "platform.h" #include "rtio.h" #include "resolu.h" -#ifndef _WIN32 +#ifdef _WIN32 +#undef ftello +#define ftello ftell +#undef ssize_t +#define ssize_t size_t +#else #include #endif @@ -274,6 +278,11 @@ do_transpose(const MEMLOAD *mp) RECINDEX *rp = NULL; long nrecords; int i, j; + /* propogate sizes */ + if (ni_rows <= 0) + ni_rows = no_columns; + if (ni_columns <= 0) + ni_columns = no_rows; /* get # records (& index) */ if (record_width > 0) { if ((rp = index_records(mp, record_width)) == NULL) @@ -291,10 +300,6 @@ do_transpose(const MEMLOAD *mp) } else nrecords = mp->len / -record_width; /* check sizes */ - if (ni_rows <= 0) - ni_rows = no_columns; - if (ni_columns <= 0) - ni_columns = no_rows; if ((ni_rows <= 0) & (ni_columns > 0)) ni_rows = nrecords/ni_columns; if ((ni_columns <= 0) & (ni_rows > 0))