Skip to content

Fix CGPDFContextCreateWithURL JNI binding for macOS compilation#18

Draft
Copilot wants to merge 2 commits intopdf_macfrom
copilot/fix-mac-pdf-support-issues
Draft

Fix CGPDFContextCreateWithURL JNI binding for macOS compilation#18
Copilot wants to merge 2 commits intopdf_macfrom
copilot/fix-mac-pdf-support-issues

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 14, 2025

The macOS native code for PDF support failed to compile due to incorrect JNI parameter marshalling in CGPDFContextCreateWithURL.

Changes

  • OS.java: Changed mediaBox parameter annotation from flags=struct to cast=(const CGRect *) to match the macOS API signature
  • os.c: Updated generated JNI code to pass pointer directly instead of dereferencing

Technical Detail

The JNI generator was dereferencing the CGRect pointer when the Core Graphics API expects a pointer:

// Before (compilation error)
rc = CGPDFContextCreateWithURL((CFURLRef)arg0, *lparg1, (CFDictionaryRef)arg2);

// After (matches API signature)
rc = CGPDFContextCreateWithURL((CFURLRef)arg0, (const CGRect *)lparg1, (CFDictionaryRef)arg2);

API signature: CGPDFContextCreateWithURL(CFURLRef url, const CGRect * __nullable mediaBox, CFDictionaryRef __nullable auxiliaryInfo)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ci.eclipse.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

We have some problem with the mac part of the PDF support, so I tried to prepare your environment that it runs on a mac, can you check if that has worked? Then check the errors in https://ci.eclipse.org/releng/job/eclipse.platform.swt/job/PR-2882/1/consoleText and fix them.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Changed the mediaBox parameter from 'flags=struct' to 'cast=(const CGRect *)' in OS.java
and updated the corresponding os.c generated code to pass lparg1 as a pointer instead of
dereferencing it. This fixes the compilation error on macOS where the API expects a pointer
to CGRect, not the struct itself.

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix errors in PDF support on mac environment Fix CGPDFContextCreateWithURL JNI binding for macOS compilation Dec 14, 2025
Copilot AI requested a review from laeubi December 14, 2025 11:52
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