Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
da7bfe4d
Commit
da7bfe4d
authored
Jul 25, 2014
by
Antti Ajanki
Committed by
Rémi Denis-Courmont
Jul 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Locale independent, case-ignoring ASCII string comparison functions
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
50e99492
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
include/vlc_strings.h
include/vlc_strings.h
+57
-0
No files found.
include/vlc_strings.h
View file @
da7bfe4d
...
...
@@ -34,6 +34,63 @@
* @{
*/
static
inline
int
vlc_ascii_toupper
(
int
c
)
{
if
(
c
>=
'a'
&&
c
<=
'z'
)
return
c
+
(
'A'
-
'a'
);
else
return
c
;
}
static
inline
int
vlc_ascii_tolower
(
int
c
)
{
if
(
c
>=
'A'
&&
c
<=
'Z'
)
return
c
+
(
'a'
-
'A'
);
else
return
c
;
}
/**
* Compare two ASCII strings ignoring case.
*
* The result is independent of the locale. If there are non-ASCII
* characters in the strings, their cases are NOT ignored in the
* comparison.
*/
static
inline
int
vlc_ascii_strcasecmp
(
const
char
*
psz1
,
const
char
*
psz2
)
{
const
char
*
s1
=
psz1
;
const
char
*
s2
=
psz2
;
int
d
=
vlc_ascii_tolower
(
*
s1
)
-
vlc_ascii_tolower
(
*
s2
);
while
(
*
s1
&&
d
==
0
)
{
s1
++
;
s2
++
;
d
=
vlc_ascii_tolower
(
*
s1
)
-
vlc_ascii_tolower
(
*
s2
);
}
return
d
;
}
static
inline
int
vlc_ascii_strncasecmp
(
const
char
*
psz1
,
const
char
*
psz2
,
size_t
n
)
{
const
char
*
s1
=
psz1
;
const
char
*
s2
=
psz2
;
const
char
*
s1end
=
psz1
+
n
;
int
d
=
vlc_ascii_tolower
(
*
s1
)
-
vlc_ascii_tolower
(
*
s2
);
while
(
*
s1
&&
s1
<
s1end
&&
d
==
0
)
{
s1
++
;
s2
++
;
d
=
vlc_ascii_tolower
(
*
s1
)
-
vlc_ascii_tolower
(
*
s2
);
}
if
(
s1
==
s1end
)
return
0
;
else
return
d
;
}
VLC_API
void
resolve_xml_special_chars
(
char
*
psz_value
);
VLC_API
char
*
convert_xml_special_chars
(
const
char
*
psz_content
);
...
...
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