Changeset - r16889:d62378935fb0
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-12-25 12:49:36
rubidium@openttd.org
(svn r21634) -Codechange: apparantly the "broken" iconv interface is the new official interface, so update the variable/definition naming slightly as it's not broken just different from the earlier iconv interface
2 files changed with 13 insertions and 13 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -1655,14 +1655,14 @@ make_cflags_and_ldflags() {
 
			if [ "$with_iconv" != "2" ]; then
 
				CFLAGS="$CFLAGS -I$with_iconv/include"
 
				LIBS="$LIBS -L$with_iconv/lib"
 
			fi
 
		fi
 

	
 
		if [ "$have_broken_iconv" != "no" ]; then
 
			CFLAGS="$CFLAGS -DHAVE_BROKEN_ICONV"
 
		if [ "$have_non_const_iconv" != "no" ]; then
 
			CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
 
		fi
 
	fi
 

	
 
	if [ -n "$with_midi" ]; then
 
		CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
 
	fi
 
@@ -2913,15 +2913,15 @@ detect_iconv() {
 
	fi
 

	
 
	log 2 "found iconv in $iconv"
 

	
 
	log 1 "checking iconv... found"
 

	
 
	# Check if we need to work around buggy iconv implementation where inbuf
 
	# is wrongly typed as non-const. Correct implementation is at
 
	# http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
 
	# There are different implementations of iconv. The older ones,
 
	# e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
 
	# IEEE 1003.1 (2004), pass a non-const pointer.
 

	
 
	cat > tmp.iconv.cpp << EOF
 
#include "src/stdafx.h"
 
#include <iconv.h>
 
int main() {
 
	static char buf[1024];
 
@@ -2935,14 +2935,14 @@ int main() {
 
EOF
 
	execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
 
	eval $execute > /dev/null
 
	ret=$?
 
	log 2 "executing $execute"
 
	log 2 "  exit code $ret"
 
	if [ "$ret" = "0" ]; then have_broken_iconv="no"; else have_broken_iconv="yes"; fi
 
	log 1 "checking if iconv has non-const inbuf... $have_broken_iconv"
 
	if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
 
	log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
 

	
 
	cat > tmp.iconv.cpp << EOF
 
#include "src/stdafx.h"
 
#include <iconv.h>
 
int main() {
 
	static char buf[1024];
 
@@ -3246,19 +3246,19 @@ generate_src_osx() {
 
			CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
 
			LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
 
		fi
 

	
 
		# We don't want to duplicate the x86_64 stuff for each target, so do it once here
 
		if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
 
			# 64 bits is always 10.5 or higher. Furthermore it has a broken ICONV
 
			# 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
 
			# and they also removed support for QuickTime/QuickDraw
 
			if [ -n "$osx_sdk_path" ]; then
 
				CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
 
				LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
 
			fi
 
			CFLAGS="$CFLAGS -D_SQ64 -DHAVE_BROKEN_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
 
			CFLAGS="$CFLAGS -D_SQ64 -DHAVE_NON_CONST_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
 
			LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
 
		fi
 

	
 
		case $type in
 
			ppc)
 
				BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
src/os/unix/unix.cpp
Show inline comments
 
@@ -148,16 +148,16 @@ static const char *GetLocalCode()
 
 * Convert between locales, which from and which to is set in the calling
 
 * functions OTTD2FS() and FS2OTTD().
 
 */
 
static const char *convert_tofrom_fs(iconv_t convd, const char *name)
 
{
 
	static char buf[1024];
 
	/* Work around buggy iconv implementation where inbuf is wrongly typed as
 
	 * non-const. Correct implementation is at
 
	 * http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html */
 
#ifdef HAVE_BROKEN_ICONV
 
	/* There are different implementations of iconv. The older ones,
 
	 * e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
 
	 * IEEE 1003.1 (2004), pass a non-const pointer. */
 
#ifdef HAVE_NON_CONST_ICONV
 
	char *inbuf = const_cast<char*>(name);
 
#else
 
	const char *inbuf = name;
 
#endif
 

	
 
	char *outbuf  = buf;
0 comments (0 inline, 0 general)