Merge branch 'remove_old_platforms'

Removes support to ease the transition to SDL2.
This commit is contained in:
Mark de Wever 2014-03-08 18:18:01 +01:00
commit cb4c16749b
13 changed files with 13 additions and 180 deletions

View file

@ -22,6 +22,7 @@ Version 1.13.0-dev:
cached images.
* Idle controlled sides now serialize as human controlled.
* Fixed bug #20876: A segfault in cut_surface.
* Changed: Dropped support for AmigaOS, BeOS, and OS/2.
Version 1.11.11:
* Add-ons server:

View file

@ -473,43 +473,6 @@ std::string copy_from_clipboard(const bool)
#endif
#ifdef __BEOS__
#include <Clipboard.h>
#define CLIPBOARD_FUNCS_DEFINED
void copy_to_clipboard(const std::string& text, const bool)
{
if (be_clipboard->Lock())
{
be_clipboard->Clear();
BMessage *clip;
if ((clip = be_clipboard->Data()))
{
clip->AddData("text/plain", B_MIME_TYPE, text.c_str(), text.size()+1);
be_clipboard->Commit();
}
be_clipboard->Unlock();
}
}
std::string copy_from_clipboard(const bool)
{
const char* data;
ssize_t size;
BMessage *clip = NULL;
if (be_clipboard->Lock())
{
clip = be_clipboard->Data();
be_clipboard->Unlock();
}
if (clip != NULL && clip->FindData("text/plain", B_MIME_TYPE, (const void**)&data, &size) == B_OK)
return (const char*)data;
else
return "";
}
#endif
#ifdef __APPLE__
#define CLIPBOARD_FUNCS_DEFINED

View file

