<html><head></head><body><div class="gmail_quote">Le 9 août 2017 18:11:37 GMT+03:00, KO Myung-Hun <komh78@gmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br /><br />Rémi Denis-Courmont wrote:<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Le 9 août 2017 13:44:03 GMT+03:00, KO Myung-Hun <komh78@gmail.com> a écrit :<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> uni_char_t is 2-byte size on OS/2. However, FriBidiChar is 4-byte size.<br /> While conversion, the memory pointed by uni_char_t * is corrupted.<br /> ---<br /> modules/text_renderer/freetype.c | 25 +++++++++++++++++++++++--<br /> 1 file changed, 23 insertions(+), 2 deletions(-)<br /><br /> diff --git a/modules/text_renderer/freetype.c<br /> b/modules/text_renderer/freetype.c<br /> index b9da7bf28c..0ae6c16809 100644<br /> --- a/modules/text_renderer/freetype.c<br /> +++ b/modules/text_renderer/freetype.c<br /> @@ -1153,16 +1153,31 @@ static int ProcessLines( filter_t *p_filter,<br />                          FT_BBox     *p_bbox,<br />                          int         *pi_max_face_height,<br /><br /> -                         uni_char_t *psz_text,<br /> +                         uni_char_t *psz_uni_text,<br />                          text_style_t **pp_styles,<br />                          uint32_t *pi_k_dates,<br />                          int i_len )<br /> {<br />     filter_sys_t   *p_sys = p_filter->p_sys;<br /> -    uni_char_t     *p_fribidi_string = NULL;<br /> +    uint32_t       *psz_text = (uint32_t*)psz_uni_text;<br /> +    uint32_t       *p_fribidi_string = NULL;<br />     text_style_t   **pp_fribidi_styles = NULL;<br />     int            *p_new_positions = NULL;<br /><br /> +#ifdef __OS2__<br /> +    uint32_t *psz_text_buf;<br /> +<br /> +    psz_text = malloc( (i_len + 1) * sizeof(*psz_text) );<br /> +    if( !psz_text )<br /> +        return VLC_ENOMEM;<br /> +<br /> +    /* Conversion uni_char_t string to FriBidiChar string */<br /> +    for( int i = 0; i <= i_len; i++ )<br /> +        psz_text[i] = psz_uni_text[i];<br /> +<br /> +    psz_text_buf = psz_text;<br /> +#endif<br /> +<br /> #if defined(HAVE_FRIBIDI)<br />     {<br />         int    *p_old_positions;<br /> @@ -1183,6 +1198,9 @@ static int ProcessLines( filter_t *p_filter,<br />             free( p_new_positions );<br />             free( p_fribidi_string );<br />             free( pp_fribidi_styles );<br /> +#ifdef __OS2__<br /> +            free( psz_text_buf );<br /> +#endif<br />             return VLC_ENOMEM;<br />         }<br /><br /> @@ -1567,6 +1585,9 @@ static int ProcessLines( filter_t *p_filter,<br />     if( p_face )<br />         FT_Done_Face( p_face );<br /><br /> +#ifdef __OS2__<br /> +    free( psz_text_buf );<br /> +#endif<br />     free( pp_fribidi_styles );<br />     free( p_fribidi_string );<br />     free( pi_karaoke_bar );<br /> -- <br /> 2.13.3<br /><br /><hr /><br /> vlc-devel mailing list<br /> To unsubscribe or modify your subscription options:<br /> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br /></blockquote> <br /> That does not look right from a very quick glance. It should probably do whatever Windows does.<br /> <br /></blockquote><br />This is because OS/2 kLIBC iconv() does not support UCS4 but UCS2. As a<br />result, uni_char_t should be 2-byte size. I don't think Windows does<br />like this.<br /></pre></blockquote></div><br clear="all">That statement does not make sense to me. iconv converts between two specified encodings, not to/from a fixed encoding, unlike say MultiByteToWideChar() or FromCharset()<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>