Skip to content

Commit

Permalink
Fixed issue on 32-bit systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF committed Jul 5, 2017
1 parent fd2c575 commit e4f81a1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions nc_test/large_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF.
This program also takes a long time to run - it writes some data in
a very large file, and then reads it all back to be sure it's
correct.
Expand Down Expand Up @@ -47,11 +47,13 @@ main(int argc, char **argv) {
int n_dim;

#define NUMRECS 2
#define I_LEN 5
#if 0
#define J_LEN 214700000
#endif
#define J_LEN 500000000
#define I_LEN 4106
//#define I_LEN 5
//#if 0
//#define J_LEN 214700000
//#endif
//#define J_LEN 500000000
#define J_LEN 1023
#define K_LEN 1023
#define N_LEN 2

Expand Down Expand Up @@ -157,7 +159,7 @@ main(int argc, char **argv) {
check_err(stat,__LINE__,__FILE__);

{ /* read var1 */

/*static float avar1[J_LEN];*/
static float *avar1 = NULL;
avar1 = (float*)malloc(sizeof(float)*J_LEN);
Expand All @@ -172,11 +174,11 @@ main(int argc, char **argv) {
avar1_start[1] = i;
stat = nc_get_vara_float(ncid, var1_id, avar1_start, avar1_count, avar1);
check_err(stat,__LINE__,__FILE__);
for(j=0; j<J_LEN; j++)
for(j=0; j<J_LEN; j++)
{
if (avar1[j] != (float)(j + (rec + 1) * i)) {
printf("Error on read, var1[%d, %d, %d] = %g wrong, "
"should be %g !\n", rec, i, j, avar1[j], (float) (j + (rec + 1)* i));
"should be %g !\n", rec, i, j, avar1[j], (float) (j + (rec + 1)* i));
return 1;
}
}
Expand Down

0 comments on commit e4f81a1

Please sign in to comment.