@ -36,13 +36,6 @@
#include <libgen.h>
#endif /* !_WIN32 */
#ifdef __BEOS__
#include <Directory.h>
#include <FindDirectory.h>
#include <Path.h>
BPath be_path;
#endif
// for getenv
#include <cerrno>
#include <fstream>
@ -103,7 +96,6 @@ void get_files_in_dir(const std::string &directory,
// If we have a path to find directories in,
// then convert relative pathnames to be rooted
// on the wesnoth path
#ifndef __AMIGAOS4__
if(!directory.empty() && directory[0] != '/' && !game_config::path.empty()){
std::string dir = game_config::path + "/" + directory;
if(is_directory(dir)) {
@ -111,18 +103,13 @@ void get_files_in_dir(const std::string &directory,
return;
}
}
#endif /* __AMIGAOS4__ */
struct stat st;
if (reorder == DO_REORDER) {
LOG_FS << "searching for _main.cfg in directory " << directory << '\n';
std::string maincfg;
if (directory.empty() || directory[directory.size()-1] == '/'
#ifdef __AMIGAOS4__
|| (directory[directory.size()-1]==':')
#endif /* __AMIGAOS4__ */
)
if (directory.empty() || directory[directory.size()-1] == '/')
maincfg = directory + maincfg_filename;
else
maincfg = (directory + "/") + maincfg_filename;
@ -171,11 +158,7 @@ void get_files_in_dir(const std::string &directory,
#endif /* !APPLE */
std::string fullname;
if (directory.empty() || directory[directory.size()-1] == '/'
#ifdef __AMIGAOS4__
|| (directory[directory.size()-1]==':')
#endif /* __AMIGAOS4__ */
)
if (directory.empty() || directory[directory.size()-1] == '/')
fullname = directory + basename;
else
fullname = directory + "/" + basename;
@ -598,19 +581,6 @@ void set_user_data_dir(std::string path)
#else
if (path.empty()) path = path2;
#ifdef __AMIGAOS4__
user_data_dir = "PROGDIR:" + path;
#elif defined(__BEOS__)
if (be_path.InitCheck() != B_OK) {
BPath tpath;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &be_path, true) == B_OK) {
be_path.Append("wesnoth");
} else {
be_path.SetTo("/boot/home/config/settings/wesnoth");
}
user_data_dir = be_path.Path();
}
#else
const char* home_str = getenv("HOME");
std::string home = home_str ? home_str : ".";
@ -619,7 +589,6 @@ void set_user_data_dir(std::string path)
else
user_data_dir = home + std::string("/") + path;
#endif
#endif
#endif /*_WIN32*/
setup_user_data_dir();
@ -642,21 +611,6 @@ static void setup_user_data_dir()
_mkdir((user_data_dir + "/data/add-ons").c_str());
_mkdir((user_data_dir + "/saves").c_str());
_mkdir((user_data_dir + "/persist").c_str());
#elif defined(__BEOS__)
BPath tpath;
#define BEOS_CREATE_PREFERENCES_SUBDIR(subdir) \
tpath = be_path; \
tpath.Append(subdir); \
create_directory(tpath.Path(), 0775);
BEOS_CREATE_PREFERENCES_SUBDIR("editor");
BEOS_CREATE_PREFERENCES_SUBDIR("editor/maps");
BEOS_CREATE_PREFERENCES_SUBDIR("editor/scenarios");
BEOS_CREATE_PREFERENCES_SUBDIR("data");
BEOS_CREATE_PREFERENCES_SUBDIR("data/add-ons");
BEOS_CREATE_PREFERENCES_SUBDIR("saves");
BEOS_CREATE_PREFERENCES_SUBDIR("persist");
#undef BEOS_CREATE_PREFERENCES_SUBDIR
#else
const std::string& dir_path = user_data_dir;

View file

@ -51,11 +51,6 @@
#include "vld.h"
#endif
// Minimum stack cookie to prevent stack overflow on AmigaOS4
#ifdef __amigaos4__
const char __attribute__((used)) stackcookie[] = "\0$STACK: 16000000";
#endif
static lg::log_domain log_config("config");
#define LOG_CONFIG LOG_STREAM(info, log_config)
@ -70,9 +65,6 @@ static lg::log_domain log_preprocessor("preprocessor");
static void safe_exit(int res) {
LOG_GENERAL << "exiting with code " << res << "\n";
#ifdef OS2 /* required to correctly shutdown SDL on OS/2 */
SDL_Quit();
#endif
exit(res);
}

View file

@ -163,17 +163,11 @@ namespace game_config
menu_select = "select.wav";
}
#ifdef __AMIGAOS4__
std::string path = "PROGDIR:";
#else
#ifdef WESNOTH_PATH
std::string path = WESNOTH_PATH;
#else
std::string path = "";
#endif
#endif
#ifdef DEFAULT_PREFS_PATH
std::string default_preferences_path = DEFAULT_PREFS_PATH;

View file

@ -134,12 +134,10 @@ static void wesnoth_setlocale(int category, std::string const &slocale,
// LANGUAGE overrides other settings, so for now just get rid of it
// FIXME: add configure check for unsetenv
#ifndef _WIN32
#ifndef __AMIGAOS4__
unsetenv ("LANGUAGE"); // void so no return value to check
#endif
#endif
#if defined(__BEOS__) || defined(__APPLE__)
#ifdef __APPLE__
if (category == LC_MESSAGES && setenv("LANG", locale.c_str(), 1) == -1) {
ERR_G << "setenv LANG failed: " << strerror(errno);
}
@ -197,13 +195,11 @@ static void wesnoth_setlocale(int category, std::string const &slocale,
}
#ifndef _WIN32
#ifndef __AMIGAOS4__
if(category == LC_MESSAGES) {
WRN_G << "Setting LANGUAGE to '" << slocale << "'.\n";
setenv("LANGUAGE", slocale.c_str(), 1);
std::setlocale(LC_MESSAGES, "");
}
#endif
#endif
done:

View file

@ -51,11 +51,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h> // for TCP_NODELAY
#ifdef __BEOS__
#include <socket.h>
#else
#include <fcntl.h>
#endif
#define SOCKET int
#endif
@ -427,7 +423,7 @@ void connect_operation::run()
unsigned long mode = 1;
ioctlsocket (raw_sock->channel, FIONBIO, &mode);
}
#elif !defined(__BEOS__)
#else
int flags;
flags = fcntl(raw_sock->channel, F_GETFL, 0);
#if defined(O_NONBLOCK)
@ -442,21 +438,6 @@ void connect_operation::run()
SDLNet_TCP_Close(sock);
return;
}
#else
int on = 1;
if (setsockopt(raw_sock->channel, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int)) < 0) {
error_ = "Could not make socket non-blocking: " + std::string(strerror(errno));
SDLNet_TCP_Close(sock);
return;
}
int fd_flags = fcntl(raw_sock->channel, F_GETFD, 0);
fd_flags |= FD_CLOEXEC;
if (fcntl(raw_sock->channel, F_SETFD, fd_flags) == -1) {
WRN_NW << "could not make socket " << sock << " close-on-exec: " << strerror(errno);
} else {
DBG_NW << "made socket " << sock << " close-on-exec\n";
}
#endif
// If this is a server socket

View file

@ -50,11 +50,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h> // for TCP_NODELAY
#ifdef __BEOS__
#include <socket.h>
#else
#include <fcntl.h>
#endif
#define SOCKET int
#endif

View file

