[vlc-devel] commit: Avoid POSIX-deprecated asctime_r() ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Apr 14 17:40:25 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Apr 14 18:39:52 2009 +0300| [1fe4b1c31622bc113fa3a3cfaa6ceef2f555457c] | committer: Rémi Denis-Courmont 

Avoid POSIX-deprecated asctime_r()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1fe4b1c31622bc113fa3a3cfaa6ceef2f555457c
---

 modules/demux/mkv/matroska_segment_parse.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index db889db..33fffa5 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -772,16 +772,15 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
             KaxDateUTC &date = *(KaxDateUTC*)l;
             time_t i_date;
             struct tm tmres;
-            char   buffer[256];
+            char   buffer[25];
 
             i_date = date.GetEpochDate();
-            memset( buffer, 0, 256 );
             if( gmtime_r( &i_date, &tmres ) &&
-                asctime_r( &tmres, buffer ) )
+                strftime( buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y",
+                          &tmres ) )
             {
-                buffer[strlen( buffer)-1]= '\0';
                 psz_date_utc = strdup( buffer );
-                msg_Dbg( &sys.demuxer, "|   |   + Date=%s", psz_date_utc );
+                msg_Dbg( &sys.demuxer, "|   |   + Date=%s", buffer );
             }
         }
         else if( MKV_IS_ID( l, KaxChapterTranslate ) )




More information about the vlc-devel mailing list