mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 18:43:16 +00:00
Remove residual SDL1 support blocks
This commit is contained in:
parent
e7d254bce7
commit
aaa91d3972
@ -9,25 +9,16 @@ static lg::log_domain log_filesystem("filesystem");
|
||||
|
||||
namespace filesystem {
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static Sint64 ifs_size (struct SDL_RWops * context);
|
||||
static Sint64 SDLCALL ifs_seek(struct SDL_RWops *context, Sint64 offset, int whence);
|
||||
static size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
|
||||
static size_t SDLCALL ifs_write(struct SDL_RWops *context, const void *ptr, size_t size, size_t num);
|
||||
static int SDLCALL ifs_close(struct SDL_RWops *context);
|
||||
#else
|
||||
static int SDLCALL ifs_seek(struct SDL_RWops *context, int offset, int whence);
|
||||
static int SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
||||
static int SDLCALL ifs_write(struct SDL_RWops *context, const void *ptr, int size, int num);
|
||||
static int SDLCALL ifs_close(struct SDL_RWops *context);
|
||||
#endif
|
||||
|
||||
SDL_RWops* load_RWops(const std::string &path) {
|
||||
SDL_RWops *rw = SDL_AllocRW();
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
rw->size = &ifs_size;
|
||||
#endif
|
||||
rw->seek = &ifs_seek;
|
||||
rw->read = &ifs_read;
|
||||
rw->write = &ifs_write;
|
||||
@ -47,7 +38,6 @@ SDL_RWops* load_RWops(const std::string &path) {
|
||||
}
|
||||
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static Sint64 ifs_size (struct SDL_RWops * context) {
|
||||
std::istream *ifs = static_cast<std::istream*>(context->hidden.unknown.data1);
|
||||
std::streampos orig = ifs->tellg();
|
||||
@ -61,13 +51,8 @@ static Sint64 ifs_size (struct SDL_RWops * context) {
|
||||
return len;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static Sint64 SDLCALL ifs_seek(struct SDL_RWops *context, Sint64 offset, int whence) {
|
||||
#else
|
||||
static int SDLCALL ifs_seek(struct SDL_RWops *context, int offset, int whence) {
|
||||
#endif
|
||||
|
||||
std::ios_base::seekdir seekdir;
|
||||
switch(whence){
|
||||
@ -102,11 +87,7 @@ static int SDLCALL ifs_seek(struct SDL_RWops *context, int offset, int whence) {
|
||||
return static_cast<int>(pos);
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum) {
|
||||
#else
|
||||
static int SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, int size, int maxnum) {
|
||||
#endif
|
||||
std::istream *ifs = static_cast<std::istream*>(context->hidden.unknown.data1);
|
||||
|
||||
// This seems overly simplistic, but it's the same as mem_read's implementation
|
||||
@ -120,11 +101,7 @@ static int SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, int size, int
|
||||
return static_cast<int>(num);
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
static size_t SDLCALL ifs_write(struct SDL_RWops * /*context*/, const void * /*ptr*/, size_t /*size*/, size_t /*num*/) {
|
||||
#else
|
||||
static int SDLCALL ifs_write(struct SDL_RWops * /*context*/, const void * /*ptr*/, int /*size*/, int /*num*/) {
|
||||
#endif
|
||||
SDL_SetError("Writing not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
@ -69,7 +69,6 @@
|
||||
#include <SDL_events.h> // for SDL_ENABLE
|
||||
#include <SDL_joystick.h> // for SDL_JoystickEventState, etc
|
||||
#include <SDL_timer.h> // for SDL_Delay
|
||||
#include <SDL_version.h> // for SDL_VERSION_ATLEAST
|
||||
#include <SDL_video.h> // for SDL_WM_SetCaption, etc
|
||||
|
||||
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
|
||||
|
Loading…
x
Reference in New Issue
Block a user