comparison utils.c @ 2868:22467d1cf49c libavformat

Try to fix url_split() so that the ?foobar part is in the path and only the path.
author michael
date Sat, 29 Dec 2007 16:13:03 +0000
parents e6e210e4581d
children 02e909632f18
comparison
equal deleted inserted replaced
2867:57818580a457 2868:22467d1cf49c
2939 char *hostname, int hostname_size, 2939 char *hostname, int hostname_size,
2940 int *port_ptr, 2940 int *port_ptr,
2941 char *path, int path_size, 2941 char *path, int path_size,
2942 const char *url) 2942 const char *url)
2943 { 2943 {
2944 const char *p, *ls, *at, *col, *brk, *q; 2944 const char *p, *ls, *at, *col, *brk;
2945 2945
2946 if (port_ptr) *port_ptr = -1; 2946 if (port_ptr) *port_ptr = -1;
2947 if (proto_size > 0) proto[0] = 0; 2947 if (proto_size > 0) proto[0] = 0;
2948 if (authorization_size > 0) authorization[0] = 0; 2948 if (authorization_size > 0) authorization[0] = 0;
2949 if (hostname_size > 0) hostname[0] = 0; 2949 if (hostname_size > 0) hostname[0] = 0;
2960 av_strlcpy(path, url, path_size); 2960 av_strlcpy(path, url, path_size);
2961 return; 2961 return;
2962 } 2962 }
2963 2963
2964 /* separate path from hostname */ 2964 /* separate path from hostname */
2965 if ((ls = strchr(p, '/'))) { 2965 ls = strchr(p, '/');
2966 if ((q = strchr(ls, '?'))) 2966 if(!ls)
2967 av_strlcpy(path, ls, FFMIN(path_size, q - ls + 1)); 2967 ls = strchr(p, '?');
2968 else 2968 if(ls)
2969 av_strlcpy(path, ls, path_size); 2969 av_strlcpy(path, ls, path_size);
2970 } else if (!(ls = strchr(p, '?'))) 2970 else
2971 ls = &p[strlen(p)]; // XXX 2971 ls = &p[strlen(p)]; // XXX
2972 2972
2973 /* the rest is hostname, use that to parse auth/port */ 2973 /* the rest is hostname, use that to parse auth/port */
2974 if (ls != p) { 2974 if (ls != p) {
2975 /* authorization (user[:pass]@hostname) */ 2975 /* authorization (user[:pass]@hostname) */