]> git.sesse.net Git - vlc/blobdiff - modules/access_filter/timeshift.c
* removed instability warning, which was introduced for the 0.8.5 betas
[vlc] / modules / access_filter / timeshift.c
index aa35a6050609fbfc4054a3c370ecb88e34dde9a4..1345f4f28a84b99a0fe30538d61de56d6856e5ec 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <vlc/vlc.h>
 #include <vlc/input.h>
+#include "charset.h"
+
 #include <unistd.h>
 
 /*****************************************************************************
@@ -40,8 +42,9 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 #define GRANULARITY_TEXT N_("Timeshift granularity")
-#define GRANULARITY_LONGTEXT N_( "Size of the temporary files use to store " \
-  "the timeshifted stream." )
+/// \bug [String] typo
+#define GRANULARITY_LONGTEXT N_( "This is the size of the temporary files " \
+  "tha will be used to store the timeshifted streams." )
 #define DIR_TEXT N_("Timeshift directory")
 #define DIR_LONGTEXT N_( "Directory used to store the timeshift temporary " \
   "files." )
@@ -375,7 +378,7 @@ static int WriteBlockToFile( access_t *p_access, block_t *p_block )
 
         sprintf( p_sys->psz_filename, "%s%i.dat",
                  p_sys->psz_filename_base, p_sys->i_files );
-        file = fopen( p_sys->psz_filename, "w+b" );
+        file = utf8_fopen( p_sys->psz_filename, "w+b" );
 
         if( !file && p_sys->i_files < 2 )
         {
@@ -535,35 +538,38 @@ static char *GetTmpFilePath( access_t *p_access )
     char *psz_dir = var_GetString( p_access, "timeshift-dir" );
     char *psz_filename_base;
 
-    if( psz_dir && !*psz_dir )
+    if( ( psz_dir != NULL ) && ( psz_dir[0] == '\0' ) )
     {
         free( psz_dir );
-        psz_dir = 0;
+        psz_dir = NULL;
     }
 
-    if( !psz_dir )
+    if( psz_dir == NULL )
     {
 #ifdef WIN32
+        char psz_local_dir[MAX_PATH];
         int i_size;
 
-        psz_dir = malloc( MAX_PATH + 1 );
-        i_size = GetTempPath( MAX_PATH, psz_dir );
+        i_size = GetTempPath( MAX_PATH, psz_local_dir );
         if( i_size <= 0 || i_size > MAX_PATH )
         {
-            if( !getcwd( psz_dir, MAX_PATH ) ) strcpy( psz_dir, "c:" );
+            if( !getcwd( psz_local_dir, MAX_PATH ) )
+                strcpy( psz_local_dir, "C:" );
         }
 
+        psz_dir = FromLocaleDup( psz_local_dir );
+
         /* remove last \\ if any */
         if( psz_dir[strlen(psz_dir)-1] == '\\' )
             psz_dir[strlen(psz_dir)-1] = '\0';
 #else
-
         psz_dir = strdup( "/tmp" );
 #endif
     }
 
     asprintf( &psz_filename_base, "%s/vlc-timeshift-%d-%d-",
               psz_dir, getpid(), p_access->i_object_id );
+    free( psz_dir );
 
     return psz_filename_base;
 }