octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSVC compiler support [patch 24]: strftime crash


From: John W. Eaton
Subject: MSVC compiler support [patch 24]: strftime crash
Date: Wed, 25 Oct 2006 20:37:39 -0400

On 17-Oct-2006, Michael Goffioul wrote:

| Avoid crash under Win32 when %T is given in the format string.
| 
| Index: liboctave/oct-time.cc
| ===================================================================
| RCS file: /cvs/octave/liboctave/oct-time.cc,v
| retrieving revision 1.21
| diff -p -c -r1.21 oct-time.cc
| *** liboctave/oct-time.cc     16 Mar 2006 03:59:09 -0000      1.21
| --- liboctave/oct-time.cc     17 Oct 2006 11:07:42 -0000
| *************** octave_base_tm::strftime (const std::str
| *** 251,257 ****
| --- 251,265 ----
|         t.tm_zone = ps;
|   #endif
|   
| + #ifndef _MSC_VER
|         const char *fmt_str = fmt.c_str ();
| + #else
| +       std::string fmt2 = fmt;
| +       int pos = fmt2.find("%T");
| +       if (pos != NPOS)
| +           fmt2 = fmt2.replace(pos, 2, "");
| +       const char *fmt_str = fmt2.c_str ();
| + #endif
|   
|         char *buf = 0;
|         size_t bufsize = STRFTIME_BUF_INITIAL_SIZE;

There is a replacement version of strftime already included with
Octave that we could use instead of breaking this feature.  So I think
we should add a configure check to see if %T works, and if it doesn't,
#undef HAVE_STRFTIME.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]