pbc icon indicating copy to clipboard operation
pbc copied to clipboard

fix: z_from_bytes func signature error

Open Summer-Field opened this issue 5 months ago • 1 comments

When I build pbc lib on my Mac M2 Pro.

I got this error message:

arith/multiz.c:563:17: error: incompatible function pointer types assigning to 'int (*)(element_ptr, const unsigned char *)' (aka 'int (*)(struct element_s *, const unsigned char *)') from 'int (struct element_s *, unsigned char *)' [-Wincompatible-function-pointer-types]
  f->from_bytes = z_from_bytes;

It seems that the signature of z_from_bytes in arith/multiz.c and arith/z.c did not match with the function pointer f->from_bytes's signature defined in include/pbc_field.h

Thus, I make the following changes to fix this:

  1. add const to z_from_bytes's data variable to match the function signature
  2. use temporary pointer ptr to handle the neg operation

Summer-Field avatar Sep 03 '24 01:09 Summer-Field