src/unix.cpp
author terom@frrb.lan
Fri, 19 Dec 2008 01:38:09 +0200
changeset 10439 50f056aa3024
parent 10315 b3c652b3a316
permissions -rw-r--r--
industries, unmoveables... everything but the landscape
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2177
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2177
diff changeset
     2
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 9023
diff changeset
     3
/** @file unix.cpp Implementation of Unix specific file handling. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6318
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1892
8717d92b32b1 (svn r2398) - CodeChange: forgot to update unix and os2 specific files as well.
Darkvater
parents: 1885
diff changeset
     6
#include "openttd.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2099
diff changeset
     7
#include "variables.h"
8107
bb7deea89175 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8106
diff changeset
     8
#include "textbuf_gui.h"
8131
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8107
diff changeset
     9
#include "functions.h"
160939e24ed3 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8107
diff changeset
    10
#include "core/random_func.hpp"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8215
diff changeset
    12
#include "table/strings.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8215
diff changeset
    13
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
#include <dirent.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
#include <unistd.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
#include <sys/stat.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
#include <time.h>
1509
795ba683e4f0 (svn r2013) Always ignore SIGPIPE, not only when SDL is used (ShadowJK)
tron
parents: 1508
diff changeset
    18
#include <signal.h>
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
1850
15826a18b5ac (svn r2356) Make check if statvfs() is availible a bit more sensible
tron
parents: 1687
diff changeset
    20
#if (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)
1597
ef6253448620 (svn r2101) statvfs() is availible on POSIX.1 conformant systems.
tron
parents: 1596
diff changeset
    21
	#define HAS_STATVFS
ef6253448620 (svn r2101) statvfs() is availible on POSIX.1 conformant systems.
tron
parents: 1596
diff changeset
    22
#endif
ef6253448620 (svn r2101) statvfs() is availible on POSIX.1 conformant systems.
tron
parents: 1596
diff changeset
    23
ef6253448620 (svn r2101) statvfs() is availible on POSIX.1 conformant systems.
tron
parents: 1596
diff changeset
    24
#ifdef HAS_STATVFS
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
#include <sys/statvfs.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
#endif
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
#ifdef __MORPHOS__
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
#include <exec/types.h>
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
ULONG __stack = (1024*1024)*2; // maybe not that much is needed actually ;)
2356
43d1812406e7 (svn r2882) Some fixes for MorphOS (by tokai)
tron
parents: 2338
diff changeset
    32
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6318
diff changeset
    33
/* The system supplied definition of SIG_IGN does not match */
2356
43d1812406e7 (svn r2882) Some fixes for MorphOS (by tokai)
tron
parents: 2338
diff changeset
    34
#undef SIG_IGN
43d1812406e7 (svn r2882) Some fixes for MorphOS (by tokai)
tron
parents: 2338
diff changeset
    35
#define SIG_IGN (void (*)(int))1
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
#endif /* __MORPHOS__ */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 704
diff changeset
    38
#ifdef __AMIGA__
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 704
diff changeset
    39
#warning add stack symbol to avoid that user needs to set stack manually (tokai)
915
d845fe7cf6f2 (svn r1402) Trim trailing whitespace
tron
parents: 826
diff changeset
    40
// ULONG __stack =
770
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 704
diff changeset
    41
#endif
c2eacca29601 (svn r1236) MorphOS: added make release like in OSX (tokai)
bjarni
parents: 704
diff changeset
    42
