The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Question about using physfsrwops.c
sanitowi


Joined: 22 Jan 2015
Posts: 10
I got creating SDL_RWops from a ZIP file working with physfsrwops.c

I have two little problems:


1)
in physfsrwops.c I removed

Code:

#if SUPPORT_PHYSFS
..
..
#endif

Otherwise I get "undefined reference to ..." errors.
How and where can I set/ define SUPPORT_PHYSFS ?

I tried to add
Code:

#define SUPPORT_PHYSFS

in my file which includes physfsrwops.h, but that does not work.


2)
I get some compiler warnings "warning: assignment from incompatible pointer type"

from the create_rwops function in physfsrwops.c
Code:

static SDL_RWops *create_rwops(PHYSFS_file *handle)
{
    SDL_RWops *retval = NULL;

    if (handle == NULL)
        SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
    else
    {
        retval = SDL_AllocRW();
        if (retval != NULL)
        {
        ## retval->seek  = physfsrwops_seek;
        ## retval->read  = physfsrwops_read;
        ## retval->write = physfsrwops_write;
            retval->close = physfsrwops_close;
            retval->hidden.unknown.data1 = handle;
        } /* if */
    } /* else */

    return(retval);
} /* create_rwops */

The marked lines (##) are the ones producing the warnings.

It's a C++11 project. Compiler GCC 4.9.2
sanitowi


Joined: 22 Jan 2015
Posts: 10
Ok 1) could be solved by using gcc -D option,

-DSUPPORT_PHYSFS

or just delete the #if SUPPORT_PHYSFS, as I did first...
Question about using physfsrwops.c
Jonny D


Joined: 12 Sep 2009
Posts: 932
SUPPORT_PHYSFS sounds quite project-specific and not in the style of PhysFS's defines.  In other words, there is no SUPPORT_PHYSFS.  I suspect that you got the PhysFS/physfsrwops source from someone who modified it and has therefore desynced from upstream.  Get it from the hg repo instead:https://hg.icculus.org/icculus/physfs





Jonny D






On Mon, Mar 23, 2015 at 10:27 AM, sanitowi wrote:
Quote:
Ok 1) could be solved by using gcc -D option,

-DSUPPORT_PHYSFS

or just delete the #if SUPPORT_PHYSFS, as I did first...


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

sanitowi


Joined: 22 Jan 2015
Posts: 10
Yes, the files were from another project.

I didn't know the files are in the folder /extras in the physfs sources. Laughing

Know I use the ones shipped with the sources I build the physfs libs from...


Is there any chance to get rid of the "assignment from incompatible pointer type" warnings?