Fixed issue on 32-bit systems.

This commit is contained in:
Ward Fisher 2017-07-05 14:57:12 -06:00
parent fd2c575597
commit e4f81a1611

View File

@ -3,7 +3,7 @@
See COPYRIGHT file for copying and redistribution conditions. See COPYRIGHT file for copying and redistribution conditions.
This is part of netCDF. This is part of netCDF.
This program also takes a long time to run - it writes some data in 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 a very large file, and then reads it all back to be sure it's
correct. correct.
@ -47,11 +47,13 @@ main(int argc, char **argv) {
int n_dim; int n_dim;
#define NUMRECS 2 #define NUMRECS 2
#define I_LEN 5 #define I_LEN 4106
#if 0 //#define I_LEN 5
#define J_LEN 214700000 //#if 0
#endif //#define J_LEN 214700000
#define J_LEN 500000000 //#endif
//#define J_LEN 500000000
#define J_LEN 1023
#define K_LEN 1023 #define K_LEN 1023
#define N_LEN 2 #define N_LEN 2
@ -157,7 +159,7 @@ main(int argc, char **argv) {
check_err(stat,__LINE__,__FILE__); check_err(stat,__LINE__,__FILE__);
{ /* read var1 */ { /* read var1 */
/*static float avar1[J_LEN];*/ /*static float avar1[J_LEN];*/
static float *avar1 = NULL; static float *avar1 = NULL;
avar1 = (float*)malloc(sizeof(float)*J_LEN); avar1 = (float*)malloc(sizeof(float)*J_LEN);
@ -172,11 +174,11 @@ main(int argc, char **argv) {
avar1_start[1] = i; avar1_start[1] = i;
stat = nc_get_vara_float(ncid, var1_id, avar1_start, avar1_count, avar1); stat = nc_get_vara_float(ncid, var1_id, avar1_start, avar1_count, avar1);
check_err(stat,__LINE__,__FILE__); 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)) { if (avar1[j] != (float)(j + (rec + 1) * i)) {
printf("Error on read, var1[%d, %d, %d] = %g wrong, " 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; return 1;
} }
} }