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
f258f621
Commit
f258f621
authored
Apr 16, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force conversion from
UTF-8
when announce is incorrectly encoded
parent
29e4c7d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+28
-15
No files found.
modules/services_discovery/sap.c
View file @
f258f621
...
...
@@ -287,7 +287,8 @@ static int Open( vlc_object_t *p_this )
free
(
psz_charset
);
if
(
p_sys
->
iconvHandle
==
(
vlc_iconv_t
)(
-
1
)
)
{
msg_Warn
(
p_sd
,
"Unable to do requested conversion"
);
msg_Err
(
p_sd
,
"unable to perform characters conversion"
);
return
VLC_EGENERIC
;
}
p_sd
->
pf_run
=
Run
;
...
...
@@ -495,8 +496,7 @@ static void Close( vlc_object_t *p_this )
vlc_object_release
(
p_playlist
);
}
if
(
p_sys
->
iconvHandle
!=
(
vlc_iconv_t
)(
-
1
)
)
vlc_iconv_close
(
p_sys
->
iconvHandle
);
vlc_iconv_close
(
p_sys
->
iconvHandle
);
free
(
p_sys
);
}
...
...
@@ -810,10 +810,8 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
psz_value
=
convert_from_utf8
(
p_sd
,
p_sdp
->
psz_sessionname
);
if
(
p_sap
==
NULL
||
psz_value
==
NULL
)
{
msg_Err
(
p_sd
,
"out of memory"
);
FREE
(
p_sap
);
FREE
(
psz_value
);
p_sd
->
b_die
=
VLC_TRUE
;
return
NULL
;
}
p_sap
->
i_last
=
mdate
();
...
...
@@ -1288,26 +1286,41 @@ static char *convert_from_utf8( struct services_discovery_t *p_sd,
if
(
psz_unicode
==
NULL
)
return
NULL
;
if
(
p_sd
->
p_sys
->
iconvHandle
==
(
vlc_iconv_t
)(
-
1
)
)
return
strdup
(
psz_unicode
);
psz_in
=
psz_unicode
;
i_in
=
strlen
(
psz_unicode
);
i_out
=
2
*
i_in
;
#ifndef MB_CUR_MAX
i_out
=
6
*
i_in
;
#else
i_out
=
MB_CUR_MAX
*
i_in
;
#endif
psz_local
=
malloc
(
i_out
+
1
);
if
(
psz_local
==
NULL
)
return
strdup
(
psz_unicode
)
;
return
NULL
;
psz_out
=
psz_local
;
ret
=
vlc_iconv
(
p_sd
->
p_sys
->
iconvHandle
,
&
psz_in
,
&
i_in
,
&
psz_out
,
&
i_out
);
if
(
ret
==
(
size_t
)(
-
1
)
||
i_in
)
do
{
msg_Warn
(
p_sd
,
"Failed to convert
\"
%s
\"
from UTF-8"
,
psz_unicode
);
free
(
psz_local
);
return
strdup
(
psz_unicode
);
ret
=
vlc_iconv
(
p_sd
->
p_sys
->
iconvHandle
,
&
psz_in
,
&
i_in
,
&
psz_out
,
&
i_out
);
if
(
i_in
)
{
*
psz_in
=
'\0'
;
msg_Warn
(
p_sd
,
"after
\"
%s
\"
: %s"
,
strerror
(
errno
),
psz_unicode
);
*
psz_in
=
'?'
;
}
else
if
(
ret
==
(
size_t
)(
-
1
)
)
{
msg_Err
(
p_sd
,
"character conversion failure : %s"
,
strerror
(
errno
)
);
free
(
psz_local
);
return
NULL
;
}
}
while
(
i_in
);
*
psz_out
=
'\0'
;
return
psz_local
;
}
...
...
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