[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: netCDF byte vs. character type
- Subject: Re: netCDF byte vs. character type
- Date: Thu, 06 Jan 1994 14:49:35 -0700
> Organization: NOAA/FSL
> Keywords: 199401061837.AA19023, C++ interface, bug
Hi Tom,
> I've bumped into another problem that I would like you to look at. If
> you remember, I'm using the C++ interface to netCDF. My problem
> occurs when I attempt to get a variable attribute that does not exist.
> According to the documentation, "If no such attribute has been attached
> to the variable, zero is returned." However in my case a non-zero
> value is returned when I attempt to get an attribute that does not
> exist. I have attached a piece of code with the corresponding CDL that
> demonstrates this problem. As always, thanks for you time.
Thank you for providing another good bug report. I think the fix is adding
a few lines to the NcVar::get_att(NcToken) member. Please let me know if
the appended patch doesn't work, or if you find any more bugs.
--Russ
===================================================================
RCS file: RCS/netcdf.cc,v
retrieving revision 1.44
diff -c -r1.44 netcdf.cc
*** 1.44 1993/12/07 16:17:48
--- netcdf.cc 1994/01/06 21:42:44
***************
*** 491,496 ****
--- 491,500 ----
NcAtt * NcVar::get_att( NcToken aname ) const
{
NcAtt* att = new NcAtt(the_file, this, aname);
+ if (! att->is_valid()) {
+ delete att;
+ return 0;
+ }
return att;
}