Skip to content

Fix build warnings #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2024
Merged

Fix build warnings #55

merged 2 commits into from
Oct 12, 2024

Conversation

remicollet
Copy link
Contributor

Unused variable:

/work/GIT/pecl-and-ext/vips/vips.c:1806:15: warning: unused variable 'gtype' [-Wunused-variable]
 1806 |         GType gtype;
      |               ^~~~~

Deprecated call

/work/GIT/pecl-and-ext/vips/vips.c:1978:9: warning: implicit declaration of function 'vips_snprintf'; did you mean 'vips_shrinkv'? [-Wimplicit-function-declaration]
 1978 |         vips_snprintf(digits, 256, "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
      |         ^~~~~~~~~~~~~
      |         vips_shrinkv

vips_snprintf is deprecated (vips 8.16), so simpler to use php version.

Notice: include almostdeprecated.h generates ton of errors

@@ -1973,7 +1972,7 @@ PHP_FUNCTION(vips_version)
{
char digits[256];

vips_snprintf(digits, 256, "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
snprintf(digits, 256, "%d.%d.%d", vips_version(0), vips_version(1), vips_version(2));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be g_snprintf(). It has the same guarantees about null-terminations as the old vips_snprintf() function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use snprintf which is commonly used in php-src ;)

Feel free to change it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snprintf() doesn't guarantee to null-terminate the output string, unfortunately, so it's a common source of buffer overflows. I'll merge this PR, then swap the snprintf()s for g_snprintf().

@jcupitt
Copy link
Member

jcupitt commented Oct 11, 2024

Hi @remicollet, thanks for this.

This module is only for the (mostly) unmaintained php-vips 1.x, do people still use this? php-vips 2.0+ uses php ffi instead.

@remicollet
Copy link
Contributor Author

This module is only for the (mostly) unmaintained php-vips 1.x, do people still use this? php-vips 2.0+ uses php ffi instead.

I was not aware of this
I created RPM package of this ext because list as maintained on pecl.php.net (and IIRC requested by some users)

I will keep this is in mind in the future, and won't try to provide it for newer PHP versions if broken (for now, it still works with 8.4)

Perhaps you should check the"unmaintained" box on pecl (btw, pecl will probably disappear... replaced by pie... so...)

@jcupitt
Copy link
Member

jcupitt commented Oct 12, 2024

Yes, pecl has been about to go away for 10 years now. It's one of the reasons we moved to ffi instead. Plus ffi works on windows, which can be useful.

It's not really unmaintained, but there's certainly no new development!

@jcupitt jcupitt merged commit 8d91d61 into libvips:master Oct 12, 2024
@remicollet remicollet deleted the issue-deprecated branch October 12, 2024 16:06
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