$NetBSD: patch-ap,v 1.1 2004/01/11 15:58:45 cjep Exp $ --- cxx/ncvalues.h.orig 1998-10-28 17:10:16.000000000 +0000 +++ cxx/ncvalues.h @@ -10,11 +10,11 @@ #ifndef Ncvalues_def #define Ncvalues_def -#include +#include #ifdef STRSTREAM_H_SPEC # include STRSTREAM_H_SPEC #else -# include +# include #endif #include #include @@ -82,7 +82,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) @@ -219,9 +219,11 @@ inline double NcVal(TYPE)::as_double( lo #define as_string_implement(TYPE) \ 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] << std::ends; \ + std::string str(ostr.str()); \ + char *s = new char[str.size()]; \ + str.copy(s, str.size()); \ return s; \ } @@ -232,7 +234,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; @@ -250,9 +252,9 @@ class NcValues // ABC for value blocks virtual char* as_string( long n ) const = 0; // value as string protected: - NcType the_type; long the_number; - friend ostream& operator<< (ostream&, const NcValues&); + NcType the_type; + friend std::ostream& operator<< (std::ostream&, const NcValues&); }; declare(NcValues,ncbyte)