This is a patch for the experimental C++ interface to netCDF in version 2.3.2pl2 (April 1994). This patch accomplishes the following: BUG FIXES A bug in netcdf.h that prevented correct compilation of the experimental C++ interface is fixed by removing typedefs for ncchar, ncbyte, ncshort, ncfloat, and ncdouble. Fixed off-by-one problem with strings reported by Tom Lefebvre. Minor changes to work with g++. Added put and get functions for ncbyte arrays. Fixed a bug in NcVar::get_att(NcToken) member, to make it return 0 for attributes that don't exist. NcAtt::is_valid() had been returning FALSE for global attributes, but this fix makes it return TRUE when appropriate. This patch-file is designed to be applied from the top-level netcdf source directory via Larry Wall's patch(1) utility, e.g. $ cd /usr/local/src/netcdf-2.3.2 $ patch < this_file After applying this patch, you *must* remake the netCDF library from scratch (from the `configure' step), because the libsrc/netcdf.h file is regenerated by the `configure' script from one of the files changed by this patch. =================================================================== diff -c1 -r libsrc/netcdf.h.in *** oldlibsrc/netcdf.h.in Tue Jun 8 13:20:36 1993 --- libsrc/netcdf.h.in Wed Jul 21 12:36:23 1993 *************** *** 16,18 **** */ ! /* "$Id: netcdf.h.in,v 1.3 1993/06/08 19:22:22 steve Exp $" */ --- 16,18 ---- */ ! /* "$Id: netcdf.h.in,v 1.4 1993/07/21 18:36:23 steve Exp $" */ *************** *** 278,282 **** */ - typedef char ncchar; - typedef char ncbyte; - typedef short ncshort; #ifdef __alpha --- 278,279 ---- *************** *** 291,294 **** #undef NCLONG_DEFINED - typedef float ncfloat; - typedef double ncdouble; --- 288,289 ---- diff -c1 -r c++/ncvalues.cc *** oldc++/ncvalues.cc Thu Apr 15 15:41:03 1993 --- c++/ncvalues.cc Fri Aug 6 11:13:55 1993 *************** *** 6,8 **** * ! * $Header: /a/zero/home/russ/src/netcdf/c++/RCS/ncvalues.cc,v 1.9 1993/04/15 21:41:40 russ Exp $ *********************************************************************/ --- 6,8 ---- * ! * $Header: /upc/new/CVS/netcdf/c++/ncvalues.cc,v 1.10 1993/08/06 17:13:55 russ Exp $ *********************************************************************/ *************** *** 156,158 **** { ! return strdup((char*)the_values + n); } --- 156,161 ---- { ! char *s = new char[the_number + 1]; ! s[the_number] = '\0'; ! strncpy(s, (const char *)the_values + n, (int)the_number); ! return s; } *************** *** 161,163 **** { ! return strdup(the_values + n); } --- 164,169 ---- { ! char *s = new char[the_number + 1]; ! s[the_number] = '\0'; ! strncpy(s, (const char *)the_values + n, (int)the_number); ! return s; } diff -c1 -r c++/netcdf.cc *** oldc++/netcdf.cc Sun Apr 25 10:23:53 1993 --- c++/netcdf.cc Tue Feb 22 11:09:42 1994 *************** *** 6,8 **** * ! * $Header: /a/zero/home/russ/src/netcdf/c++/RCS/netcdf.cc,v 1.42 1993/04/25 16:24:28 russ Exp $ *********************************************************************/ --- 6,8 ---- * ! * $Header: /upc/new/CVS/netcdf/c++/netcdf.cc,v 1.46 1994/02/22 18:09:42 russ Exp $ *********************************************************************/ *************** *** 208,210 **** ! enum NcFile::FillMode NcFile::get_fill( void ) { --- 208,210 ---- ! NcFile::FillMode NcFile::get_fill( void ) { *************** *** 493,494 **** --- 493,498 ---- NcAtt* att = new NcAtt(the_file, this, aname); + if (! att->is_valid()) { + delete att; + return 0; + } return att; *************** *** 562,563 **** --- 566,568 ---- + NcVar_put_array(ncbyte) NcVar_put_array(char) *************** *** 582,583 **** --- 587,589 ---- + NcVar_put_nd_array(ncbyte) NcVar_put_nd_array(char) *************** *** 621,622 **** --- 627,629 ---- + NcVar_get_array(ncbyte) NcVar_get_array(char) *************** *** 641,642 **** --- 648,650 ---- + NcVar_get_nd_array(ncbyte) NcVar_get_nd_array(char) *************** *** 672,673 **** --- 680,682 ---- } + return TRUE; } *************** *** 849,851 **** return the_file->is_valid() && ! the_variable->is_valid() && ncattinq(the_file->id(), the_variable->id(), the_name, 0, 0) != ncBad; --- 858,860 ---- return the_file->is_valid() && ! (the_variable->id() == NC_GLOBAL || the_variable->is_valid()) && ncattinq(the_file->id(), the_variable->id(), the_name, 0, 0) != ncBad; diff -c1 -r c++/netcdf.hh *** oldc++/netcdf.hh Sun Apr 25 10:23:11 1993 --- c++/netcdf.hh Tue Dec 7 09:17:48 1993 *************** *** 6,8 **** * ! * $Header: /a/zero/home/russ/src/netcdf/c++/RCS/netcdf.hh,v 1.39 1993/04/25 16:23:51 russ Exp $ *********************************************************************/ --- 6,8 ---- * ! * $Header: /upc/new/CVS/netcdf/c++/netcdf.hh,v 1.40 1993/12/07 16:17:48 russ Exp $ *********************************************************************/ *************** *** 243,244 **** --- 243,246 ---- // returned if type of values does not match type for variable. + NcBool put( const ncbyte* vals, + long c0=0, long c1=0, long c2=0, long c3=0, long c4=0 ); NcBool put( const char* vals, *************** *** 258,259 **** --- 260,262 ---- // may be reset with set_cur(). + NcBool put( const ncbyte* vals, const long* counts ); NcBool put( const char* vals, const long* counts ); *************** *** 269,270 **** --- 272,275 ---- // default, but may be reset using the set_cur() member. + NcBool get( ncbyte* vals, long c0=0, long c1=0, + long c2=0, long c3=0, long c4=0 ) const; NcBool get( char* vals, long c0=0, long c1=0, *************** *** 284,285 **** --- 289,291 ---- // may be reset with set_cur(). + NcBool get( ncbyte* vals, const long* counts ) const; NcBool get( char* vals, const long* counts ) const;