provide getbmi and skipheader not exported functions in gd_compat.
} else if (!memcmp(data, php_sig_gif, 3)) {
return PHP_GDIMG_TYPE_GIF;
}
-/* Temporary disabled, as gdGetC, getmbi and skipheader not exported in system libgd */
-#if HAVE_GD_BUNDLED
#ifdef HAVE_GD_WBMP
else {
gdIOCtx *io_ctx;
io_ctx = gdNewDynamicCtxEx(8, data, 0);
if (io_ctx) {
- if (getmbi((int(*)(void *)) gdGetC, io_ctx) == 0 && skipheader((int(*)(void *)) gdGetC, io_ctx) == 0 ) {
+ if (getmbi((int(*)(void *)) io_ctx->getC, io_ctx) == 0 && skipheader((int(*)(void *)) io_ctx->getC, io_ctx) == 0 ) {
#if HAVE_LIBGD204
io_ctx->gd_free(io_ctx);
#else
}
}
}
-#endif
#endif
return -1;
#endif
}
#endif
+/* Not exported by libgd, copied from gdhelpers.h */
int overflow2(int a, int b)
{
if(a <= 0 || b <= 0) {
return 0;
}
+/* Not exported by libgd, copied from wbmp.c */
+int
+getmbi (int (*getin) (void *in), void *in)
+{
+ int i, mbi = 0;
+
+ do
+ {
+ i = getin (in);
+ if (i < 0)
+ return (-1);
+ mbi = (mbi << 7) | (i & 0x7f);
+ }
+ while (i & 0x80);
+
+ return (mbi);
+}
+
+/* Not exported by libgd, copied from wbmp.c */
+int
+skipheader (int (*getin) (void *in), void *in)
+{
+ int i;
+
+ do
+ {
+ i = getin (in);
+ if (i < 0)
+ return (-1);
+ }
+ while (i & 0x80);
+
+ return (0);
+}
+
const char * gdJpegGetVersionString();
int gdJpegGetVersionInt();
int overflow2(int a, int b);
+int getmbi (int (*getin) (void *in), void *in);
+int skipheader (int (*getin) (void *in), void *in);
+
/* filters section
*