#include <vlc/vlc.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <assert.h>
#include <time.h>
#include <errno.h>
MARGIN_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 block_t *Block (access_t *access);
static int Seek (access_t *access, int64_t offset);
static int Control (access_t *access, int cmd, va_list ap);
if ((p_sys->stream = tmpfile ()) == NULL)
{
- msg_Err (access, "cannot create temporary file: %s", strerror (errno));
+ msg_Err (access, "cannot create temporary file: %m");
free (p_sys);
return VLC_EGENERIC;
}
goto error;
}
+ assert (len > 0);
if (fwrite (buffer, len, 1, stream) != 1)
{
- msg_Err (access, "cannot write to file: %s", strerror (errno));
+ msg_Err (access, "cannot write to file: %m");
goto error;
}
}
-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;
* This is not thread-safe. Blame your C library.
* On Win32 there SHOULD be _localtime_s instead, but of course
* Cygwin and Mingw32 don't know about it. You're on your own if you
- * this platform.
+ * use this platform.
*/
if (unsafe == NULL)
return NULL;
FILE *newstream = utf8_fopen (filename, "wb");
if (newstream == NULL)
{
- msg_Err (access, "cannot create dump file \"%s\": %s", filename,
- strerror (errno));
+ msg_Err (access, "cannot create dump file \"%s\": %m", filename);
return;
}
{
if (ferror (oldstream))
{
- msg_Err (access, "cannot read temporary file: %s",
- strerror (errno));
+ msg_Err (access, "cannot read temporary file: %m");
break;
}
if (fwrite (buf, len, 1, newstream) != 1)
{
- msg_Err (access, "cannot write dump file: %s", strerror (errno));
+ msg_Err (access, "cannot write dump file: %m");
break;
}
}