Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
458
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
e8b9642e
Commit
e8b9642e
authored
14 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
NSC: use FromCharset()
parent
b507be16
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/demux/nsc.c
+4
-35
4 additions, 35 deletions
modules/demux/nsc.c
with
4 additions
and
35 deletions
modules/demux/nsc.c
+
4
−
35
View file @
e8b9642e
...
...
@@ -32,6 +32,7 @@
#include
<vlc_common.h>
#include
<vlc_plugin.h>
#include
<vlc_demux.h>
#include
<vlc_charset.h>
#include
<ctype.h>
#define MAX_LINE 16024
...
...
@@ -147,13 +148,8 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
unsigned
int
length
;
unsigned
char
encoding_type
;
vlc_iconv_t
conv
;
size_t
buf16_size
;
unsigned
char
*
buf16
;
const
char
*
p_buf16
;
size_t
buf8_size
;
char
*
buf8
;
char
*
p_buf8
;
char
*
p_input
=
p_encoded
;
...
...
@@ -210,8 +206,7 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
return
NULL
;
}
buf16_size
=
length
;
buf16
=
malloc
(
buf16_size
);
buf16
=
malloc
(
length
);
if
(
buf16
==
NULL
)
return
NULL
;
...
...
@@ -225,39 +220,13 @@ static char *nscdec( vlc_object_t *p_demux, char* p_encoded )
}
}
buf8
_size
=
length
;
buf8
=
malloc
(
buf8_size
+
1
);
buf8
=
FromCharset
(
"UTF-16LE"
,
buf16
,
length
)
;
free
(
buf16
);
if
(
buf8
==
NULL
)
{
free
(
buf16
);
return
NULL
;
}
conv
=
vlc_iconv_open
(
"UTF-8"
,
"UTF-16LE"
);
if
(
conv
==
(
vlc_iconv_t
)(
-
1
)
)
{
msg_Err
(
p_demux
,
"iconv_open failed"
);
free
(
buf16
);
free
(
buf8
);
return
NULL
;
}
p_buf8
=
buf8
;
p_buf16
=
(
const
char
*
)
buf16
;
if
(
vlc_iconv
(
conv
,
&
p_buf16
,
&
buf16_size
,
&
p_buf8
,
&
buf8_size
)
==
(
size_t
)(
-
1
)
)
{
msg_Err
(
p_demux
,
"iconv failed"
);
return
NULL
;
}
else
{
buf8
[
length
-
buf8_size
]
=
'\0'
;
}
vlc_iconv_close
(
conv
);
free
(
buf16
);
return
buf8
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment