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: Michael Goffioul
Subject: MSVC compiler support [patch 24]: strftime crash
Date: Tue, 17 Oct 2006 21:56:08 +0200
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

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;

reply via email to

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