Skip to content

Conversation

@jbaiter
Copy link
Contributor

@jbaiter jbaiter commented Aug 19, 2025

Previously the offset was mistyped as a *void/MemorySegment. It was now changed to be a gint64/long. Additionally, the int whence parameter was replaced with a new SeekWhence enum that provides more type safety and discoverability for implementers.

To test, a sample was added to provide a VCustomSource based on a FileHandle that implements seeking, testing it against a TIF image.

I also tried testing it against a JP2 conversion of fox.jpg, but for some reason that did not work with any of the VSource implementations, including file-based ones, so the bug is probably elsewhere (possibly in the libvips jp2k foreign loader code that tries to detect jp2 files).

@jbaiter jbaiter force-pushed the fix-custom-source-seek branch from 3c7f948 to 41e80dc Compare August 19, 2025 08:04
Previously the offset was mistyped as a `*void`/`MemorySegment`. It was now
changed to be a `gint64`/`long`. Additionally, the `int whence`
parameter was replaced with a new `SeekWhence` enum that provides more
type safety and discoverability for implementers.

To test, a sample was added to provide a `VCustomSource` based on a
`FileHandle` that implements seeking, testing it against a TIF image.
@jbaiter jbaiter force-pushed the fix-custom-source-seek branch from 41e80dc to 6eab6da Compare August 19, 2025 08:04
@lopcode
Copy link
Owner

lopcode commented Aug 19, 2025

Looks great, thanks @jbaiter!

Could you also run ./generate_ffm_bindings.sh to make sure that the generated docs are updated in this PR, please? Otherwise, I'd be happy to merge and do another pass myself.

@jbaiter
Copy link
Contributor Author

jbaiter commented Aug 19, 2025

Done, sorry that the diff got so unwieldy, but the new enum changed the odd/even CSS classes on quite a bunch of entries 😅

I also had to heavily modify (not included in this PR) the various scripts in the repository to be able to generate the bindings on my Linux/x86-64 machine. Would you be open to a PR that updated the scripts to be cross-platform? Or maybe even run stuff like jextract in a Docker container to have a more controlled/portable environment?

@lopcode
Copy link
Owner

lopcode commented Aug 19, 2025

Yes, definitely open to cross-platform improvements in the generation scripts!

I like the idea of doing it with a Docker container - I think it would be good to standardise the generation based on something known/stable, like a Debian image.

No worries about the diff being larger, the doc generation always ends up like that 👍

@lopcode lopcode enabled auto-merge (squash) August 19, 2025 19:20
@lopcode lopcode merged commit 0e06416 into lopcode:main Aug 19, 2025
7 checks passed
@lopcode
Copy link
Owner

lopcode commented Aug 19, 2025

@jbaiter This is now published as v1.9.0, and making its way to Maven Central in the next 30 minutes or so: https://github.com/lopcode/vips-ffm/releases/tag/v1.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants