diff --git a/src/clib/pio_get_vard.c b/src/clib/pio_get_vard.c index cccead9bc62..87b4e09b254 100644 --- a/src/clib/pio_get_vard.c +++ b/src/clib/pio_get_vard.c @@ -54,7 +54,7 @@ int PIOc_get_vard_text(int ncid, int varid, int decompid, int PIOc_get_vard_uchar(int ncid, int varid, int decompid, const PIO_Offset recnum, unsigned char *buf) { - return PIOc_get_vard_tc(ncid, varid, decompid, recnum, NC_UBYTE, buf); + return PIOc_get_vard_tc(ncid, varid, decompid, recnum, NC_CHAR, buf); } /** diff --git a/src/clib/pio_getput_int.c b/src/clib/pio_getput_int.c index 04b5277df30..6b71c2eaed1 100644 --- a/src/clib/pio_getput_int.c +++ b/src/clib/pio_getput_int.c @@ -1453,6 +1453,9 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum, var_desc_t *vdesc; /* Pointer to var information. */ int ret; + LOG((1, "PIOc_get_vard_tc ncid %d varid %d decompid %d recnum %d " + "xtype %d", ncid, varid, decompid, recnum, xtype)); + /* Get file info. */ if ((ret = pio_get_file(ncid, &file))) return pio_err(NULL, NULL, ret, __FILE__, __LINE__); @@ -1465,6 +1468,7 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum, /* Get var info. */ if ((ret = get_var_desc(varid, &file->varlist, &vdesc))) return pio_err(ios, file, ret, __FILE__, __LINE__); + LOG((2, "vdesc->pio_type %d", vdesc->pio_type)); /* Disallow type conversion for now. */ if (xtype != NC_NAT && xtype != vdesc->pio_type) diff --git a/tests/cunit/test_darray_vard.c b/tests/cunit/test_darray_vard.c index df1aee792d8..6a2a447ad8c 100644 --- a/tests/cunit/test_darray_vard.c +++ b/tests/cunit/test_darray_vard.c @@ -227,9 +227,41 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, ERR(ret); /* Read the data. */ - if ((ret = PIOc_get_vard(ncid2, varid, ioid, 0, - (void *)test_data_in))) - ERR(ret); + switch (pio_type) + { + case PIO_CHAR: + if ((ret = PIOc_get_vard_uchar(ncid2, varid, ioid, 0, + test_data_char_in))) + ERR(ret); + break; + case PIO_BYTE: + if ((ret = PIOc_get_vard_schar(ncid2, varid, ioid, 0, + test_data_byte_in))) + ERR(ret); + break; + case PIO_SHORT: + if ((ret = PIOc_get_vard_short(ncid2, varid, ioid, 0, + test_data_short_in))) + ERR(ret); + break; + case PIO_INT: + if ((ret = PIOc_get_vard_int(ncid2, varid, ioid, 0, + test_data_int_in))) + ERR(ret); + break; + case PIO_FLOAT: + if ((ret = PIOc_get_vard_float(ncid2, varid, ioid, 0, + test_data_float_in))) + ERR(ret); + break; + case PIO_DOUBLE: + if ((ret = PIOc_get_vard_double(ncid2, varid, ioid, 0, + test_data_double_in))) + ERR(ret); + break; + default: + ERR(ERR_WRONG); + } /* Check the results. */ for (f = 0; f < arraylen; f++)