Question about using physfsrwops.c

I got creating SDL_RWops from a ZIP file working with physfsrwops.c

I have two little problems:

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.

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

Ok 1) could be solved by using gcc -D option,

-DSUPPORT_PHYSFS

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

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 DOn Mon, Mar 23, 2015 at 10:27 AM, sanitowi <michael.straube1 at gmx.de> wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, the files were from another project.

I didn’t know the files are in the folder /extras in the physfs sources. :lol:

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?