mirror of https://github.com/mpv-player/mpv
Url given without a filename/path get the filename/path '/'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@870 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e983def749
commit
89ef6acd52
14
url.c
14
url.c
|
@ -78,14 +78,24 @@ set_url(char* url) {
|
||||||
// check if it's not a trailing '/'
|
// check if it's not a trailing '/'
|
||||||
if( strlen(ptr2)>1 ) {
|
if( strlen(ptr2)>1 ) {
|
||||||
// copy the path/filename in the URL container
|
// copy the path/filename in the URL container
|
||||||
Curl->file = (char*)malloc(strlen(ptr2));
|
Curl->file = (char*)malloc(strlen(ptr2)+1);
|
||||||
if( Curl->file==NULL ) {
|
if( Curl->file==NULL ) {
|
||||||
printf("Memory allocation failed!\n");
|
printf("Memory allocation failed!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
strcpy(Curl->file, ptr2+1);
|
Curl->file[0]='/';
|
||||||
|
strcpy(Curl->file+1, ptr2+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check if a filenme was given or set else set it with '/'
|
||||||
|
if( Curl->file==NULL ) {
|
||||||
|
Curl->file = (char*)malloc(2);
|
||||||
|
if( Curl->file==NULL ) {
|
||||||
|
printf("Memory allocation failed!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcpy(Curl->file, "/");
|
||||||
|
}
|
||||||
|
|
||||||
return Curl;
|
return Curl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue