[physfs] Questions about PHYSFS_Io and mistake in its docs

v v19930312 at gmail.com
Sun Dec 13 04:55:24 EST 2020


I recently had to use PHYSFS_Io to wrap SDL's RWops to read assets on
special platforms like Android, where simple stdio can't access them.
This left me with few remarks and questions:

1. PHYSFS_Io::duplicate documentation lies about what it returns:
> A new value for a stream's (opaque) field, or NULL on error.

It's obvious from return type (struct PHYSFS_Io*) that it, in fact,
returns new PHYSFS_Io instance.

I had to dig into PhysFS code to understand how
allocations/deallocations work for PHYSFS_Io, so perhaps notes that
`duplicate` must allocate space for new instance and `destroy` must
deallocate it would be helpful.

2. How good should our duplicate be? Should it just provide access to
the same resource, or should it also be in the same position of the
stream (so tell's will give the same result)?

This probably should be clarified in docs as well.

3. What's the point of `write` field? It seems to be more or less
useless when it comes to processing archives, since they are R/O
anyways. Does PHYSFS_Io have more uses than providing access to
archives?

Thanks!
-- 
v <v19930312 at gmail.com>



More information about the physfs mailing list