Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
924ed95f
Commit
924ed95f
authored
Mar 09, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FileToUrl: constify
parent
96ea7e8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
30 deletions
+16
-30
modules/control/http/util.c
modules/control/http/util.c
+16
-30
No files found.
modules/control/http/util.c
View file @
924ed95f
...
...
@@ -40,49 +40,35 @@
****************************************************************************/
/* ToUrl: create a good name for an url from filename */
static
char
*
FileToUrl
(
char
*
name
,
bool
*
pb_index
)
static
char
*
FileToUrl
(
c
onst
c
har
*
name
,
bool
*
pb_index
)
{
char
*
url
,
*
p
;
url
=
p
=
malloc
(
strlen
(
name
)
+
1
);
*
pb_index
=
false
;
if
(
!
url
||
!
p
)
{
char
*
url
=
malloc
(
strlen
(
name
)
+
2
);
if
(
unlikely
(
url
==
NULL
)
)
return
NULL
;
}
#if
def WIN32
while
(
*
name
==
'\\'
||
*
name
==
'/'
)
#if
(DIR_SEP_CHAR == '/')
name
+=
strspn
(
name
,
"/"
);
#else
while
(
*
name
==
'/'
)
name
+=
strspn
(
name
,
"/"
DIR_SEP
);
#endif
{
name
++
;
}
*
url
=
'/'
;
strcpy
(
url
+
1
,
name
);
*
p
++
=
'/'
;
strcpy
(
p
,
name
);
#ifdef WIN32
#if (DIR_SEP_CHAR != '/')
/* convert '\\' into '/' */
name
=
p
;
while
(
*
name
)
{
if
(
*
name
==
'\\'
)
for
(
char
*
ptr
=
url
;
*
ptr
;
ptr
++
)
if
(
*
ptr
==
DIR_SEP_CHAR
)
*
name
=
'/'
;
name
++
;
}
#endif
/* index.* -> / */
if
(
(
p
=
strrchr
(
url
,
'/'
)
)
!=
NULL
)
char
*
p
=
strrchr
(
url
,
'/'
);
if
(
p
!=
NULL
&&
!
strncmp
(
p
,
"/index."
,
7
)
)
{
if
(
!
strncmp
(
p
,
"/index."
,
7
)
)
{
p
[
1
]
=
'\0'
;
*
pb_index
=
true
;
}
p
[
1
]
=
'\0'
;
*
pb_index
=
true
;
}
return
url
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment