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
027cc99e
Commit
027cc99e
authored
Oct 08, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vlc_strcasestr()
parent
9ce1a13f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
include/vlc_charset.h
include/vlc_charset.h
+1
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/text/unicode.c
src/text/unicode.c
+44
-0
No files found.
include/vlc_charset.h
View file @
027cc99e
...
@@ -40,6 +40,7 @@ VLC_EXPORT( char *, ToLocaleDup, ( const char * ) LIBVLC_USED );
...
@@ -40,6 +40,7 @@ VLC_EXPORT( char *, ToLocaleDup, ( const char * ) LIBVLC_USED );
VLC_EXPORT
(
int
,
utf8_vfprintf
,
(
FILE
*
stream
,
const
char
*
fmt
,
va_list
ap
)
);
VLC_EXPORT
(
int
,
utf8_vfprintf
,
(
FILE
*
stream
,
const
char
*
fmt
,
va_list
ap
)
);
VLC_EXPORT
(
int
,
utf8_fprintf
,
(
FILE
*
,
const
char
*
,
...
)
LIBVLC_FORMAT
(
2
,
3
)
);
VLC_EXPORT
(
int
,
utf8_fprintf
,
(
FILE
*
,
const
char
*
,
...
)
LIBVLC_FORMAT
(
2
,
3
)
);
VLC_EXPORT
(
char
*
,
vlc_strcasestr
,
(
const
char
*
,
const
char
*
)
LIBVLC_USED
);
VLC_EXPORT
(
char
*
,
EnsureUTF8
,
(
char
*
)
);
VLC_EXPORT
(
char
*
,
EnsureUTF8
,
(
char
*
)
);
VLC_EXPORT
(
const
char
*
,
IsUTF8
,
(
const
char
*
)
LIBVLC_USED
);
VLC_EXPORT
(
const
char
*
,
IsUTF8
,
(
const
char
*
)
LIBVLC_USED
);
...
...
src/libvlccore.sym
View file @
027cc99e
...
@@ -462,6 +462,7 @@ vlc_opendir
...
@@ -462,6 +462,7 @@ vlc_opendir
vlc_readdir
vlc_readdir
vlc_scandir
vlc_scandir
vlc_stat
vlc_stat
vlc_strcasestr
vlc_unlink
vlc_unlink
vlc_rename
vlc_rename
vlc_dup
vlc_dup
...
...
src/text/unicode.c
View file @
027cc99e
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
# include <tchar.h>
# include <tchar.h>
#endif
#endif
#include <errno.h>
#include <errno.h>
#include <wctype.h>
#if defined (ASSUME_UTF8)
#if defined (ASSUME_UTF8)
/* Cool */
/* Cool */
...
@@ -340,6 +341,49 @@ static size_t vlc_towc (const char *str, uint32_t *restrict pwc)
...
@@ -340,6 +341,49 @@ static size_t vlc_towc (const char *str, uint32_t *restrict pwc)
return
charlen
;
return
charlen
;
}
}
/**
* Look for an UTF-8 string within another one in a case-insensitive fashion.
* Beware that this is quite slow. Contrary to strcasestr(), this function
* works regardless of the system character encoding, and handles multibyte
* code points correctly.
* @param haystack string to look into
* @param needle string to look for
* @return a pointer to the first occurence of the needle within the haystack,
* or NULL if no occurence were found.
*/
char
*
vlc_strcasestr
(
const
char
*
haystack
,
const
char
*
needle
)
{
ssize_t
s
;
do
{
const
char
*
h
=
haystack
,
*
n
=
needle
;
for
(;;)
{
uint32_t
cph
,
cpn
;
s
=
vlc_towc
(
n
,
&
cpn
);
if
(
s
==
0
)
return
(
char
*
)
haystack
;
if
(
unlikely
(
s
<
0
))
return
NULL
;
n
+=
s
;
s
=
vlc_towc
(
h
,
&
cph
);
if
(
s
<=
0
||
towlower
(
cph
)
!=
towlower
(
cpn
))
break
;
h
+=
s
;
}
s
=
vlc_towc
(
haystack
,
&
(
uint32_t
)
{
0
});
haystack
+=
s
;
}
while
(
s
!=
0
);
return
NULL
;
}
/**
/**
* Replaces invalid/overlong UTF-8 sequences with question marks.
* Replaces invalid/overlong UTF-8 sequences with question marks.
...
...
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