mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 05:27:48 +00:00
Fixed bug 4526 - replace SDL_RW* macros with functions for using in bindings
ace I got this bug in SDL_ttf: https://bugzilla.libsdl.org/show_bug.cgi?id=4524 Sylvain proposed solution: SDL_RWseek(RWops, 0, RW_SEEK_SET); And it works, but i can use it my project, because it written in C# with SDL2-CS wrapper and there not export for macroses: #define SDL_RWsize(ctx) (ctx)->size(ctx) #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) #define SDL_RWclose(ctx) (ctx)->close(ctx) Therefore, I suggest replacing this macros with functions so that they can be exported and used in bindings
This commit is contained in:
@@ -752,6 +752,48 @@ done:
|
||||
return data;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_LoadFile(const char *file, size_t *datasize)
|
||||
{
|
||||
return SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWsize(SDL_RWops *context)
|
||||
{
|
||||
return context->size(context);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)
|
||||
{
|
||||
return context->seek(context, offset, whence);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWtell(SDL_RWops *context)
|
||||
{
|
||||
return context->seek(context, 0, RW_SEEK_CUR);
|
||||
}
|
||||
|
||||
size_t
|
||||
SDL_RWread(SDL_RWops *context, void *ptr, size_t size, size_t maxnum)
|
||||
{
|
||||
return context->read(context, ptr, size, maxnum);
|
||||
}
|
||||
|
||||
size_t
|
||||
SDL_RWwrite(SDL_RWops *context, const void *ptr, size_t size, size_t num)
|
||||
{
|
||||
return context->write(context, ptr, size, num);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_RWclose(SDL_RWops *context)
|
||||
{
|
||||
return context->close(context);
|
||||
}
|
||||
|
||||
/* Functions for dynamically reading and writing endian-specific values */
|
||||
|
||||
Uint8
|
||||
|
||||
Reference in New Issue
Block a user