]> git.sesse.net Git - vlc/blobdiff - modules/access/mmap.c
Fix Memory leak: free proxy_factory even when buffer for asprintf can not be assigned
[vlc] / modules / access / mmap.c
index b1289170d10e83a7c45a1defa74d43a459cc18b8..9f358546f541299b319d806a255db47b14eefb75 100644 (file)
@@ -23,7 +23,8 @@
 # include <config.h>
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_access.h>
 #include <vlc_input.h>
 #include <vlc_charset.h>
@@ -50,16 +51,16 @@ static int Open (vlc_object_t *);
 static void Close (vlc_object_t *);
 
 vlc_module_begin();
-    set_shortname (_("MMap"));
-    set_description (_("Memory-mapped file input"));
+    set_shortname (N_("MMap"));
+    set_description (N_("Memory-mapped file input"));
     set_category (CAT_INPUT);
     set_subcategory (SUBCAT_INPUT_ACCESS);
-    set_capability ("access2", 52);
+    set_capability ("access", 52);
     add_shortcut ("file");
     set_callbacks (Open, Close);
 
-    add_bool ("file-mmap", VLC_TRUE, NULL,
-              FILE_MMAP_TEXT, FILE_MMAP_LONGTEXT, VLC_TRUE);
+    add_bool ("file-mmap", true, NULL,
+              FILE_MMAP_TEXT, FILE_MMAP_LONGTEXT, true);
 vlc_module_end();
 
 static block_t *Block (access_t *);
@@ -177,7 +178,7 @@ static block_t *Block (access_t *p_access)
         /* Really at end of file then */
         if ((uint64_t)p_access->info.i_pos >= (uint64_t)p_access->info.i_size)
         {
-            p_access->info.b_eof = VLC_TRUE;
+            p_access->info.b_eof = true;
             msg_Dbg (p_access, "at end of memory mapped file");
             return NULL;
         }
@@ -213,7 +214,7 @@ static block_t *Block (access_t *p_access)
     if (addr == MAP_FAILED)
     {
         msg_Err (p_access, "memory mapping failed (%m)");
-        intf_UserFatal (p_access, VLC_FALSE, _("File reading failed"),
+        intf_UserFatal (p_access, false, _("File reading failed"),
                         _("VLC could not read the file."));
         msleep (INPUT_ERROR_SLEEP);
         return NULL;
@@ -257,7 +258,7 @@ static int Seek (access_t *p_access, int64_t i_pos)
 #endif
 
     p_access->info.i_pos = i_pos;
-    p_access->info.b_eof = VLC_FALSE;
+    p_access->info.b_eof = false;
     return VLC_SUCCESS;
 }
 
@@ -272,7 +273,7 @@ static int Control (access_t *p_access, int query, va_list args)
         case ACCESS_CAN_FASTSEEK:
         case ACCESS_CAN_PAUSE:
         case ACCESS_CAN_CONTROL_PACE:
-            *((vlc_bool_t *)va_arg (args, vlc_bool_t *)) = VLC_TRUE;
+            *((bool *)va_arg (args, bool *)) = true;
             return VLC_SUCCESS;
 
         case ACCESS_GET_MTU: