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
Show 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,50 +40,36 @@
...
@@ -40,50 +40,36 @@
****************************************************************************/
****************************************************************************/
/* ToUrl: create a good name for an url from filename */
/* 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
;
*
pb_index
=
false
;
if
(
!
url
||
!
p
)
{
char
*
url
=
malloc
(
strlen
(
name
)
+
2
);
if
(
unlikely
(
url
==
NULL
)
)
return
NULL
;
return
NULL
;
}
#if
def WIN32
#if
(DIR_SEP_CHAR == '/')
while
(
*
name
==
'\\'
||
*
name
==
'/'
)
name
+=
strspn
(
name
,
"/"
);
#else
#else
while
(
*
name
==
'/'
)
name
+=
strspn
(
name
,
"/"
DIR_SEP
);
#endif
#endif
{
*
url
=
'/'
;
name
++
;
strcpy
(
url
+
1
,
name
);
}
*
p
++
=
'/'
;
#if (DIR_SEP_CHAR != '/')
strcpy
(
p
,
name
);
#ifdef WIN32
/* convert '\\' into '/' */
/* convert '\\' into '/' */
name
=
p
;
for
(
char
*
ptr
=
url
;
*
ptr
;
ptr
++
)
while
(
*
name
)
if
(
*
ptr
==
DIR_SEP_CHAR
)
{
if
(
*
name
==
'\\'
)
*
name
=
'/'
;
*
name
=
'/'
;
name
++
;
}
#endif
#endif
/* index.* -> / */
/* 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'
;
p
[
1
]
=
'\0'
;
*
pb_index
=
true
;
*
pb_index
=
true
;
}
}
}
return
url
;
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