]> git.sesse.net Git - vlc/blobdiff - modules/access/mmap.c
BDA: remove unneeded variable.
[vlc] / modules / access / mmap.c
index cbec77022d0b4f4f17374b0e1de49a3d4ceb0f63..8a36040aad316eb673e62d5e9efda5c65f322080 100644 (file)
@@ -28,7 +28,7 @@
 #include <vlc_access.h>
 #include <vlc_input.h>
 #include <vlc_charset.h>
-#include <vlc_interface.h>
+#include <vlc_dialog.h>
 
 #include <assert.h>
 
@@ -59,7 +59,7 @@ vlc_module_begin ()
     add_shortcut ("file")
     set_callbacks (Open, Close)
     add_bool ("file-mmap", false, NULL,
-              FILE_MMAP_TEXT, FILE_MMAP_LONGTEXT, true);
+              FILE_MMAP_TEXT, FILE_MMAP_LONGTEXT, true)
 vlc_module_end ()
 
 static block_t *Block (access_t *);
@@ -102,7 +102,6 @@ static int Open (vlc_object_t *p_this)
         msg_Warn (p_access, "cannot open %s: %m", path);
         goto error;
     }
-    fcntl (fd, F_SETFD, fcntl (fd, F_GETFD) | FD_CLOEXEC);
 
     /* mmap() is only safe for regular and block special files.
      * For other types, it may be some idiosyncrasic interface (e.g. packet
@@ -117,7 +116,7 @@ static int Open (vlc_object_t *p_this)
 
     if (!S_ISREG (st.st_mode) && !S_ISBLK (st.st_mode))
     {
-        msg_Dbg (p_access, "skipping non regular file %s", path);
+        msg_Dbg (p_access, "skipping non-regular file %s", path);
         goto error;
     }
 
@@ -197,13 +196,13 @@ static block_t *Block (access_t *p_access)
 #ifdef MMAP_DEBUG
     int64_t dbgpos = lseek (p_sys->fd, 0, SEEK_CUR);
     if (dbgpos != p_access->info.i_pos)
-        msg_Err (p_access, "position: 0x%08llx instead of 0x%08llx",
+        msg_Err (p_access, "position: 0x%016"PRIx64" instead of 0x%016"PRIx64,
                  p_access->info.i_pos, dbgpos);
 #endif
 
     const uintptr_t page_mask = p_sys->page_size - 1;
     /* Start the mapping on a page boundary: */
-    off_t  outer_offset = p_access->info.i_pos & ~page_mask;
+    off_t  outer_offset = p_access->info.i_pos & ~(off_t)page_mask;
     /* Skip useless bytes at the beginning of the first page: */
     size_t inner_offset = p_access->info.i_pos & page_mask;
     /* Map no more bytes than remain: */
@@ -227,7 +226,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, false, _("File reading failed"),
+        dialog_Fatal (p_access, _("File reading failed"), "%s",
                         _("VLC could not read the file."));
         goto fatal;
     }
@@ -243,16 +242,16 @@ static block_t *Block (access_t *p_access)
     block->i_buffer -= inner_offset;
 
 #ifdef MMAP_DEBUG
-    msg_Dbg (p_access, "mapped 0x%lx bytes at %p from offset 0x%lx",
-             (unsigned long)length, addr, (unsigned long)outer_offset);
+    msg_Dbg (p_access, "mapped 0x%zx bytes at %p from offset 0x%"PRIx64,
+             length, addr, (uint64_t)outer_offset);
 
     /* Compare normal I/O with memory mapping */
     char *buf = malloc (block->i_buffer);
     ssize_t i_read = read (p_sys->fd, buf, block->i_buffer);
 
     if (i_read != (ssize_t)block->i_buffer)
-        msg_Err (p_access, "read %u instead of %u bytes", (unsigned)i_read,
-                 (unsigned)block->i_buffer);
+        msg_Err (p_access, "read %zd instead of %zu bytes", i_read,
+                 block->i_buffer);
     if (memcmp (buf, block->p_buffer, block->i_buffer))
         msg_Err (p_access, "inconsistent data buffer");
     free (buf);
@@ -281,8 +280,6 @@ static int Seek (access_t *p_access, int64_t i_pos)
 
 static int Control (access_t *p_access, int query, va_list args)
 {
-    access_sys_t *p_sys = p_access->p_sys;
-
     switch (query)
     {
         case ACCESS_CAN_SEEK:
@@ -292,10 +289,6 @@ static int Control (access_t *p_access, int query, va_list args)
             *((bool *)va_arg (args, bool *)) = true;
             return VLC_SUCCESS;
 
-        case ACCESS_GET_MTU:
-            *((int *)va_arg (args, int *)) = p_sys->mtu;
-            return VLC_SUCCESS;
-
         case ACCESS_GET_PTS_DELAY:
         {
             int delay_ms = var_CreateGetInteger (p_access, "file-caching");