[MPlayer-users] [PATCH] asf_mmst_streaming.c fails to compile on some systems

Steven M. Schultz sms at 2BSD.COM
Tue Nov 4 18:37:18 CET 2003


Hi!

	asf_mmst_streaming.c doesn't compile on some systems (which have
	only the older setlocale rather than the newer nl_langinfo):

cc -c -O4 -march=i686 -mcpu=i686 -pipe -ffast-math -fomit-frame-pointer -D_THREAD_SAFE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I../loader      -o asf_mmst_streaming.o asf_mmst_streaming.c
asf_mmst_streaming.c:27: langinfo.h: No such file or directory
asf_mmst_streaming.c: In function `string_utf16_open':
asf_mmst_streaming.c:117: `CODESET' undeclared (first use in this function)
asf_mmst_streaming.c:117: (Each undeclared identifier is reported only once
asf_mmst_streaming.c:117: for each function it appears in.)
asf_mmst_streaming.c:117: warning: passing arg 2 of `libiconv_open' makes pointer from integer without a cast
asf_mmst_streaming.c: In function `string_utf16':
asf_mmst_streaming.c:133: warning: passing arg 2 of `libiconv' from incompatible pointer type
gmake: *** [asf_mmst_streaming.o] Error 1

	The fix is trivial and will work everywhere that has setlocale().

	setlocale(LC_CTYPE, NULL) is equivalent to nl_langinfo(CODESET) - I've
	tested the patch on a system which has nl_langinfo.

	Cheers,
	Steven Schultz
-------------- next part --------------
--- asf_mmst_streaming.c.dist	Sun Nov  2 20:20:23 2003
+++ asf_mmst_streaming.c	Sun Nov  2 22:08:45 2003
@@ -24,7 +24,6 @@
 
 #ifdef USE_ICONV
 #include <locale.h>
-#include <langinfo.h>
 #include <iconv.h>
 #endif
 
@@ -114,7 +113,7 @@
 
 static void string_utf16_open() {
     setlocale(LC_CTYPE, "");
-    url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
+    url_conv = iconv_open("UTF-16LE", setlocale(LC_CTYPE, NULL));
 }
 
 static void string_utf16_close() {


More information about the MPlayer-users mailing list