changeset 3642:3843aa0767c8

[project @ 2000-03-24 10:48:48 by jwe]
author jwe
date Fri, 24 Mar 2000 10:48:48 +0000
parents 5ac1b0cb4fe8
children 3af6d00b82ed
files src/ChangeLog src/c-file-ptr-stream.cc src/oct-stream.h
diffstat 3 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
 2000-03-24  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* c-file-ptr-stream.cc (c_file_ptr_buf::~c_file_ptr_buf):
+	Avoid dereferencing NULL pointer.
+
 	* oct-stream.cc (printf_format_list::add_elt_to_list,
 	printf_format_list::process_conversion,
 	printf_format_list::finish_conversion): New args, flags, fw, and prec.
--- a/src/c-file-ptr-stream.cc
+++ b/src/c-file-ptr-stream.cc
@@ -42,7 +42,11 @@
 #define SEEK_END 2
 #endif
 
-c_file_ptr_buf::~c_file_ptr_buf (void) { fflush (f); }
+c_file_ptr_buf::~c_file_ptr_buf (void)
+{
+  if (f)
+    fflush (f);
+}
 
 // XXX FIXME XXX -- I'm sure there is room for improvement here...
 
--- a/src/oct-stream.h
+++ b/src/oct-stream.h
@@ -148,7 +148,7 @@
 
 private:
 
-  // Number of conversions specified by this format std::string, or -1 if
+  // Number of conversions specified by this format string, or -1 if
   // invalid conversions have been found.
   int nconv;
 
@@ -225,7 +225,7 @@
   int prec;
 
   // Flags -- `-', `+', ` ', `0', or `#'.
-  string flags;
+  std::string flags;
 
   // Type of conversion -- `d', `i', `o', `x', `X', `u', `c', `s',
   // `f', `e', `E', `g', `G', `p', or `%'
@@ -280,7 +280,7 @@
 
 private:
 
-  // Number of conversions specified by this format std::string, or -1 if
+  // Number of conversions specified by this format string, or -1 if
   // invalid conversions have been found.
   int nconv;