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
5158c3af
Commit
5158c3af
authored
Jan 16, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation of utf8_unlink. If someone can test this function on Windows please ?
parent
d70106fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
src/text/unicode.c
src/text/unicode.c
+44
-0
No files found.
src/text/unicode.c
View file @
5158c3af
...
...
@@ -562,6 +562,50 @@ int utf8_lstat( const char *filename, struct stat *buf)
return
utf8_statEx
(
filename
,
buf
,
VLC_FALSE
);
}
/**
* utf8_unlink: Calls unlink() after conversion of file name to OS locale
*
* @param filename a UTF-8 string with the name of the file you want to delete.
* @return A 0 return value indicates success. A -1 return value indicates an
* error, and an error code is stored in errno
*/
int
utf8_unlink
(
const
char
*
filename
)
{
#if defined (WIN32) || defined (UNDER_CE)
if
(
GetVersion
()
<
0x80000000
)
{
/* for Windows NT and above */
wchar_t
wpath
[
MAX_PATH
+
1
];
if
(
!
MultiByteToWideChar
(
CP_UTF8
,
0
,
filename
,
-
1
,
wpath
,
MAX_PATH
)
)
{
errno
=
ENOENT
;
return
-
1
;
}
wpath
[
MAX_PATH
]
=
L'\0'
;
/*
* unlink() cannot open files with non-“ANSI” characters on Windows.
* We use _wunlink() instead.
*/
return
_wunlink
(
wpath
);
}
#endif
const
char
*
local_name
=
ToLocale
(
filename
);
if
(
local_name
==
NULL
)
{
errno
=
ENOENT
;
return
-
1
;
}
int
ret
=
unlink
(
local_name
);
LocaleFree
(
local_name
);
return
ret
;
}
/**
* utf8_*printf: *printf with conversion from UTF-8 to local encoding
*/
...
...
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