Commit 40785cad authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Make stream_Peek take a const pointer as it should

(This introduces a lot of warnings)
parent 8b91a2d0
...@@ -65,7 +65,7 @@ enum stream_query_e ...@@ -65,7 +65,7 @@ enum stream_query_e
}; };
VLC_EXPORT( int, stream_Read, ( stream_t *s, void *p_read, int i_read ) ); VLC_EXPORT( int, stream_Read, ( stream_t *s, void *p_read, int i_read ) );
VLC_EXPORT( int, stream_Peek, ( stream_t *s, uint8_t **pp_peek, int i_peek ) ); VLC_EXPORT( int, stream_Peek, ( stream_t *s, const uint8_t **pp_peek, int i_peek ) );
VLC_EXPORT( int, stream_vaControl, ( stream_t *s, int i_query, va_list args ) ); VLC_EXPORT( int, stream_vaControl, ( stream_t *s, int i_query, va_list args ) );
VLC_EXPORT( void, stream_Delete, ( stream_t *s ) ); VLC_EXPORT( void, stream_Delete, ( stream_t *s ) );
VLC_EXPORT( int, stream_Control, ( stream_t *s, int i_query, ... ) ); VLC_EXPORT( int, stream_Control, ( stream_t *s, int i_query, ... ) );
......
...@@ -297,7 +297,7 @@ typedef struct ...@@ -297,7 +297,7 @@ 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, int i_read );
static int DStreamPeek ( stream_t *, uint8_t **pp_peek, int i_peek ); static int DStreamPeek ( stream_t *, const uint8_t **pp_peek, int i_peek );
static int DStreamControl( stream_t *, int i_query, va_list ); static int DStreamControl( stream_t *, int i_query, va_list );
static int DStreamThread ( stream_t * ); static int DStreamThread ( stream_t * );
...@@ -419,7 +419,7 @@ static int DStreamRead( stream_t *s, void *p_read, int i_read ) ...@@ -419,7 +419,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, uint8_t **pp_peek, int i_peek ) static int DStreamPeek( stream_t *s, const uint8_t **pp_peek, 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;
...@@ -545,7 +545,7 @@ static int DStreamThread( stream_t *s ) ...@@ -545,7 +545,7 @@ static int DStreamThread( stream_t *s )
****************************************************************************/ ****************************************************************************/
static void SkipID3Tag( demux_t *p_demux ) static void SkipID3Tag( demux_t *p_demux )
{ {
uint8_t *p_peek; const uint8_t *p_peek;
uint8_t version, revision; uint8_t version, revision;
int i_size; int i_size;
int b_footer; int b_footer;
......
...@@ -365,7 +365,7 @@ struct stream_t ...@@ -365,7 +365,7 @@ struct stream_t
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, int i_read );
int (*pf_peek) ( stream_t *, uint8_t **pp_peek, int i_peek ); int (*pf_peek) ( stream_t *, const uint8_t **pp_peek, 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 *);
......
...@@ -36,7 +36,7 @@ struct stream_sys_t ...@@ -36,7 +36,7 @@ struct stream_sys_t
}; };
static int Read ( stream_t *, void *p_read, int i_read ); static int Read ( stream_t *, void *p_read, int i_read );
static int Peek ( stream_t *, uint8_t **pp_peek, int i_read ); static int Peek ( stream_t *, const uint8_t **pp_peek, 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 * );
...@@ -149,7 +149,7 @@ static int Read( stream_t *s, void *p_read, int i_read ) ...@@ -149,7 +149,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, uint8_t **pp_peek, int i_read ) static int Peek( stream_t *s, const uint8_t **pp_peek, 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 );
......
...@@ -167,14 +167,14 @@ struct stream_sys_t ...@@ -167,14 +167,14 @@ 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, int i_read );
static int AStreamPeekBlock( stream_t *s, uint8_t **p_peek, int i_read ); static int AStreamPeekBlock( stream_t *s, const uint8_t **p_peek, 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, vlc_bool_t *pb_eof ); static block_t *AReadBlock( stream_t *s, vlc_bool_t *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, int i_read );
static int AStreamPeekStream( stream_t *s, uint8_t **pp_peek, int i_read ); static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, 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, int i_read );
...@@ -705,7 +705,7 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read ) ...@@ -705,7 +705,7 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read )
return i_data; return i_data;
} }
static int AStreamPeekBlock( stream_t *s, uint8_t **pp_peek, int i_read ) static int AStreamPeekBlock( stream_t *s, const uint8_t **pp_peek, 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;
...@@ -1046,7 +1046,7 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read ) ...@@ -1046,7 +1046,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, uint8_t **pp_peek, int i_read ) static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, 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];
...@@ -1401,7 +1401,7 @@ char * stream_ReadLine( stream_t *s ) ...@@ -1401,7 +1401,7 @@ char * stream_ReadLine( stream_t *s )
while( i_read < STREAM_LINE_MAX ) while( i_read < STREAM_LINE_MAX )
{ {
char *psz_eol; char *psz_eol;
uint8_t *p_data; const uint8_t *p_data;
int i_data; int i_data;
int64_t i_pos; int64_t i_pos;
...@@ -1504,8 +1504,8 @@ char * stream_ReadLine( stream_t *s ) ...@@ -1504,8 +1504,8 @@ char * stream_ReadLine( stream_t *s )
} }
else else
{ {
uint8_t *p = p_data; const uint8_t *p = p_data;
uint8_t *p_last = p + i_data - s->i_char_width; const uint8_t *p_last = p + i_data - s->i_char_width;
if( s->i_char_width == 2 ) if( s->i_char_width == 2 )
{ {
...@@ -1837,7 +1837,7 @@ int stream_Read( stream_t *s, void *p_read, int i_read ) ...@@ -1837,7 +1837,7 @@ int stream_Read( stream_t *s, void *p_read, int i_read )
* the end of the stream (but only when you have i_peek >= * the end of the stream (but only when you have i_peek >=
* p_input->i_bufsize) * p_input->i_bufsize)
*/ */
int stream_Peek( stream_t *s, uint8_t **pp_peek, int i_peek ) int stream_Peek( stream_t *s, const uint8_t **pp_peek, int i_peek )
{ {
return s->pf_peek( s, pp_peek, i_peek ); return s->pf_peek( s, pp_peek, i_peek );
} }
......
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