diff options
Diffstat (limited to 'ext/gd/libgd')
-rw-r--r-- | ext/gd/libgd/gd_compat.c | 36 | ||||
-rw-r--r-- | ext/gd/libgd/gd_compat.h | 3 |
2 files changed, 39 insertions, 0 deletions
diff --git a/ext/gd/libgd/gd_compat.c b/ext/gd/libgd/gd_compat.c index b56329029e..f3627a1404 100644 --- a/ext/gd/libgd/gd_compat.c +++ b/ext/gd/libgd/gd_compat.c @@ -33,6 +33,7 @@ const char * gdPngGetVersionString() } #endif +/* Not exported by libgd, copied from gdhelpers.h */ int overflow2(int a, int b) { if(a <= 0 || b <= 0) { @@ -44,3 +45,38 @@ int overflow2(int a, int b) 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); +} + diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h index 779e709a63..e8fedf80c5 100644 --- a/ext/gd/libgd/gd_compat.h +++ b/ext/gd/libgd/gd_compat.h @@ -11,6 +11,9 @@ const char * gdPngGetVersionString(); 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 * |