Commit 6b822f38 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use (s)size_t for pf_read and pf_write.

This is very likely to break .*64 platforms.
parent 2d40161c
......@@ -88,7 +88,7 @@ struct access_t
/* pf_read/pf_block is used to read data.
* XXX A access should set one and only one of them */
int (*pf_read) ( access_t *, uint8_t *, int ); /* Return -1 if no data yet, 0 if no more data, else real data read */
ssize_t (*pf_read) ( access_t *, uint8_t *, size_t ); /* Return -1 if no data yet, 0 if no more data, else real data read */
block_t *(*pf_block)( access_t * ); /* return a block of data in his 'natural' size, NULL if not yet data or eof */
/* Called for each seek.
......
......@@ -93,8 +93,8 @@ struct sout_access_out_t
char *psz_path;
sout_access_out_sys_t *p_sys;
int (*pf_seek)( sout_access_out_t *, off_t );
int (*pf_read)( sout_access_out_t *, block_t * );
int (*pf_write)( sout_access_out_t *, block_t * );
ssize_t (*pf_read)( sout_access_out_t *, block_t * );
ssize_t (*pf_write)( sout_access_out_t *, block_t * );
int (*pf_control)( sout_access_out_t *, int, va_list);
config_chain_t *p_cfg;
......@@ -104,8 +104,8 @@ struct sout_access_out_t
VLC_EXPORT( sout_access_out_t *,sout_AccessOutNew, ( sout_instance_t *, const char *psz_access, const char *psz_name ) );
VLC_EXPORT( void, sout_AccessOutDelete, ( sout_access_out_t * ) );
VLC_EXPORT( int, sout_AccessOutSeek, ( sout_access_out_t *, off_t ) );
VLC_EXPORT( int, sout_AccessOutRead, ( sout_access_out_t *, block_t * ) );
VLC_EXPORT( int, sout_AccessOutWrite, ( sout_access_out_t *, block_t * ) );
VLC_EXPORT( ssize_t, sout_AccessOutRead, ( sout_access_out_t *, block_t * ) );
VLC_EXPORT( ssize_t, sout_AccessOutWrite, ( sout_access_out_t *, block_t * ) );
VLC_EXPORT( int, sout_AccessOutControl,( sout_access_out_t *, int, va_list ) );
/** Muxer structure */
......
......@@ -55,7 +55,7 @@ access_t *p_cdda_input = NULL;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int CDDARead( access_t *, uint8_t *, int );
static ssize_t CDDARead( access_t *, uint8_t *, size_t );
static block_t *CDDAReadBlocks( access_t * p_access );
static int CDDASeek( access_t * p_access, int64_t i_pos );
static int CDDAControl( access_t *p_access, int i_query,
......
......@@ -121,8 +121,8 @@ enum
typedef struct stat_list_t stat_list_t;
static int Read( access_t *, uint8_t *, int );
static int ReadNull( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static ssize_t ReadNull( access_t *, uint8_t *, size_t );
static int Control( access_t *, int, va_list );
static int Demux( demux_t *p_demux );
......@@ -172,7 +172,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* ReadNull: read the directory
*****************************************************************************/
static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
static ssize_t ReadNull( access_t *p_access, uint8_t *p_buffer, size_t i_len)
{
/* Return fake data */
memset( p_buffer, 0, i_len );
......@@ -182,7 +182,7 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
/*****************************************************************************
* Read: read the directory
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
{
char *psz;
int i_mode, i_activity;
......@@ -261,7 +261,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
/* Return fake data forever */
p_access->pf_read = ReadNull;
return ReadNull( p_access, p_buffer, i_len );
return -1;
}
/*****************************************************************************
......
......@@ -72,7 +72,7 @@ CFDataRef dataFromEyetv;
int lastPacketId;
int lastForwardedPacketId;
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Control( access_t *, int, va_list );
static void Thread( vlc_object_t * );
CFDataRef msgPortCallback( CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info );
......@@ -240,7 +240,7 @@ CFDataRef msgPortCallback( CFMessagePortRef local, SInt32 msgid, CFDataRef data,
/*****************************************************************************
* Read: forwarding data from EyeTV plugin which was received above
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
extern CFDataRef dataFromEyetv;
......
......@@ -106,7 +106,7 @@ vlc_module_end();
* Exported prototypes
*****************************************************************************/
static int Seek( access_t *, int64_t );
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Control( access_t *, int, va_list );
static block_t *mmapBlock( access_t * );
......@@ -249,7 +249,7 @@ static void Close (vlc_object_t * p_this)
/*****************************************************************************
* Read: standard read on a file descriptor.
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_ret;
......
......@@ -92,8 +92,8 @@ vlc_module_end();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Read( access_t *, uint8_t *, int );
static int Write( sout_access_out_t *, block_t * );
static ssize_t Read( access_t *, uint8_t *, size_t );
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek( access_t *, int64_t );
static int OutSeek( sout_access_out_t *, int64_t );
static int Control( access_t *, int, va_list );
......@@ -461,7 +461,7 @@ static int OutSeek( sout_access_out_t *p_access, off_t i_pos )
/*****************************************************************************
* Read:
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_read;
......@@ -485,7 +485,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
/*****************************************************************************
* Write:
*****************************************************************************/
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
access_sys_t *p_sys = GET_OUT_SYS(p_access);
size_t i_write = 0;
......
......@@ -143,7 +143,7 @@ struct access_sys_t
};
/* */
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Seek( access_t *, int64_t );
static int Control( access_t *, int, va_list );
......@@ -459,7 +459,7 @@ static void Close( vlc_object_t *p_this )
* p_buffer. Return the actual number of bytes read
*****************************************************************************/
static int ReadICYMeta( access_t *p_access );
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_read;
......
......@@ -48,8 +48,8 @@
int E_(MMSHOpen) ( access_t * );
void E_(MMSHClose) ( access_t * );
static int Read( access_t *, uint8_t *, int );
static int ReadRedirect( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static ssize_t ReadRedirect( access_t *, uint8_t *, size_t );
static int Seek( access_t *, int64_t );
static int Control( access_t *, int, va_list );
......@@ -338,22 +338,22 @@ static int Seek( access_t *p_access, int64_t i_pos )
/*****************************************************************************
* Read:
*****************************************************************************/
static int ReadRedirect( access_t *p_access, uint8_t *p, int i_len )
static ssize_t ReadRedirect( access_t *p_access, uint8_t *p, size_t i_len )
{
return VLC_SUCCESS;
return 0;
}
/*****************************************************************************
* Read:
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
size_t i_copy;
size_t i_data = 0;
if( p_access->info.b_eof )
return VLC_SUCCESS;
return 0;
while( i_data < (size_t) i_len )
{
......
......@@ -68,7 +68,7 @@ int E_( MMSTUOpen ) ( access_t * );
void E_( MMSTUClose ) ( access_t * );
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Seek( access_t *, int64_t );
static int Control( access_t *, int, va_list );
......@@ -370,7 +370,7 @@ static int Seek( access_t * p_access, int64_t i_pos )
/*****************************************************************************
* Read:
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
size_t i_data;
......
......@@ -166,7 +166,7 @@ vlc_module_end();
/*****************************************************************************
* Prototypes
*****************************************************************************/
static int Read ( access_t *, uint8_t *, int );
static ssize_t Read ( access_t *, uint8_t *, size_t );
static int Control( access_t *, int, va_list );
/* ivtv specific ioctls */
......@@ -1063,7 +1063,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Read
*****************************************************************************/
static int Read( access_t * p_access, uint8_t * p_buffer, int i_len )
static ssize_t Read( access_t * p_access, uint8_t * p_buffer, size_t i_len )
{
access_sys_t *p_sys = (access_sys_t *) p_access->p_sys;
struct pollfd ufd;
......
......@@ -91,7 +91,7 @@ vlc_module_end();
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Seek( access_t *, int64_t );
static int Control( access_t *, int, va_list );
......@@ -348,7 +348,7 @@ static int Seek( access_t *p_access, int64_t i_pos )
/*****************************************************************************
* Read:
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_read;
......
......@@ -64,7 +64,7 @@ struct access_sys_t
};
static int Read( access_t *, uint8_t *, int );
static ssize_t Read( access_t *, uint8_t *, size_t );
static int Control( access_t *, int, va_list );
/*****************************************************************************
......@@ -132,7 +132,7 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Read: read on a file descriptor, checking b_die periodically
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_sys_t *p_sys = p_access->p_sys;
int i_read;
......
......@@ -49,7 +49,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);
......@@ -107,7 +107,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;
......
......@@ -60,7 +60,7 @@ vlc_module_begin ();
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);
......@@ -180,7 +180,7 @@ 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;
......
......@@ -67,7 +67,7 @@ vlc_module_end();
*****************************************************************************/
static block_t *Block ( access_t * );
static int Read ( access_t *, uint8_t *, int );
static ssize_t Read ( access_t *, uint8_t *, size_t );
static int Control( access_t *, int i_query, va_list args );
static int Seek ( access_t *, int64_t );
......@@ -205,7 +205,7 @@ static block_t *Block( access_t *p_access )
/*****************************************************************************
*
*****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
{
access_t *p_src = p_access->p_source;
int i_ret;
......
......@@ -83,9 +83,9 @@ static const char *ppsz_sout_options[] = {
"append", NULL
};
static int Write( sout_access_out_t *, block_t * );
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
static int Read ( sout_access_out_t *, block_t * );
static ssize_t Read ( sout_access_out_t *, block_t * );
struct sout_access_out_sys_t
{
......@@ -184,7 +184,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Read: standard read on a file descriptor.
*****************************************************************************/
static int Read( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Read( sout_access_out_t *p_access, block_t *p_buffer )
{
if( strcmp( p_access->psz_path, "-" ) )
{
......@@ -199,7 +199,7 @@ static int Read( sout_access_out_t *p_access, block_t *p_buffer )
/*****************************************************************************
* Write: standard write on a file descriptor.
*****************************************************************************/
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
size_t i_write = 0;
......
......@@ -122,7 +122,7 @@ static const char *ppsz_sout_options[] = {
"user", "pwd", "mime", "cert", "key", "ca", "crl", NULL
};
static int Write( sout_access_out_t *, block_t * );
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
struct sout_access_out_sys_t
......@@ -373,7 +373,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Write:
*****************************************************************************/
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
sout_access_out_sys_t *p_sys = p_access->p_sys;
int i_err = 0;
......
......@@ -144,9 +144,8 @@ static const char *ppsz_sout_options[] = {
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static int Write( sout_access_out_t *, block_t * );
static ssize_t Write( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
static int Read ( sout_access_out_t *, block_t * );
struct sout_access_out_sys_t
{
......@@ -445,7 +444,6 @@ static int Open( vlc_object_t *p_this )
}
p_access->pf_write = Write;
p_access->pf_read = Read;
p_access->pf_seek = Seek;
msg_Dbg( p_access, "shout access output opened (%s@%s:%i/%s)",
......@@ -485,19 +483,10 @@ static void Close( vlc_object_t * p_this )
msg_Dbg( p_access, "shout access output closed" );
}
/*****************************************************************************
* Read: standard read -- not supported
*****************************************************************************/
static int Read( sout_access_out_t *p_access, block_t *p_buffer )
{
msg_Err( p_access, "cannot read from shout" );
return VLC_EGENERIC;
}
/*****************************************************************************
* Write: standard write
*****************************************************************************/
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
size_t i_write = 0;
......
......@@ -112,7 +112,7 @@ static const char *const ppsz_core_options[] = {
NULL
};
static int Write ( sout_access_out_t *, block_t * );
static ssize_t Write ( sout_access_out_t *, block_t * );
static int Seek ( sout_access_out_t *, off_t );
static void ThreadWrite( vlc_object_t * );
......@@ -323,7 +323,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Write: standard write on a file descriptor.
*****************************************************************************/
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
{
sout_access_out_sys_t *p_sys = p_access->p_sys;
int i_len = 0;
......
......@@ -365,7 +365,7 @@ int sout_AccessOutSeek( sout_access_out_t *p_access, off_t i_pos )
/*****************************************************************************
* sout_AccessRead:
*****************************************************************************/
int sout_AccessOutRead( sout_access_out_t *p_access, block_t *p_buffer )
ssize_t sout_AccessOutRead( sout_access_out_t *p_access, block_t *p_buffer )
{
return( p_access->pf_read ?
p_access->pf_read( p_access, p_buffer ) : VLC_EGENERIC );
......@@ -374,9 +374,9 @@ int sout_AccessOutRead( sout_access_out_t *p_access, block_t *p_buffer )
/*****************************************************************************
* sout_AccessWrite:
*****************************************************************************/
int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
ssize_t sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
{
const int i_packets_gather = 30;
const unsigned i_packets_gather = 30;
p_access->i_writes++;
p_access->i_sent_bytes += p_buffer->i_buffer;
if( (p_access->i_writes % i_packets_gather) == 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment