]> git.sesse.net Git - vlc/blobdiff - modules/access_filter/record.c
access_filter_dump: use key-action
[vlc] / modules / access_filter / record.c
index fc465fac60ea086a4db2ebc0d8c6b3b0e5a9e7ef..7b9cec1154f675e155d5774fc451c85b8c101b8b 100644 (file)
  * Preamble
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 #include <vlc_input.h>
@@ -57,6 +61,7 @@ vlc_module_begin();
 
     add_directory( "record-path", NULL, NULL,
                    RECORD_PATH_TXT, RECORD_PATH_LONGTXT, VLC_TRUE );
+        change_unsafe();
 
     set_callbacks( Open, Close );
 
@@ -67,7 +72,7 @@ vlc_module_end();
  *****************************************************************************/
 
 static block_t *Block  ( access_t * );
-static int      Read   ( access_t *, uint8_t *, int );
+static ssize_t  Read   ( access_t *, uint8_t *, size_t );
 static int      Control( access_t *, int i_query, va_list args );
 static int      Seek   ( access_t *, int64_t );
 
@@ -205,7 +210,7 @@ static block_t *Block( access_t *p_access )
 /*****************************************************************************
  *
  *****************************************************************************/
-static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
+static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 {
     access_t     *p_src = p_access->p_source;
     int i_ret;
@@ -362,16 +367,7 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer )
         time_t t = time(NULL);
         struct tm l;
 
-#ifdef HAVE_LOCALTIME_R
         if( !localtime_r( &t, &l ) ) memset( &l, 0, sizeof(l) );
-#else
-        /* Grrr */
-        {
-            struct tm *p_l = localtime( &t );
-            if( p_l ) l = *p_l;
-            else memset( &l, 0, sizeof(l) );
-        }
-#endif
 
         p_input = vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
         if( p_input )
@@ -447,8 +443,8 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer )
         p_sys->f = utf8_fopen( p_sys->psz_file, "wb" );
         if( p_sys->f == NULL )
         {
-            msg_Err( p_access, "cannot open file '%s' (%s)",
-                     p_sys->psz_file, strerror(errno) );
+            msg_Err( p_access, "cannot open file '%s' (%m)",
+                     p_sys->psz_file );
             free( p_sys->psz_file );
             p_sys->psz_file = NULL;
             p_sys->b_dump = VLC_FALSE;