Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
798b0d97
Commit
798b0d97
authored
Mar 27, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utf8_scandir: Unicode wrapper for scandir()
parent
d51c8aac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
include/charset.h
include/charset.h
+1
-0
include/vlc_symbols.h
include/vlc_symbols.h
+3
-0
src/misc/unicode.c
src/misc/unicode.c
+61
-0
No files found.
include/charset.h
View file @
798b0d97
...
...
@@ -37,6 +37,7 @@ VLC_EXPORT( char *, ToLocale, ( const char * ) );
VLC_EXPORT
(
FILE
*
,
utf8_fopen
,
(
const
char
*
filename
,
const
char
*
mode
)
);
VLC_EXPORT
(
void
*
,
utf8_opendir
,
(
const
char
*
dirname
)
);
VLC_EXPORT
(
const
char
*
,
utf8_readdir
,
(
void
*
dir
)
);
VLC_EXPORT
(
int
,
utf8_scandir
,
(
const
char
*
dirname
,
char
***
namelist
,
int
(
*
select
)(
const
char
*
),
int
(
*
compar
)(
const
char
**
,
const
char
**
)
)
);
VLC_EXPORT
(
int
,
utf8_stat
,
(
const
char
*
filename
,
void
*
buf
)
);
VLC_EXPORT
(
int
,
utf8_lstat
,
(
const
char
*
filename
,
void
*
buf
)
);
VLC_EXPORT
(
int
,
utf8_mkdir
,
(
const
char
*
filename
)
);
...
...
include/vlc_symbols.h
View file @
798b0d97
...
...
@@ -487,6 +487,7 @@ struct module_symbols_t
char
*
(
*
FromUTF16_inner
)
(
const
uint16_t
*
);
const
char
*
(
*
IsUTF8_inner
)
(
const
char
*
);
const
char
*
(
*
GetFallbackEncoding_inner
)
(
void
);
int
(
*
utf8_scandir_inner
)
(
const
char
*
dirname
,
char
***
namelist
,
int
(
*
select
)(
const
char
*
),
int
(
*
compar
)(
const
char
**
,
const
char
**
));
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
...
@@ -954,6 +955,7 @@ struct module_symbols_t
# define FromUTF16 (p_symbols)->FromUTF16_inner
# define IsUTF8 (p_symbols)->IsUTF8_inner
# define GetFallbackEncoding (p_symbols)->GetFallbackEncoding_inner
# define utf8_scandir (p_symbols)->utf8_scandir_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
...
@@ -1424,6 +1426,7 @@ struct module_symbols_t
((p_symbols)->FromUTF16_inner) = FromUTF16; \
((p_symbols)->IsUTF8_inner) = IsUTF8; \
((p_symbols)->GetFallbackEncoding_inner) = GetFallbackEncoding; \
((p_symbols)->utf8_scandir_inner) = utf8_scandir; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
...
...
src/misc/unicode.c
View file @
798b0d97
...
...
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
...
...
@@ -420,6 +421,66 @@ const char *utf8_readdir( void *dir )
return
FromLocale
(
ent
->
d_name
);
}
static
int
dummy_select
(
const
char
*
str
)
{
(
void
)
str
;
return
1
;
}
int
utf8_scandir
(
const
char
*
dirname
,
char
***
namelist
,
int
(
*
select
)(
const
char
*
),
int
(
*
compar
)(
const
char
**
,
const
char
**
)
)
{
DIR
*
dir
=
utf8_opendir
(
dirname
);
if
(
select
==
NULL
)
select
=
dummy_select
;
if
(
dir
==
NULL
)
return
-
1
;
else
{
char
**
tab
=
NULL
;
const
char
*
entry
;
unsigned
num
=
0
;
while
(
(
entry
=
utf8_readdir
(
dir
)
)
!=
NULL
)
{
char
**
newtab
;
char
*
utf_entry
=
strdup
(
entry
);
LocaleFree
(
entry
);
if
(
utf_entry
==
NULL
)
goto
error
;
if
(
!
select
(
utf_entry
)
)
continue
;
newtab
=
realloc
(
tab
,
sizeof
(
char
*
)
*
(
num
+
1
)
);
if
(
newtab
==
NULL
)
goto
error
;
tab
=
newtab
;
tab
[
num
++
]
=
utf_entry
;
}
closedir
(
dir
);
if
(
compar
!=
NULL
)
qsort
(
tab
,
num
,
sizeof
(
tab
[
0
]
),
(
int
(
*
)(
const
void
*
,
const
void
*
))
compar
);
*
namelist
=
tab
;
return
num
;
error:
{
unsigned
i
;
for
(
i
=
0
;
i
<
num
;
i
++
)
free
(
tab
[
i
]
);
if
(
tab
!=
NULL
)
free
(
tab
);
return
-
1
;}
}
}
static
int
utf8_statEx
(
const
char
*
filename
,
void
*
buf
,
vlc_bool_t
deref
)
...
...
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