[vlc-devel] [PATCH 1/9] Workaround for OS/2 iconv(), which 1. supports UCS-2 only not UTF-16 2. does not treat a string as a pathname by default

KO Myung-Hun komh78 at gmail.com
Thu Dec 1 14:09:51 CET 2011



Rémi Denis-Courmont wrote:
> Le samedi 26 novembre 2011 08:05:21 KO Myung-Hun, vous avez écrit :
>> ---
>>  src/extras/libc.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 44 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/extras/libc.c b/src/extras/libc.c
>> index 5b028a6..ff40aa0 100644
>> --- a/src/extras/libc.c
>> +++ b/src/extras/libc.c
>> @@ -37,6 +37,15 @@
>>  #   include <iconv.h>
>>  #endif
>>
>> +#if defined(__OS2__) && defined(__INNOTEK_LIBC__)
>> +#   include <uconv.h>
>> +
>> +typedef struct os2_iconv_t
>> +{
>> +    UconvObject from;
>> +} os2_iconv_t;
>> +#endif
>> +
>>  /*************************************************************************
>> **** * Local conversion routine from ISO_6937 to UTF-8 charset. Support for
>> this * is still missing in libiconv, hence multiple operating systems lack
>> it. @@ -326,7 +335,42 @@ vlc_iconv_t vlc_iconv_open( const char *tocode,
>> const char *fromcode ) return (vlc_iconv_t)(-2);
>>  #endif
>>  #if defined(HAVE_ICONV)
>> +# if defined(__OS2__) && defined(__INNOTEK_LIBC__)
>> +    char tocode_ucs2[] = "UCS-2LE";
>> +    char fromcode_ucs2[] = "UCS-2LE";
> 
> This should be const char *. There is no point in copying the strings on the 
> stack every time.
> 


Ooops. This generates the following warning.

-----
  CC     extras/libc.lo
extras/libc.c: In function 'vlc_iconv_open':
extras/libc.c:346: warning: passing argument 1 of 'strncpy' discards
qualifiers
from pointer target type
f:/lang/gcc/usr/include/string.h:104: note: expected 'char * restrict' but
argum
ent is of type 'const char *'
extras/libc.c:352: warning: passing argument 1 of 'strncpy' discards
qualifiers
from pointer target type
f:/lang/gcc/usr/include/string.h:104: note: expected 'char * restrict' but
argum
ent is of type 'const char *'
-----

And it causes SIGSEGV.

So I attach my original sources, again.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.0.14
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1GHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Workaround-for-OS-2-iconv.patch
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20111201/dda9a4f7/attachment.ksh>


More information about the vlc-devel mailing list