openbsd-ports/math/netcdf/patches/patch-src_cxx_ncvalues_h
sturm df1ebdb359 - update to netcdf 3.5.0
- cleanup
- pull in patches from netcdf-current to build with gcc3
2004-02-01 12:22:05 +00:00

61 lines
2.0 KiB
Plaintext

$OpenBSD: patch-src_cxx_ncvalues_h,v 1.1 2004/02/01 12:22:06 sturm Exp $
--- src/cxx/ncvalues.h.orig 1998-10-28 18:10:16.000000000 +0100
+++ src/cxx/ncvalues.h 2004-02-01 11:57:27.000000000 +0100
@@ -10,14 +10,9 @@
#ifndef Ncvalues_def
#define Ncvalues_def
-#include <iostream.h>
-#ifdef STRSTREAM_H_SPEC
-# include STRSTREAM_H_SPEC
-#else
-# include <strstream.h>
-#endif
+#include <iostream>
+#include <sstream>
#include <limits.h>
-#include <string.h>
#include "netcdf.h"
typedef unsigned char ncbyte;
@@ -82,7 +77,7 @@ class NcVal(TYPE) : public NcValues
virtual int invalid( void ) const; \
private: \
TYPE* the_values; \
- ostream& print(ostream&) const; \
+ std::ostream& print(std::ostream&) const; \
};
#define NcTypeEnum(TYPE) makename2(_nc__,TYPE)
@@ -220,8 +215,10 @@ inline double NcVal(TYPE)::as_double( lo
char* NcVal(TYPE)::as_string( long n ) const \
{ \
char* s = new char[32]; \
- ostrstream ostr(s, sizeof(s)); \
- ostr << the_values[n] << ends; \
+ std::ostringstream ostr; \
+ ostr << the_values[n]; \
+ ostr.str().copy(s, std::string::npos); \
+ s[ostr.str().length()] = 0; \
return s; \
}
@@ -232,7 +229,7 @@ class NcValues // ABC for value blocks
NcValues(NcType, long);
virtual ~NcValues( void );
virtual long num( void );
- virtual ostream& print(ostream&) const = 0;
+ virtual std::ostream& print(std::ostream&) const = 0;
virtual void* base( void ) const = 0;
virtual int bytes_for_one( void ) const = 0;
@@ -252,7 +249,7 @@ class NcValues // ABC for value blocks
protected:
NcType the_type;
long the_number;
- friend ostream& operator<< (ostream&, const NcValues&);
+ friend std::ostream& operator<< (std::ostream&, const NcValues&);
};
declare(NcValues,ncbyte)