comparison stream/stream.c @ 37043:43a8e37a3dcf

stream: Move variables into lowest possible scope.
author reimar
date Sun, 06 Apr 2014 18:53:46 +0000
parents 7fd255e0db1b
children
comparison
equal deleted inserted replaced
37042:ef0fa4caac9c 37043:43a8e37a3dcf
217 return s; 217 return s;
218 } 218 }
219 219
220 220
221 stream_t* open_stream_full(const char* filename,int mode, char** options, int* file_format) { 221 stream_t* open_stream_full(const char* filename,int mode, char** options, int* file_format) {
222 int i,j,l,r; 222 int i,j;
223 const stream_info_t* sinfo;
224 stream_t* s;
225 char *redirected_url = NULL;
226 223
227 for(i = 0 ; auto_open_streams[i] ; i++) { 224 for(i = 0 ; auto_open_streams[i] ; i++) {
228 sinfo = auto_open_streams[i]; 225 const stream_info_t *sinfo = auto_open_streams[i];
229 for(j = 0 ; sinfo->protocols[j] ; j++) { 226 for(j = 0 ; sinfo->protocols[j] ; j++) {
230 l = strlen(sinfo->protocols[j]); 227 int l = strlen(sinfo->protocols[j]);
231 // l == 0 => Don't do protocol matching (ie network and filenames) 228 // l == 0 => Don't do protocol matching (ie network and filenames)
232 if((l == 0 && !strstr(filename, "://")) || 229 if((l == 0 && !strstr(filename, "://")) ||
233 ((strncasecmp(sinfo->protocols[j],filename,l) == 0) && 230 ((strncasecmp(sinfo->protocols[j],filename,l) == 0) &&
234 (strncmp("://",filename+l,3) == 0))) { 231 (strncmp("://",filename+l,3) == 0))) {
232 int r;
233 char *redirected_url = NULL;
234 stream_t* s;
235 *file_format = DEMUXER_TYPE_UNKNOWN; 235 *file_format = DEMUXER_TYPE_UNKNOWN;
236 s = open_stream_plugin(sinfo,filename,mode,options,file_format,&r, 236 s = open_stream_plugin(sinfo,filename,mode,options,file_format,&r,
237 &redirected_url); 237 &redirected_url);
238 if(s) return s; 238 if(s) return s;
239 if(r == STREAM_REDIRECTED && redirected_url) { 239 if(r == STREAM_REDIRECTED && redirected_url) {