haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
524 stars 63 forks source link

pl_lut_free #200

Open Asd-g opened 9 months ago

Asd-g commented 9 months ago

pl_lut_free expects non-const pl_custom_lut but pl_render_params->lut is const. This causes building error.

haasn commented 9 months ago

I don't understand this issue. Building error where? In libplacebo? In your code?

kasper93 commented 9 months ago

As I understand, they do something like

struct pl_render_params rrp;
...
rrp->lut = ...;
...
pl_lut_free(&rrp->lut);

which fails for them.

Asd-g commented 9 months ago

As I understand, they do something like

struct pl_render_params rrp;
...
rrp->lut = ...;
...
pl_lut_free(&rrp->lut);

which fails for them.

Yes, that's the use case.

MSVC doesn't complain but clang-cl fails (requires explicitly const casting).

kasper93 commented 4 months ago

I can also complain about similar thing, it is annoying that pl_color_repr::dovi is const pointer, especially that it is managed by user.

warning: passing 'typeof (new->params.repr.dovi)' (aka 'const struct pl_dovi_metadata *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  355 |     new->params.repr.dovi = talloc_dup(new, new->params.repr.dovi);
warning: passing 'const struct pl_dovi_metadata *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
 1135 |     talloc_free(dst->params.repr.dovi);

Just need pointless casts :)