]> git.sesse.net Git - vlc/blobdiff - modules/access_filter/bandwidth.c
Factorize the localtime_r replacement
[vlc] / modules / access_filter / bandwidth.c
index 77f7e0cc3164e120a53eab5ad45b4ef3f6b6a6e4..02782909eca3ccd4bc30c92608894f7b5987837b 100644 (file)
@@ -2,7 +2,7 @@
  * bandwidth.c
  *****************************************************************************
  * Copyright © 2007 Rémi Denis-Courmont
- * $Id: dump.c 19948 2007-04-26 19:53:53Z courmisch $
+ * $Id$
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <assert.h>
 #include <errno.h>
 
@@ -51,7 +53,7 @@ vlc_module_begin ();
                  BANDWIDTH_LONGTEXT, VLC_FALSE);
 vlc_module_end();
 
-static int Read (access_t *access, uint8_t *buffer, int len);
+static ssize_t Read (access_t *access, uint8_t *buffer, size_t len);
 static int Seek (access_t *access, int64_t offset);
 static int Control (access_t *access, int cmd, va_list ap);
 
@@ -92,7 +94,8 @@ static int Open (vlc_object_t *obj)
     p_sys->bandwidth = var_CreateGetInteger (access, "access-bandwidth");
     p_sys->last_time = mdate ();
 
-    msg_Dbg (obj, "bandwidth limit: %u bytes/s", p_sys->bandwidth);
+    msg_Dbg (obj, "bandwidth limit: %lu bytes/s",
+             (unsigned long)p_sys->bandwidth);
     return VLC_SUCCESS;
 }
 
@@ -108,7 +111,7 @@ static void Close (vlc_object_t *obj)
 }
 
 
-static int Read (access_t *access, uint8_t *buffer, int len)
+static ssize_t Read (access_t *access, uint8_t *buffer, size_t len)
 {
     access_t *src = access->p_source;
     access_sys_t *p_sys = access->p_sys;