[vlc-devel] commit: Snapshot naming: fix thread safety (basOS G )
git version control
git at videolan.org
Tue Dec 30 13:08:14 CET 2008
vlc | branch: master | basOS G <noxelia 4t gmail , com> | Mon Dec 29 23:55:14 2008 +0200| [09893d6231701581138068f3730d75b76a467bef] | committer: Rémi Denis-Courmont
Snapshot naming: fix thread safety
Make snapshot date convertion thread safe
Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09893d6231701581138068f3730d75b76a467bef
---
src/video_output/vout_intf.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index b68305a..04256de 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -758,10 +758,10 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
}
else
{
- struct tm* curtime;
+ struct tm curtime;
time_t lcurtime ;
lcurtime = time( NULL ) ;
- if ( ( (curtime = localtime( &lcurtime )) == NULL ) )
+ if ( ( localtime_r( &lcurtime, &curtime ) == NULL ) )
{
msg_Warn( p_vout, "failed to get current time. Falling back to legacy snapshot naming" );
/* failed to get current time. Fallback to old format */
@@ -778,14 +778,14 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
else
{
char psz_curtime[15] ;
- if( strftime( psz_curtime, 15, "%y%m%d-%H%M%S", curtime ) == 0 )
+ if( strftime( psz_curtime, 15, "%y%m%d-%H%M%S", &curtime ) == 0 )
{
msg_Warn( p_vout, "snapshot date string truncated" ) ;
}
if( asprintf( &psz_filename, "%s" DIR_SEP "%s%s%1u.%s",
val.psz_string, psz_prefix, psz_curtime,
/* suffix with the last decimal digit in 10s of seconds resolution */
- (unsigned int)(p_pic->date / 100*1000) & 0xFF,
+ (unsigned int)(p_pic->date / (100*1000)) & 0xFF,
format.psz_string ) == -1 )
{
msg_Err( p_vout, "could not create snapshot" );
More information about the vlc-devel
mailing list