Captured a conversion error.

This commit is contained in:
Ward Fisher 2015-12-23 21:17:53 +00:00
parent 4d9cb910ca
commit bd6f4909cf
2 changed files with 21 additions and 12 deletions

10
gdb.txt Normal file
View File

@ -0,0 +1,10 @@
break cdf5_gh159_test.c:127
commands
break ncx_putn_uchar_double
break ncx.c:4845
commands
print ((uchar *)*xpp)[0]
print ((uchar *)*xpp)[1]
print ((uchar *)*xpp)[2]
end
end

View File

@ -9,7 +9,7 @@
void
check_err(const int stat, const int line, const char *file) {
if (stat != NC_NOERR) {
(void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
(void)fprintf(stderr,"[err: %d] line %d of %s: %s\n", stat, line, file, nc_strerror(stat));
fflush(stderr);
exit(1);
}
@ -120,7 +120,15 @@ main() {/* create cdf5_test */
check_err(stat,__LINE__,__FILE__);
/* assign variable data */
{
double y3d_data[3] = {0, 255U, -1} ;
size_t y3d_startset[1] = {0} ;
size_t y3d_countset[1] = {3};
stat = nc_put_vara_double(ncid,y3d_id,y3d_startset,y3d_countset,y3d_data);
//stat = nc_put_vara(ncid, y3d_id, y3d_startset, y3d_countset, y3d_data);
check_err(stat,__LINE__,__FILE__);
}
/*
{
double y3_data[3] = {0U, 255U, 255U} ;
size_t y3_startset[1] = {0} ;
@ -128,16 +136,7 @@ main() {/* create cdf5_test */
stat = nc_put_vara_double(ncid, y3_id, y3_startset, y3_countset, y3_data);
check_err(stat,__LINE__,__FILE__);
}
{
double y3d_data[3] = {0, 255U, -1} ;
size_t y3d_startset[1] = {0} ;
size_t y3d_countset[1] = {3};
nc_put_vara_double(ncid,y3d_id,y3d_startset,y3d_countset,y3d_data);
//stat = nc_put_vara(ncid, y3d_id, y3d_startset, y3d_countset, y3d_data);
check_err(stat,__LINE__,__FILE__);
}
*/
stat = nc_close(ncid);
check_err(stat,__LINE__,__FILE__);
return 0;