@ -46,11 +46,6 @@
#endif
#ifdef __AMIGAOS4__
#include <unistd.h>
//#include <sys/clib2_net.h>
#endif
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
# undef INADDR_ANY
# undef INADDR_BROADCAST
@ -64,11 +59,7 @@ typedef int socklen_t;
#else
# include <sys/types.h>
# include <sys/socket.h>
# ifdef __BEOS__
# include <socket.h>
# else
# include <fcntl.h>
# endif
# include <fcntl.h>
# define SOCKET int
# ifdef HAVE_POLL_H
# define USE_POLL 1
@ -213,7 +204,7 @@ bool receive_with_timeout(TCPsocket s, char* buf, size_t nbytes,
if(bytes_read == 0) {
return false;
} else if(bytes_read < 0) {
#if defined(EAGAIN) && !defined(__BEOS__) && !defined(_WIN32)
#if defined(EAGAIN) && !defined(_WIN32)
if(errno == EAGAIN)
#elif defined(_WIN32) && defined(WSAEWOULDBLOCK)
//it seems like 'errno == EWOULDBLOCK' compiles on msvc2010, but doesnt work properly at rumtime.
@ -355,9 +346,6 @@ static void make_network_buffer(const char* input, int len, std::vector<char>& b
static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int in_size = -1)
{
#ifdef __BEOS__
int timeout = 60000;
#endif
// check_send_buffer_size(sock);
size_t upto = 0;
size_t size = buf.size();
@ -370,11 +358,8 @@ static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int in_s
const threading::lock lock(*stats_mutex);
transfer_stats[sock].first.fresh_current(size);
}
#ifdef __BEOS__
while(upto < size && timeout > 0) {
#else
while(true) {
#endif
{
const size_t shard = get_shard(sock);
// check if the socket is still locked
@ -398,7 +383,7 @@ static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int in_s
}
#if defined(_WIN32)
if(WSAGetLastError() == WSAEWOULDBLOCK)
#elif defined(EAGAIN) && !defined(__BEOS__)
#elif defined(EAGAIN)
if(errno == EAGAIN)
#elif defined(EWOULDBLOCK)
if(errno == EWOULDBLOCK)
@ -422,7 +407,7 @@ static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int in_s
if(poll_res > 0)
continue;
#elif defined(USE_SELECT) && !defined(__BEOS__)
#elif defined(USE_SELECT)
fd_set writefds;
FD_ZERO(&writefds);
FD_SET(((_TCPsocket*)sock)->channel, &writefds);
@ -437,16 +422,6 @@ static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int in_s
if(retval > 0)
continue;
#elif defined(__BEOS__)
if(res > 0) {
// some data was sent, reset timeout
timeout = 60000;
} else {
// sleep for 100 milliseconds
SDL_Delay(100);
timeout -= 100;
}
continue;
#endif
}

View file

@ -1035,7 +1035,7 @@ utf8_string lowercase(const utf8_string& s)
std::string res;
for(;itor != utf8_iterator::end(s); ++itor) {
#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__AMIGAOS4__)
#if defined(__APPLE__) || defined(__OpenBSD__)
/** @todo FIXME: Should we support towupper on recent OSX platforms? */
wchar_t uchar = *itor;
if(uchar >= 0 && uchar < 0x100)

View file

@ -166,12 +166,9 @@ async_operation::RESULT async_operation::execute(async_operation_ptr this_ptr, w
if(res == condition::WAIT_OK || finishedVar_) {
completed = true;
break;
}
#ifndef __BEOS__
else if(res == condition::WAIT_ERROR) {
} else if(res == condition::WAIT_ERROR) {
break;
}
#endif
}
if(!completed) {

View file

@ -65,7 +65,7 @@ static unsigned int get_flags(unsigned int flags)
#if !SDL_VERSION_ATLEAST(2, 0, 0)
// SDL under Windows doesn't seem to like hardware surfaces
// for some reason.
#if !(defined(_WIN32) || defined(__APPLE__) || defined(__AMIGAOS4__))
#if !(defined(_WIN32) || defined(__APPLE__))
flags |= SDL_HWSURFACE;
#endif
#endif

View file

@ -197,10 +197,6 @@ std::string file_menu::get_path_up(const std::string& path, const unsigned level
curr_path = curr_path.substr(0, index);
}
else {
#ifdef __AMIGAOS4__
index = curr_path.find_last_of(':');
if (index != std::string::npos) index++;
#endif
break;
}
}
@ -223,11 +219,7 @@ std::string file_menu::strip_last_delim(const std::string& path) const {
}
bool file_menu::is_root(const std::string& path) const {
#ifdef __AMIGAOS4__
return path.empty() || path[path.size()-1] == ':';
#else
return path.empty() || (path.size() == 1 && path[0] == path_delim);
#endif
}
std::string file_menu::add_path(const std::string& path, const std::string& to_add) const
@ -237,14 +229,6 @@ std::string file_menu::add_path(const std::string& path, const std::string& to_a
if (to_add == path_up) {
return get_path_up(path);
}
#ifdef __AMIGAOS4__
else if (joined_path.empty() || joined_path[joined_path.size()-1] == ':') {
if (to_add[0] == path_delim)
joined_path += to_add.substr(1);
else
joined_path += to_add;
}
#endif
#ifdef _WIN32
else if (to_add.size() > 1 && to_add[1] == ':') {
joined_path = to_add;