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
8d7e6079
Commit
8d7e6079
authored
Nov 11, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline FromUTF16 and use Win32 API
(suppress one more ugly piece of code)
parent
19a76342
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
102 deletions
+9
-102
include/charset.h
include/charset.h
+4
-3
include/vlc_symbols.h
include/vlc_symbols.h
+5
-3
src/misc/unicode.c
src/misc/unicode.c
+0
-96
No files found.
include/charset.h
View file @
8d7e6079
...
...
@@ -2,9 +2,11 @@
* charset.h: Determine a canonical name for the current locale's character encoding.
*****************************************************************************
* Copyright (C) 2003-2005 the VideoLAN team
* Copyright © 2005-2006 Rémi Denis-Courmont
* $Id$
*
* Author: Derk-Jan Hartman <thedj at users.sourceforge.net>
* Authors: Rémi Denis-Courmont <rem # videolan,org>
* Derk-Jan Hartman <thedj at users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -53,8 +55,7 @@ VLC_EXPORT( char *, EnsureUTF8, ( char * ) );
VLC_EXPORT
(
const
char
*
,
IsUTF8
,
(
const
char
*
)
);
#ifdef WIN32
VLC_EXPORT
(
char
*
,
FromUTF16
,
(
const
uint16_t
*
)
);
#define FromWide FromUTF16
VLC_EXPORT
(
char
*
,
FromWide
,
(
const
wchar_t
*
)
);
#endif
...
...
include/vlc_symbols.h
View file @
8d7e6079
...
...
@@ -483,7 +483,7 @@ struct module_symbols_t
char
*
(
*
convert_xml_special_chars_inner
)
(
const
char
*
psz_content
);
char
*
(
*
unescape_URI_duplicate_inner
)
(
const
char
*
psz
);
void
(
*
resolve_xml_special_chars_inner
)
(
char
*
psz_value
);
char
*
(
*
FromUTF16_inner
)
(
const
uint16_t
*
)
;
void
*
FromUTF16_deprecated
;
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
**
));
...
...
@@ -557,6 +557,7 @@ struct module_symbols_t
int
(
*
net_ListenSingle_inner
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
family
,
int
socktype
,
int
protocol
);
char
*
(
*
str_format_time_inner
)
(
char
*
);
char
*
(
*
__str_format_meta_inner
)
(
vlc_object_t
*
,
char
*
);
char
*
(
*
FromWide_inner
)
(
const
wchar_t
*
);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
...
@@ -979,7 +980,6 @@ struct module_symbols_t
# define convert_xml_special_chars (p_symbols)->convert_xml_special_chars_inner
# define unescape_URI_duplicate (p_symbols)->unescape_URI_duplicate_inner
# define resolve_xml_special_chars (p_symbols)->resolve_xml_special_chars_inner
# 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
...
...
@@ -1035,6 +1035,7 @@ struct module_symbols_t
# define net_ListenSingle (p_symbols)->net_ListenSingle_inner
# define str_format_time (p_symbols)->str_format_time_inner
# define __str_format_meta (p_symbols)->__str_format_meta_inner
# define FromWide (p_symbols)->FromWide_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
...
@@ -1460,7 +1461,6 @@ struct module_symbols_t
((p_symbols)->convert_xml_special_chars_inner) = convert_xml_special_chars; \
((p_symbols)->unescape_URI_duplicate_inner) = unescape_URI_duplicate; \
((p_symbols)->resolve_xml_special_chars_inner) = resolve_xml_special_chars; \
((p_symbols)->FromUTF16_inner) = FromUTF16; \
((p_symbols)->IsUTF8_inner) = IsUTF8; \
((p_symbols)->GetFallbackEncoding_inner) = GetFallbackEncoding; \
((p_symbols)->utf8_scandir_inner) = utf8_scandir; \
...
...
@@ -1516,6 +1516,7 @@ struct module_symbols_t
((p_symbols)->net_ListenSingle_inner) = net_ListenSingle; \
((p_symbols)->str_format_time_inner) = str_format_time; \
((p_symbols)->__str_format_meta_inner) = __str_format_meta; \
((p_symbols)->FromWide_inner) = FromWide; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__sout_CfgParse_deprecated = NULL; \
(p_symbols)->sout_CfgCreate_deprecated = NULL; \
...
...
@@ -1560,6 +1561,7 @@ struct module_symbols_t
(p_symbols)->vlc_HashInsert_deprecated = NULL; \
(p_symbols)->vlc_HashLookup_deprecated = NULL; \
(p_symbols)->vlc_HashRetrieve_deprecated = NULL; \
(p_symbols)->FromUTF16_deprecated = NULL; \
(p_symbols)->playlist_ItemNewFromInput_deprecated = NULL; \
(p_symbols)->playlist_PlaylistAdd_deprecated = NULL; \
(p_symbols)->playlist_PlaylistAddExt_deprecated = NULL; \
...
...
src/misc/unicode.c
View file @
8d7e6079
...
...
@@ -7,9 +7,6 @@
*
* Authors: Rémi Denis-Courmont <rem # videolan.org>
*
* UTF16toUTF8() adapted from Perl 5 (also GPL'd)
* Copyright (C) 1998-2002, Larry Wall
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
...
...
@@ -778,96 +775,3 @@ const char *IsUTF8( const char *str )
{
return
CheckUTF8
(
(
char
*
)
str
,
0
);
}
/**
* UTF16toUTF8: converts UTF-16 (host byte order) to UTF-8
*
* @param src UTF-16 bytes sequence, aligned on a 16-bits boundary
* @param len number of uint16_t to convert
*/
static
inline
char
*
UTF16toUTF8
(
const
uint16_t
*
in
,
size_t
len
,
size_t
*
newlen
)
{
char
*
res
,
*
out
;
/* allocate memory */
out
=
res
=
(
char
*
)
malloc
(
3
*
len
);
if
(
res
==
NULL
)
return
NULL
;
while
(
len
>
0
)
{
uint32_t
uv
=
*
in
;
in
++
;
len
--
;
if
(
uv
<
0x80
)
{
*
out
++
=
uv
;
continue
;
}
if
(
uv
<
0x800
)
{
*
out
++
=
((
uv
>>
6
)
|
0xc0
);
*
out
++
=
((
uv
&
0x3f
)
|
0x80
);
continue
;
}
if
(
(
uv
>=
0xd800
)
&&
(
uv
<
0xdbff
)
)
{
/* surrogates */
uint16_t
low
=
GetWBE
(
in
);
in
++
;
len
--
;
if
(
(
low
<
0xdc00
)
||
(
low
>=
0xdfff
)
)
{
*
out
++
=
'?'
;
/* Malformed surrogate */
continue
;
}
else
uv
=
((
uv
-
0xd800
)
<<
10
)
+
(
low
-
0xdc00
)
+
0x10000
;
}
if
(
uv
<
0x10000
)
{
*
out
++
=
((
uv
>>
12
)
|
0xe0
);
*
out
++
=
(((
uv
>>
6
)
&
0x3f
)
|
0x80
);
*
out
++
=
((
uv
&
0x3f
)
|
0x80
);
continue
;
}
else
{
*
out
++
=
((
uv
>>
18
)
|
0xf0
);
*
out
++
=
(((
uv
>>
12
)
&
0x3f
)
|
0x80
);
*
out
++
=
(((
uv
>>
6
)
&
0x3f
)
|
0x80
);
*
out
++
=
((
uv
&
0x3f
)
|
0x80
);
continue
;
}
}
len
=
out
-
res
;
res
=
realloc
(
res
,
len
);
if
(
newlen
!=
NULL
)
*
newlen
=
len
;
return
res
;
}
/**
* FromUTF16(): converts an UTF-16 string to UTF-8.
*
* @param src UTF-16 bytes sequence, aligned on a 16-bits boundary.
*
* @return the result of the conversion (must be free()'d),
* or NULL in case of error.
*/
char
*
FromUTF16
(
const
uint16_t
*
src
)
{
const
uint16_t
*
in
;
size_t
len
;
/* determine the size of the string */
for
(
len
=
1
,
in
=
src
;
*
in
;
len
++
)
in
++
;
return
UTF16toUTF8
(
src
,
len
,
NULL
);
}
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