Commit 7979cfc5 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

input: Fix signed warnings about streams.

parent ae291708
...@@ -306,8 +306,8 @@ typedef struct ...@@ -306,8 +306,8 @@ typedef struct
} d_stream_sys_t; } d_stream_sys_t;
static int DStreamRead ( stream_t *, void *p_read, int i_read ); static int DStreamRead ( stream_t *, void *p_read, unsigned int i_read );
static int DStreamPeek ( stream_t *, const uint8_t **pp_peek, int i_peek ); static int DStreamPeek ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
static int DStreamControl( stream_t *, int i_query, va_list ); static int DStreamControl( stream_t *, int i_query, va_list );
static void* DStreamThread ( vlc_object_t * ); static void* DStreamThread ( vlc_object_t * );
...@@ -395,7 +395,7 @@ void stream_DemuxDelete( stream_t *s ) ...@@ -395,7 +395,7 @@ void stream_DemuxDelete( stream_t *s )
} }
static int DStreamRead( stream_t *s, void *p_read, int i_read ) static int DStreamRead( stream_t *s, void *p_read, unsigned int i_read )
{ {
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys; d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
uint8_t *p_out = p_read; uint8_t *p_out = p_read;
...@@ -436,7 +436,7 @@ static int DStreamRead( stream_t *s, void *p_read, int i_read ) ...@@ -436,7 +436,7 @@ static int DStreamRead( stream_t *s, void *p_read, int i_read )
return i_out; return i_out;
} }
static int DStreamPeek( stream_t *s, const uint8_t **pp_peek, int i_peek ) static int DStreamPeek( stream_t *s, const uint8_t **pp_peek, unsigned int i_peek )
{ {
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys; d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
block_t **pp_block = &p_sys->p_block; block_t **pp_block = &p_sys->p_block;
...@@ -512,7 +512,7 @@ static int DStreamControl( stream_t *s, int i_query, va_list args ) ...@@ -512,7 +512,7 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
while( i_skip > 0 ) while( i_skip > 0 )
{ {
int i_read = DStreamRead( s, NULL, i_skip ); int i_read = DStreamRead( s, NULL, (long)i_skip );
if( i_read <= 0 ) return VLC_EGENERIC; if( i_read <= 0 ) return VLC_EGENERIC;
i_skip -= i_read; i_skip -= i_read;
} }
......
...@@ -464,8 +464,8 @@ struct stream_t ...@@ -464,8 +464,8 @@ struct stream_t
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
/*block_t *(*pf_block) ( stream_t *, int i_size );*/ /*block_t *(*pf_block) ( stream_t *, int i_size );*/
int (*pf_read) ( stream_t *, void *p_read, int i_read ); int (*pf_read) ( stream_t *, void *p_read, unsigned int i_read );
int (*pf_peek) ( stream_t *, const uint8_t **pp_peek, int i_peek ); int (*pf_peek) ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
int (*pf_control)( stream_t *, int i_query, va_list ); int (*pf_control)( stream_t *, int i_query, va_list );
void (*pf_destroy)( stream_t *); void (*pf_destroy)( stream_t *);
......
...@@ -38,8 +38,8 @@ struct stream_sys_t ...@@ -38,8 +38,8 @@ struct stream_sys_t
}; };
static int Read ( stream_t *, void *p_read, int i_read ); static int Read ( stream_t *, void *p_read, unsigned int i_read );
static int Peek ( stream_t *, const uint8_t **pp_peek, int i_read ); static int Peek ( stream_t *, const uint8_t **pp_peek, unsigned int i_read );
static int Control( stream_t *, int i_query, va_list ); static int Control( stream_t *, int i_query, va_list );
static void Delete ( stream_t * ); static void Delete ( stream_t * );
...@@ -143,7 +143,7 @@ static int Control( stream_t *s, int i_query, va_list args ) ...@@ -143,7 +143,7 @@ static int Control( stream_t *s, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int Read( stream_t *s, void *p_read, int i_read ) static int Read( stream_t *s, void *p_read, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos ); int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos );
...@@ -152,7 +152,7 @@ static int Read( stream_t *s, void *p_read, int i_read ) ...@@ -152,7 +152,7 @@ static int Read( stream_t *s, void *p_read, int i_read )
return i_res; return i_res;
} }
static int Peek( stream_t *s, const uint8_t **pp_peek, int i_read ) static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos ); int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos );
......
...@@ -126,7 +126,7 @@ struct stream_sys_t ...@@ -126,7 +126,7 @@ struct stream_sys_t
struct struct
{ {
int64_t i_start; /* Offset of block for p_first */ int64_t i_start; /* Offset of block for p_first */
int i_offset; /* Offset for data in p_current */ int64_t i_offset; /* Offset for data in p_current */
block_t *p_current; /* Current block */ block_t *p_current; /* Current block */
int i_size; /* Total amount of data in the list */ int i_size; /* Total amount of data in the list */
...@@ -159,7 +159,7 @@ struct stream_sys_t ...@@ -159,7 +159,7 @@ struct stream_sys_t
} immediate; } immediate;
/* Peek temporary buffer */ /* Peek temporary buffer */
int i_peek; unsigned int i_peek;
uint8_t *p_peek; uint8_t *p_peek;
/* Stat for both method */ /* Stat for both method */
...@@ -189,22 +189,22 @@ struct stream_sys_t ...@@ -189,22 +189,22 @@ struct stream_sys_t
}; };
/* Method 1: */ /* Method 1: */
static int AStreamReadBlock( stream_t *s, void *p_read, int i_read ); static int AStreamReadBlock( stream_t *s, void *p_read, unsigned int i_read );
static int AStreamPeekBlock( stream_t *s, const uint8_t **p_peek, int i_read ); static int AStreamPeekBlock( stream_t *s, const uint8_t **p_peek, unsigned int i_read );
static int AStreamSeekBlock( stream_t *s, int64_t i_pos ); static int AStreamSeekBlock( stream_t *s, int64_t i_pos );
static void AStreamPrebufferBlock( stream_t *s ); static void AStreamPrebufferBlock( stream_t *s );
static block_t *AReadBlock( stream_t *s, bool *pb_eof ); static block_t *AReadBlock( stream_t *s, bool *pb_eof );
/* Method 2 */ /* Method 2 */
static int AStreamReadStream( stream_t *s, void *p_read, int i_read ); static int AStreamReadStream( stream_t *s, void *p_read, unsigned int i_read );
static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, int i_read ); static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int i_read );
static int AStreamSeekStream( stream_t *s, int64_t i_pos ); static int AStreamSeekStream( stream_t *s, int64_t i_pos );
static void AStreamPrebufferStream( stream_t *s ); static void AStreamPrebufferStream( stream_t *s );
static int AReadStream( stream_t *s, void *p_read, int i_read ); static int AReadStream( stream_t *s, void *p_read, unsigned int i_read );
/* Method 3 */ /* Method 3 */
static int AStreamReadImmediate( stream_t *s, void *p_read, int i_read ); static int AStreamReadImmediate( stream_t *s, void *p_read, unsigned int i_read );
static int AStreamPeekImmediate( stream_t *s, const uint8_t **pp_peek, int i_read ); static int AStreamPeekImmediate( stream_t *s, const uint8_t **pp_peek, unsigned int i_read );
static int AStreamSeekImmediate( stream_t *s, int64_t i_pos ); static int AStreamSeekImmediate( stream_t *s, int64_t i_pos );
/* Common */ /* Common */
...@@ -765,12 +765,12 @@ static void AStreamPrebufferBlock( stream_t *s ) ...@@ -765,12 +765,12 @@ static void AStreamPrebufferBlock( stream_t *s )
static int AStreamRefillBlock( stream_t *s ); static int AStreamRefillBlock( stream_t *s );
static int AStreamReadBlock( stream_t *s, void *p_read, int i_read ) static int AStreamReadBlock( stream_t *s, void *p_read, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
uint8_t *p_data= (uint8_t*)p_read; uint8_t *p_data= (uint8_t*)p_read;
int i_data = 0; unsigned int i_data = 0;
/* It means EOF */ /* It means EOF */
if( p_sys->block.p_current == NULL ) if( p_sys->block.p_current == NULL )
...@@ -791,7 +791,7 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read ) ...@@ -791,7 +791,7 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read )
{ {
int i_current = int i_current =
p_sys->block.p_current->i_buffer - p_sys->block.i_offset; p_sys->block.p_current->i_buffer - p_sys->block.i_offset;
int i_copy = __MIN( i_current, i_read - i_data); unsigned int i_copy = __MIN( (unsigned int)__MAX(i_current,0), i_read - i_data);
/* Copy data */ /* Copy data */
if( p_data ) if( p_data )
...@@ -824,13 +824,13 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read ) ...@@ -824,13 +824,13 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read )
return i_data; return i_data;
} }
static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, int i_read ) static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
uint8_t *p_data; uint8_t *p_data;
int i_data = 0; unsigned int i_data = 0;
block_t *b; block_t *b;
int i_offset; unsigned int i_offset;
if( p_sys->block.p_current == NULL ) return 0; /* EOF */ if( p_sys->block.p_current == NULL ) return 0; /* EOF */
...@@ -872,7 +872,7 @@ static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, int i_read ) ...@@ -872,7 +872,7 @@ static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, int i_read )
while( b && i_data < i_read ) while( b && i_data < i_read )
{ {
int i_current = b->i_buffer - i_offset; unsigned int i_current = __MAX(b->i_buffer - i_offset,0);
int i_copy = __MIN( i_current, i_read - i_data ); int i_copy = __MIN( i_current, i_read - i_data );
memcpy( p_data, &b->p_buffer[i_offset], i_copy ); memcpy( p_data, &b->p_buffer[i_offset], i_copy );
...@@ -1094,13 +1094,13 @@ static int AStreamRefillBlock( stream_t *s ) ...@@ -1094,13 +1094,13 @@ static int AStreamRefillBlock( stream_t *s )
****************************************************************************/ ****************************************************************************/
static int AStreamRefillStream( stream_t *s ); static int AStreamRefillStream( stream_t *s );
static int AStreamReadStream( stream_t *s, void *p_read, int i_read ) static int AStreamReadStream( stream_t *s, void *p_read, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk]; stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk];
uint8_t *p_data = (uint8_t *)p_read; uint8_t *p_data = (uint8_t *)p_read;
int i_data = 0; unsigned int i_data = 0;
if( tk->i_start >= tk->i_end ) return 0; /* EOF */ if( tk->i_start >= tk->i_end ) return 0; /* EOF */
...@@ -1131,9 +1131,9 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read ) ...@@ -1131,9 +1131,9 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
{ {
int i_off = (tk->i_start + p_sys->stream.i_offset) % int i_off = (tk->i_start + p_sys->stream.i_offset) %
STREAM_CACHE_TRACK_SIZE; STREAM_CACHE_TRACK_SIZE;
int i_current = unsigned int i_current =
__MIN( tk->i_end - tk->i_start - p_sys->stream.i_offset, __MAX(0,__MIN( tk->i_end - tk->i_start - p_sys->stream.i_offset,
STREAM_CACHE_TRACK_SIZE - i_off ); STREAM_CACHE_TRACK_SIZE - i_off ));
int i_copy = __MIN( i_current, i_read - i_data ); int i_copy = __MIN( i_current, i_read - i_data );
if( i_copy <= 0 ) break; /* EOF */ if( i_copy <= 0 ) break; /* EOF */
...@@ -1167,7 +1167,7 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read ) ...@@ -1167,7 +1167,7 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
return i_data; return i_data;
} }
static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, int i_read ) static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk]; stream_track_t *tk = &p_sys->stream.tk[p_sys->stream.i_tk];
...@@ -1507,7 +1507,7 @@ static void AStreamPrebufferStream( stream_t *s ) ...@@ -1507,7 +1507,7 @@ static void AStreamPrebufferStream( stream_t *s )
* Method 3: * Method 3:
****************************************************************************/ ****************************************************************************/
static int AStreamReadImmediate( stream_t *s, void *p_read, int i_read ) static int AStreamReadImmediate( stream_t *s, void *p_read, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
...@@ -1556,7 +1556,7 @@ static int AStreamReadImmediate( stream_t *s, void *p_read, int i_read ) ...@@ -1556,7 +1556,7 @@ static int AStreamReadImmediate( stream_t *s, void *p_read, int i_read )
return i_to_read + i_copy; return i_to_read + i_copy;
} }
static int AStreamPeekImmediate( stream_t *s, const uint8_t **pp_peek, int i_read ) static int AStreamPeekImmediate( stream_t *s, const uint8_t **pp_peek, unsigned int i_read )
{ {
#ifdef STREAM_DEBUG #ifdef STREAM_DEBUG
msg_Dbg( s, "AStreamPeekImmediate: %d size=%"PRId64, msg_Dbg( s, "AStreamPeekImmediate: %d size=%"PRId64,
...@@ -1859,7 +1859,7 @@ error: ...@@ -1859,7 +1859,7 @@ error:
/**************************************************************************** /****************************************************************************
* Access reading/seeking wrappers to handle concatenated streams. * Access reading/seeking wrappers to handle concatenated streams.
****************************************************************************/ ****************************************************************************/
static int AReadStream( stream_t *s, void *p_read, int i_read ) static int AReadStream( stream_t *s, void *p_read, unsigned int i_read )
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
access_t *p_access = p_sys->p_access; access_t *p_access = p_sys->p_access;
......
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