Skip to content

Commit

Permalink
disallow type conversion in vard reads (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 5, 2019
1 parent b280e4a commit aa26496
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,12 +1448,28 @@ int
PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum,
nc_type xtype, void *buf)
{
iosystem_desc_t *ios; /* Pointer to io system information. */
file_desc_t *file; /* Pointer to file information. */
var_desc_t *vdesc; /* Pointer to var information. */
int ret;

/* Get file info. */
if ((ret = pio_get_file(ncid, &file)))
return pio_err(NULL, NULL, ret, __FILE__, __LINE__);
ios = file->iosystem;

/* Set the value of the record dimension. */
if ((ret = PIOc_setframe(ncid, varid, recnum)))
return ret;

/* Get var info. */
if ((ret = get_var_desc(varid, &file->varlist, &vdesc)))
return pio_err(ios, file, ret, __FILE__, __LINE__);

/* Disallow type conversion for now. */
if (xtype != NC_NAT && xtype != vdesc->pio_type)
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);

/* Read the distributed array. */
if ((ret = PIOc_read_darray(ncid, varid, decompid, 0, buf)))
return ret;
Expand Down Expand Up @@ -1507,7 +1523,7 @@ PIOc_put_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum,
return pio_err(ios, file, ret, __FILE__, __LINE__);

/* Disallow type conversion for now. */
if (xtype != vdesc->pio_type)
if (xtype != NC_NAT && xtype != vdesc->pio_type)
return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__);

/* Write the distributed array. */
Expand Down

0 comments on commit aa26496

Please sign in to comment.