2188
640a0a5f77ea (svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents: 2186
diff changeset
    43
#if defined(__APPLE__)
2217
7a5d829eca29 (svn r2735) -Fix: [OSX] fixed issue introduced in 2733 where dedicated servers on OSX included sdl.h even when WITH_SDL was not defined (oops)
bjarni
parents: 2215
diff changeset
    44
	#if defined(WITH_SDL)
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6318
diff changeset
    45
		/*the mac implementation needs this file included in the same file as main() */
2217
7a5d829eca29 (svn r2735) -Fix: [OSX] fixed issue introduced in 2733 where dedicated servers on OSX included sdl.h even when WITH_SDL was not defined (oops)
bjarni
parents: 2215
diff changeset
    46
		#include <SDL.h>
7a5d829eca29 (svn r2735) -Fix: [OSX] fixed issue introduced in 2733 where dedicated servers on OSX included sdl.h even when WITH_SDL was not defined (oops)
bjarni
parents: 2215
diff changeset
    47
	#endif
2188
640a0a5f77ea (svn r2703) - Feature: [OSX] Added a native alert window to show whatever error() needs to print (Tobin made this, while I fixed some issued in it)
bjarni
parents: 2186
diff changeset
    48
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    50
bool FiosIsRoot(const char *path)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
{
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    52
#if !defined(__MORPHOS__) && !defined(__AMIGAOS__)
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    53
	return path[1] == '\0';
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    54
#else
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    55
	/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    56
	const char *s = strchr(path, ':');
6632
17d38db79a50 (svn r9861) -Fix: null pointer derefence under MorphOS and AmigaOS.
rubidium
parents: 6423
diff changeset
    57
	return s != NULL && s[1] == '\0';
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    58
#endif
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    59
}
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    60
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6240
diff changeset
    61
void FiosGetDrives()
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    62
{
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    63
	return;
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    64
}
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    65
4222
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    66
bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    67
{
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    68
	uint32 free = 0;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    69
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    70
#ifdef HAS_STATVFS
7985
e6e00c10fdae (svn r11541) -Fix: [OSX] detect statvfs at runtime (based on OSX version) instead of compile time
bjarni
parents: 7935
diff changeset
    71
# ifdef __APPLE__
e6e00c10fdae (svn r11541) -Fix: [OSX] detect statvfs at runtime (based on OSX version) instead of compile time
bjarni
parents: 7935
diff changeset
    72
	/* OSX 10.3 lacks statvfs so don't try to use it even though later versions of OSX has it. */
e6e00c10fdae (svn r11541) -Fix: [OSX] detect statvfs at runtime (based on OSX version) instead of compile time
bjarni
parents: 7935
diff changeset
    73
	if (MacOSVersionIsAtLeast(10, 4, 0))
e6e00c10fdae (svn r11541) -Fix: [OSX] detect statvfs at runtime (based on OSX version) instead of compile time
bjarni
parents: 7935
diff changeset
    74
# endif
4222
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    75
	{
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    76
		struct statvfs s;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    77
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    78
		if (statvfs(path, &s) != 0) return false;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    79
		free = (uint64)s.f_frsize * s.f_bavail >> 20;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    80
	}
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    81
#endif
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    82
	if (tot != NULL) *tot = free;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    83
	return true;
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    84
}
36e9bd216011 (svn r5766) - Cleanup: Unify FiosBrowseTo and FiosGetDescText
Darkvater
parents: 4221
diff changeset
    85
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    86
bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb)
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    87
{
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	char filename[MAX_PATH];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    90
#if defined(__MORPHOS__) || defined(__AMIGAOS__)
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    91
	/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    92
	if (FiosIsRoot(path)) {
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    93
		snprintf(filename, lengthof(filename), "%s:%s", path, ent->d_name);
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    94
	} else // XXX - only next line!
6755
7cca96e92189 (svn r9990) -Fix: MorphOS and AmigaOS do not like "//" in filenames as that means the same as "/../" in means in Unix.
rubidium
parents: 6632
diff changeset
    95
#else
7cca96e92189 (svn r9990) -Fix: MorphOS and AmigaOS do not like "//" in filenames as that means the same as "/../" in means in Unix.
rubidium
parents: 6632
diff changeset
    96
	assert(path[strlen(path) - 1] == PATHSEPCHAR);
7cca96e92189 (svn r9990) -Fix: MorphOS and AmigaOS do not like "//" in filenames as that means the same as "/../" in means in Unix.
rubidium
parents: 6632
diff changeset
    97
	if (strlen(path) > 2) assert(path[strlen(path) - 2] != PATHSEPCHAR);
4221
ff4a040f30c6 (svn r5765) - Codechange: Fully unify the OS-specific FiosGet...List functions into fios.c, as well as FiosGetSavegameList and FiosGetScenarioList functions with the help of some callbacks.
Darkvater
parents: 4220
diff changeset
    98
#endif
6755
7cca96e92189 (svn r9990) -Fix: MorphOS and AmigaOS do not like "//" in filenames as that means the same as "/../" in means in Unix.
rubidium
parents: 6632
diff changeset
    99
	snprintf(filename, lengthof(filename), "%s%s", path, ent->d_name);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   100
6240
9d9874ef9f0b (svn r9043) -Fix [FS#652]: the personal (.openttd) directories were hidden in the load/save directory listings (stepancheg).
rubidium
parents: 6022
diff changeset
   101
	return stat(filename, sb) == 0;
9d9874ef9f0b (svn r9043) -Fix [FS#652]: the personal (.openttd) directories were hidden in the load/save directory listings (stepancheg).
rubidium
parents: 6022
diff changeset
   102
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
6240
9d9874ef9f0b (svn r9043) -Fix [FS#652]: the personal (.openttd) directories were hidden in the load/save directory listings (stepancheg).
rubidium
parents: 6022
diff changeset
   104
bool FiosIsHiddenFile(const struct dirent *ent)
9d9874ef9f0b (svn r9043) -Fix [FS#652]: the personal (.openttd) directories were hidden in the load/save directory listings (stepancheg).
rubidium
parents: 6022
diff changeset
   105
{
9d9874ef9f0b (svn r9043) -Fix [FS#652]: the personal (.openttd) directories were hidden in the load/save directory listings (stepancheg).
rubidium
parents: 6022
diff changeset
   106
	return ent->d_name[0] == '.';
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   108
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   109
#ifdef WITH_ICONV
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   110
3332
7a671549da48 (svn r4109) - Fix (r4105) [iconv]: Only include the needed headers when ICONV is actually used. Thanks for noticing Bjarni
Darkvater
parents: 3330
diff changeset
   111
#include <iconv.h>
7a671549da48 (svn r4109) - Fix (r4105) [iconv]: Only include the needed headers when ICONV is actually used. Thanks for noticing Bjarni
Darkvater
parents: 3330
diff changeset
   112
#include <errno.h>
7a671549da48 (svn r4109) - Fix (r4105) [iconv]: Only include the needed headers when ICONV is actually used. Thanks for noticing Bjarni
Darkvater
parents: 3330
diff changeset
   113
#include "debug.h"
8215
e09394d313fc (svn r11778) -Fix: compiles with ICONV failed.
rubidium
parents: 8214
diff changeset
   114
#include "string_func.h"
3332
7a671549da48 (svn r4109) - Fix (r4105) [iconv]: Only include the needed headers when ICONV is actually used. Thanks for noticing Bjarni
Darkvater
parents: 3330
diff changeset
   115
9023
7bdfc5768e6e (svn r12836) -Fix: SunOS non-dedicated server compilation.
rubidium
parents: 8264
diff changeset
   116
const char *GetCurrentLocale(const char *param);
7bdfc5768e6e (svn r12836) -Fix: SunOS non-dedicated server compilation.
rubidium
parents: 8264
diff changeset
   117
5108
aeaef6fe53b7 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4369
diff changeset
   118
#define INTERNALCODE "UTF-8"
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   119
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   120
/** Try and try to decipher the current locale from environmental
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   121
 * variables. MacOSX is hardcoded, other OS's are dynamic. If no suitable
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   122
 * locale can be found, don't do any conversion "" */
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6240
diff changeset
   123
static const char *GetLocalCode()
3260
ed19f95eb4f7 (svn r3966) -Fix: [OSX and some linux] [ 1157244 ] Can't save game if name contains german umlauts
bjarni
parents: 2952
diff changeset
   124
{
3408
1da501b2eae1 (svn r4219) - Add support for WITH_ICONV. It is enabled by default for OSX > 10.3 for all others set it with WITH_ICONV in Makefile.config or with --with-iconv with configure. --with-config=/somedir will search for iconv include files somewhere (or in Makefile.config with WITH_ICONV_PATH). Custom library loading is not (yet) supported
Darkvater
parents: 3332
diff changeset
   125
#if defined(__APPLE__)
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   126
	return "UTF-8-MAC";
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   127
#else
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   128
	/* Strip locale (eg en_US.UTF-8) to only have UTF-8 */
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   129
	const char *locale = GetCurrentLocale("LC_CTYPE");
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   130
	if (locale != NULL) locale = strchr(locale, '.');
3260
ed19f95eb4f7 (svn r3966) -Fix: [OSX and some linux] [ 1157244 ] Can't save game if name contains german umlauts
bjarni
parents: 2952
diff changeset
   131
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   132
	return (locale == NULL) ? "" : locale + 1;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   133
#endif
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   134
}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   135
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   136
/** FYI: This is not thread-safe.
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   137
 * convert between locales, which from and which to is set in the calling
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   138
 * functions OTTD2FS() and FS2OTTD(). You should NOT use this function directly
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   139
 * NOTE: iconv was added in OSX 10.3. 10.2.x will still have the invalid char
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   140
 * issues. There aren't any easy fix for this */
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   141
static const char *convert_tofrom_fs(iconv_t convd, const char *name)
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   142
{
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   143
	static char buf[1024];
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   144
	/* Work around buggy iconv implementation where inbuf is wrongly typed as
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   145
	 * non-const. Correct implementation is at
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   146
	 * http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html */
9727
3c06f03dadbe (svn r13852) -Fix (r13849): [OSX] fixed universal binary building without breaking anything this time
bjarni
parents: 9724
diff changeset
   147
#ifdef HAVE_BROKEN_ICONV
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   148
	char *inbuf = (char*)name;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   149
#else
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   150
	const char *inbuf = name;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   151
#endif
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   152
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   153
	char *outbuf  = buf;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   154
	size_t outlen = sizeof(buf) - 1;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   155
	size_t inlen  = strlen(name);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   156
10315
b3c652b3a316 (svn r14560) -Fix [FS#2396](r14555): lengthof() can't be simply replaced by lastof() in some cases (part by Aali)
smatz
parents: 10310
diff changeset
   157
	strecpy(outbuf, name, outbuf + outlen);
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   158
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   159
	iconv(convd, NULL, NULL, NULL, NULL);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   160
	if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   161
		DEBUG(misc, 0, "[iconv] error converting '%s'. Errno %d", name, errno);
3260
ed19f95eb4f7 (svn r3966) -Fix: [OSX and some linux] [ 1157244 ] Can't save game if name contains german umlauts
bjarni
parents: 2952
diff changeset
   162
	}
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   163
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   164
	*outbuf = '\0';
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6318
diff changeset
   165
	/* FIX: invalid characters will abort conversion, but they shouldn't occur? */
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   166
	return buf;
3260
ed19f95eb4f7 (svn r3966) -Fix: [OSX and some linux] [ 1157244 ] Can't save game if name contains german umlauts
bjarni
parents: 2952
diff changeset
   167
}
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   168
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   169
/** Convert from OpenTTD's encoding to that of the local environment
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   170
 * @param name pointer to a valid string that will be converted
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   171
 * @return pointer to a new stringbuffer that contains the converted string */
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   172
const char *OTTD2FS(const char *name)
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   173
{
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   174
	static iconv_t convd = (iconv_t)(-1);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   175
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   176
	if (convd == (iconv_t)(-1)) {
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   177
		const char *env = GetLocalCode();
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   178
		convd = iconv_open(env, INTERNALCODE);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   179
		if (convd == (iconv_t)(-1)) {
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   180
			DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", INTERNALCODE, env);
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   181
			return name;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   182
		}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   183
	}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   184
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   185
	return convert_tofrom_fs(convd, name);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   186
}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   187
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   188
/** Convert to OpenTTD's encoding from that of the local environment
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   189
 * @param name pointer to a valid string that will be converted
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   190
 * @return pointer to a new stringbuffer that contains the converted string */
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   191
const char *FS2OTTD(const char *name)
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   192
{
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   193
	static iconv_t convd = (iconv_t)(-1);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   194
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   195
	if (convd == (iconv_t)(-1)) {
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   196
		const char *env = GetLocalCode();
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   197
		convd = iconv_open(INTERNALCODE, env);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   198
		if (convd == (iconv_t)(-1)) {
5380
8ea58542b6e0 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5296
diff changeset
   199
			DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", env, INTERNALCODE);
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   200
			return name;
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   201
		}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   202
	}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   203
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   204
	return convert_tofrom_fs(convd, name);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   205
}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   206
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   207
#else
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   208
const char *FS2OTTD(const char *name) {return name;}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   209
const char *OTTD2FS(const char *name) {return name;}
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3294
diff changeset
   210
#endif /* WITH_ICONV */
9130
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   211
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   212
void ShowInfo(const char *str)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   213
{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   214
	fprintf(stderr, "%s\n", str);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   215
}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   216
9470
08424e2e79e4 (svn r13390) -Codechange: introduce usererror() for fatal but not openttd related errors. Now all error() will 'crash' openttd after showing the message in win32 releases (MSVC), creating a crash.log and crash.dmp (like the '!' hack used before). On the other hand, usererror() will just close the game. So use error() only when it can be helpful to debugging, else use usererror().
glx
parents: 9130
diff changeset
   217
void ShowOSErrorBox(const char *buf, bool system)
9130
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   218
{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   219
#if defined(__APPLE__)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   220
	/* this creates an NSAlertPanel with the contents of 'buf'
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   221
	 * this is the native and nicest way to do this on OSX */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   222
	ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   223
#else
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   224
	/* all systems, but OSX */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   225
	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   226
#endif
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   227
}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   228
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   229
#ifdef WITH_COCOA
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   230
void cocoaSetupAutoreleasePool();
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   231
void cocoaReleaseAutoreleasePool();
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   232
#endif
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   233
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   234
int CDECL main(int argc, char* argv[])
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   235
{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   236
	int ret;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   237
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   238
#ifdef WITH_COCOA
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   239
	cocoaSetupAutoreleasePool();
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   240
	/* This is passed if we are launched by double-clicking */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   241
	if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   242
		argv[1] = NULL;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   243
		argc = 1;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   244
	}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   245
#endif
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   246
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   247
	SetRandomSeed(time(NULL));
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   248
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   249
	signal(SIGPIPE, SIG_IGN);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   250
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   251
	ret = ttd_main(argc, argv);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   252
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   253
#ifdef WITH_COCOA
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   254
	cocoaReleaseAutoreleasePool();
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   255
#endif
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   256
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   257
	return ret;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   258
}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   259
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   260
bool InsertTextBufferClipboard(Textbuf *tb)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   261
{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   262
	return false;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   263
}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   264
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   265
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   266
/* multi os compatible sleep function */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   267
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   268
#ifdef __AMIGA__
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   269
/* usleep() implementation */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   270
#	include <devices/timer.h>
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   271
#	include <dos/dos.h>
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   272
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   273
	extern struct Device      *TimerBase    = NULL;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   274
	extern struct MsgPort     *TimerPort    = NULL;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   275
	extern struct timerequest *TimerRequest = NULL;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   276
#endif // __AMIGA__
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   277
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   278
void CSleep(int milliseconds)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   279
{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   280
	#if defined(PSP)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   281
		sceKernelDelayThread(milliseconds * 1000);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   282
	#elif defined(__BEOS__)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   283
		snooze(milliseconds * 1000);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   284
	#elif defined(__AMIGA__)
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   285
	{
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   286
		ULONG signals;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   287
		ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   288
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   289
		/* send IORequest */
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   290
		TimerRequest->tr_node.io_Command = TR_ADDREQUEST;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   291
		TimerRequest->tr_time.tv_secs    = (milliseconds * 1000) / 1000000;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   292
		TimerRequest->tr_time.tv_micro   = (milliseconds * 1000) % 1000000;
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   293
		SendIO((struct IORequest *)TimerRequest);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   294
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   295
		if (!((signals = Wait(TimerSigBit | SIGBREAKF_CTRL_C)) & TimerSigBit) ) {
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   296
			AbortIO((struct IORequest *)TimerRequest);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   297
		}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   298
		WaitIO((struct IORequest *)TimerRequest);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   299
	}
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   300
	#else
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   301
		usleep(milliseconds * 1000);
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   302
	#endif
f6d1fc1e8815 (svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
rubidium
parents: 9111
diff changeset
   303
}