Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' to fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
cyniphile committed Dec 22, 2023
2 parents 3a2dc45 + 6ef3b44 commit ddb6a6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pypdfium2 includes helpers to simplify common use cases, while the raw PDFium/ct
```bash
# Call ctypesgen (see --help or packaging_base.py::run_ctypesgen() for further options)
# Reminder: you'll want to use the pypdfium2-team fork of ctypesgen
ctypesgen --library pdfium --runtime-libdirs $MY_LIBDIRS --headers $MY_INCLUDE_DIR/fpdf*.h -o src/pypdfium2_raw/bindings.py --strip-build-path=. --no-srcinfo [-D $MY_FLAGS]
ctypesgen --library pdfium --runtime-libdirs $MY_LIBDIRS --headers $MY_INCLUDE_DIR/fpdf*.h -o src/pypdfium2_raw/bindings.py --strip-build-path=. [-D $MY_FLAGS]
# Write the version file (fill the placeholders).
# Note, this is not a mature interface yet and might change!
Expand Down
4 changes: 2 additions & 2 deletions setupsrc/pypdfium2_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def run_ctypesgen(target_dir, headers_dir, flags=[], guard_symbols=False, compil
assert getattr(ctypesgen, "PYPDFIUM2_SPECIFIC", False), "pypdfium2 requires fork of ctypesgen"
import ctypesgen.__main__

args = ["--library", "pdfium", "--no-srcinfo", "--no-macro-guards"]
args = ["--library", "pdfium", "--no-macro-guards"]

if run_lds:
args += ["--runtime-libdirs", *run_lds]
Expand All @@ -455,7 +455,7 @@ def run_ctypesgen(target_dir, headers_dir, flags=[], guard_symbols=False, compil

# try to exclude some garbage aliases that get pulled in from struct tags
# (this captures anything that ends with _, _t, or begins with _, and is not needed by other symbols)
args += ["--symbol-rules", "if_needed=\w+_$|\w+_t$|_\w+"]
args += ["--symbol-rules", r"if_needed=\w+_$|\w+_t$|_\w+"]

bindings = target_dir / BindingsFN
args += ["--headers"] + [h.name for h in sorted(headers_dir.glob("*.h"))] + ["-o", bindings]
Expand Down
6 changes: 3 additions & 3 deletions src/pypdfium2/_helpers/bitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def from_raw(cls, raw, rev_byteorder=False, ex_buffer=None):

if ex_buffer is None:
needs_free = True
first_item = pdfium_c.FPDFBitmap_GetBuffer(raw)
if first_item.value is None:
buffer_ptr = pdfium_c.FPDFBitmap_GetBuffer(raw)
if buffer_ptr is None:
raise PdfiumError("Failed to get bitmap buffer (null pointer returned)")
buffer = ctypes.cast(first_item, ctypes.POINTER(ctypes.c_ubyte * (stride * height))).contents
buffer = ctypes.cast(buffer_ptr, ctypes.POINTER(ctypes.c_ubyte * (stride * height))).contents
else:
needs_free = False
buffer = ex_buffer
Expand Down

0 comments on commit ddb6a6a

Please sign in to comment.