diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-12-28 20:11:08 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-12-28 20:11:08 +0000 |
commit | 36db28c8db6febd27c2903d9d21407f42b6a2091 (patch) | |
tree | 883bfede4347d2b56061c8f9aaeab1ddbea1406e /ext/gd | |
parent | e29f589d46ce2ec64c6b4b6c71b8ad18f792b1db (diff) | |
download | php-git-36db28c8db6febd27c2903d9d21407f42b6a2091.tar.gz |
CS fixes.
Diffstat (limited to 'ext/gd')
-rw-r--r-- | ext/gd/libgd/gd.c | 210 | ||||
-rw-r--r-- | ext/gd/libgd/gd.h | 60 | ||||
-rw-r--r-- | ext/gd/libgd/gd_arc_f_buggy.c | 6 | ||||
-rw-r--r-- | ext/gd/libgd/gd_gd.c | 4 | ||||
-rw-r--r-- | ext/gd/libgd/gd_gd2.c | 32 | ||||
-rw-r--r-- | ext/gd/libgd/gd_gif_in.c | 28 | ||||
-rw-r--r-- | ext/gd/libgd/gd_io.h | 2 | ||||
-rw-r--r-- | ext/gd/libgd/gd_io_dp.c | 4 | ||||
-rw-r--r-- | ext/gd/libgd/gd_io_ss.c | 4 | ||||
-rw-r--r-- | ext/gd/libgd/gd_jpeg.c | 18 | ||||
-rw-r--r-- | ext/gd/libgd/gd_png.c | 36 | ||||
-rw-r--r-- | ext/gd/libgd/gd_topal.c | 10 | ||||
-rw-r--r-- | ext/gd/libgd/gd_wbmp.c | 12 | ||||
-rw-r--r-- | ext/gd/libgd/gdcache.c | 16 | ||||
-rw-r--r-- | ext/gd/libgd/gdcache.h | 16 | ||||
-rw-r--r-- | ext/gd/libgd/gdft.c | 665 | ||||
-rw-r--r-- | ext/gd/libgd/gdhelpers.h | 2 | ||||
-rw-r--r-- | ext/gd/libgd/gdkanji.c | 2 | ||||
-rw-r--r-- | ext/gd/libgd/gdxpm.c | 4 | ||||
-rw-r--r-- | ext/gd/libgd/testac.c | 6 | ||||
-rw-r--r-- | ext/gd/libgd/wbmp.c | 6 | ||||
-rw-r--r-- | ext/gd/libgd/wbmp.h | 12 | ||||
-rw-r--r-- | ext/gd/libgd/webpng.c | 6 | ||||
-rw-r--r-- | ext/gd/libgd/xbm.c | 6 |
24 files changed, 547 insertions, 620 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 4fb3c4f0c8..bf2e5b8f8b 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -96,12 +96,12 @@ static int gdAlphaBlendColor(int b1, int b2, int a1, int a2); static int gdAlphaOverlayColor(int src, int dst, int max); int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y); -void php_gd_error_ex(int type, const char *format, ...) +void php_gd_error_ex(int type, const char *format, ...) { va_list args; - + TSRMLS_FETCH(); - + va_start(args, format); php_verror(NULL, "", type, format, args TSRMLS_CC); va_end(args); @@ -110,9 +110,9 @@ void php_gd_error_ex(int type, const char *format, ...) void php_gd_error(const char *format, ...) { va_list args; - + TSRMLS_FETCH(); - + va_start(args, format); php_verror(NULL, "", E_WARNING, format, args TSRMLS_CC); va_end(args); @@ -267,8 +267,8 @@ int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) } /* This code is taken from http://www.acm.org/jgt/papers/SmithLyons96/hwb_rgb.html, an article - * on colour conversion to/from RBG and HWB colour systems. - * It has been modified to return the converted value as a * parameter. + * on colour conversion to/from RBG and HWB colour systems. + * It has been modified to return the converted value as a * parameter. */ #define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;} @@ -287,8 +287,8 @@ int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) /* - * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure - * red always maps to 6 in this implementation. Therefore UNDEFINED can be + * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure + * red always maps to 6 in this implementation. Therefore UNDEFINED can be * defined as 0 in situations where only unsigned numbers are desired. */ typedef struct @@ -305,8 +305,8 @@ HWBType; static HWBType * RGB_to_HWB (RGBType RGB, HWBType * HWB) { /* - * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is - * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B. + * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is + * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B. */ float R = RGB.R, G = RGB.G, B = RGB.B, w, v, b, f; @@ -320,7 +320,7 @@ static HWBType * RGB_to_HWB (RGBType RGB, HWBType * HWB) } f = (R == w) ? G - B : ((G == w) ? B - R : R - G); i = (R == w) ? 3 : ((G == w) ? 5 : 1); - + RETURN_HWB(i - f / (v - w), w, b); } @@ -363,9 +363,9 @@ static float HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2) */ static RGBType * HWB_to_RGB (HWBType HWB, RGBType * RGB) { - /* - * H is given on [0, 6] or UNDEFINED. W and B are given on [0, 1]. - * RGB are each returned on [0, 1]. + /* + * H is given on [0, 6] or UNDEFINED. W and B are given on [0, 1]. + * RGB are each returned on [0, 1]. */ float h = HWB.H, w = HWB.W, b = HWB.B, v, n, f; @@ -478,7 +478,7 @@ int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a) im->blue[ct] = b; im->alpha[ct] = a; im->open[ct] = 0; - + return ct; } @@ -629,7 +629,7 @@ void gdImagePaletteCopy (gdImagePtr to, gdImagePtr from) * Given the end points of a line, and a bounding rectangle (which we * know to be from (0,0) to (SX,SY)), adjust the endpoints to be on * the edges of the rectangle if the line should be drawn at all, - * otherwise return a failure code + * otherwise return a failure code */ /* this does "one-dimensional" clipping: note that the second time it @@ -637,7 +637,7 @@ void gdImagePaletteCopy (gdImagePtr to, gdImagePtr from) * - the comments ignore this (if you can understand it when it's * looking at the X parameters, it should become clear what happens on * the second call!) The code is simplified from that in the article, - * as we know that gd images always start at (0,0) + * as we know that gd images always start at (0,0) */ static int clip_1d(int *x0, int *y0, int *x1, int *y1, int maxdim) { @@ -664,7 +664,7 @@ static int clip_1d(int *x0, int *y0, int *x1, int *y1, int maxdim) { } m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */ *y0 += (int)(m * (maxdim - *x0)); /* adjust so point is on the right boundary */ - *x0 = maxdim; + *x0 = maxdim; /* now, perhaps, adjust the end of the line */ if (*x1 < 0) { *y1 -= (int)(m * *x1); @@ -780,7 +780,7 @@ static void gdImageBrushApply (gdImagePtr im, int x, int y) x1 = x - hx; x2 = x1 + gdImageSX(im->brush); srcy = 0; - + if (im->trueColor) { if (im->brush->trueColor) { for (ly = y1; ly < y2; ly++) { @@ -823,8 +823,8 @@ static void gdImageBrushApply (gdImagePtr im, int x, int y) if (p != gdImageGetTransparent(im->brush)) { /* Truecolor brush. Very slow on a palette destination. */ if (im->brush->trueColor) { - gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), - gdTrueColorGetGreen(p), + gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), + gdTrueColorGetGreen(p), gdTrueColorGetBlue(p), gdTrueColorGetAlpha(p))); } else { @@ -903,8 +903,8 @@ static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) float p_dist, p_alpha; unsigned char opacity; - /* - * Find the perpendicular distance from point C (px, py) to the line + /* + * Find the perpendicular distance from point C (px, py) to the line * segment AB that is being drawn. (Adapted from an algorithm from the * comp.graphics.algorithms FAQ.) */ @@ -918,7 +918,7 @@ static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) int By_Cy = im->AAL_y2 - py; /* 2.0.13: bounds check! AA_opacity is just as capable of - * overflowing as the main pixel array. Arne Jorgensen. + * overflowing as the main pixel array. Arne Jorgensen. * 2.0.14: typo fixed. 2.0.15: moved down below declarations * to satisfy non-C++ compilers. */ @@ -931,12 +931,12 @@ static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py) LBC_2 = (Bx_Cx * Bx_Cx) + (By_Cy * By_Cy); if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) { - /* The two angles are acute. The point lies inside the portion of the + /* The two angles are acute. The point lies inside the portion of the * plane spanned by the line segment. */ p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB); } else { - /* The point is past an end of the line segment. It's length from the + /* The point is past an end of the line segment. It's length from the * segment is the shorter of the lengths from the endpoints, but call * the distance -1, so as not to compute the alpha nor draw the pixel. */ @@ -1045,11 +1045,11 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) im->AAL_LAB = sqrt (im->AAL_LAB_2); /* For AA, we must draw pixels outside the width of the line. Keep in - * mind that this will be curtailed by cos/sin of theta later. + * mind that this will be curtailed by cos/sin of theta later. */ thick += 4; } - + dx = abs(x2 - x1); dy = abs(y2 - y1); if (dy <= dx) { @@ -1115,7 +1115,7 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) } } else { /* More-or-less vertical. use wid for horizontal stroke */ - /* 2.0.12: Michael Schwartz: divide rather than multiply; + /* 2.0.12: Michael Schwartz: divide rather than multiply; TBB: but watch out for /0! */ double as = sin(atan2(dy, dx)); if (as != 0) { @@ -1207,7 +1207,7 @@ inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color BLEND_COLOR(t, dg, g, dg); BLEND_COLOR(t, db, b, db); im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); -} +} /* * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) @@ -1582,9 +1582,9 @@ long lsqrt (long n) /* s and e are integers modulo 360 (degrees), with 0 degrees being the rightmost extreme and degrees changing clockwise. - cx and cy are the center in pixels; w and h are the horizontal + cx and cy are the center in pixels; w and h are the horizontal and vertical diameter in pixels. Nice interface, but slow. - See gd_arc_f_buggy.c for a better version that doesn't + See gd_arc_f_buggy.c for a better version that doesn't seem to be bug-free yet. */ void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) @@ -2023,10 +2023,10 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color) { int x, y; - + /* Nick Atty: limit the points at the edge. Note that this also * nicely kills any plotting for rectangles completely outside the - * window as it makes the tests in the for loops fail + * window as it makes the tests in the for loops fail */ if (x1 < 0) { x1 = 0; @@ -2059,9 +2059,9 @@ void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, if (dst->trueColor) { /* 2.0: much easier when the destination is truecolor. */ /* 2.0.10: needs a transparent-index check that is still valid if - * the source is not truecolor. Thanks to Frank Warmerdam. + * the source is not truecolor. Thanks to Frank Warmerdam. */ - + if (src->trueColor) { for (y = 0; (y < h); y++) { for (x = 0; (x < w); x++) { @@ -2122,7 +2122,7 @@ void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, /* Have we established a mapping for this color? */ if (src->trueColor) { /* 2.05: remap to the palette available in the destination image. This is slow and - * works badly, but it beats crashing! Thanks to Padhrig McCarthy. + * works badly, but it beats crashing! Thanks to Padhrig McCarthy. */ mapTo = gdImageColorResolveAlpha (dst, gdTrueColorGetRed (c), gdTrueColorGetGreen (c), gdTrueColorGetBlue (c), gdTrueColorGetAlpha (c)); } else if (colorMap[c] == (-1)) { @@ -2134,9 +2134,9 @@ void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, nc = gdImageColorResolveAlpha (dst, src->red[c], src->green[c], src->blue[c], src->alpha[c]); } colorMap[c] = nc; - mapTo = colorMap[c]; + mapTo = colorMap[c]; } else { - mapTo = colorMap[c]; + mapTo = colorMap[c]; } gdImageSetPixel (dst, tox, toy, mapTo); tox++; @@ -2206,10 +2206,10 @@ void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i tox++; continue; } - /* - * If it's the same image, mapping is NOT trivial since we - * merge with greyscale target, but if pct is 100, the grey - * value is not used, so it becomes trivial. pjw 2.0.12. + /* + * If it's the same image, mapping is NOT trivial since we + * merge with greyscale target, but if pct is 100, the grey + * value is not used, so it becomes trivial. pjw 2.0.12. */ if (dst == src && pct == 100) { nc = c; @@ -2254,7 +2254,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int stx = (int *) gdMalloc (sizeof (int) * srcW); sty = (int *) gdMalloc (sizeof (int) * srcH); accum = 0; - + /* Fixed by Mao Morimoto 2.0.16 */ for (i = 0; (i < srcW); i++) { stx[i] = dstW * (i+1) / srcW - dstW * i / srcW ; @@ -2283,7 +2283,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int if (gdImageGetTransparent (src) == tmp) { tox++; continue; - } + } } else { /* TK: old code follows */ mapTo = gdImageGetTrueColorPixel (src, x, y); @@ -2292,7 +2292,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int tox++; continue; } - } + } } else { c = gdImageGetPixel (src, x, y); /* Added 7/24/95: support transparent copies */ @@ -2392,7 +2392,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i } pcontribution = xportion * yportion; p = gdImageGetTrueColorPixel(src, (int) sx + srcX, (int) sy + srcY); - + alpha_factor = ((gdAlphaMax - gdTrueColorGetAlpha(p))) * pcontribution; red += gdTrueColorGetRed (p) * alpha_factor; green += gdTrueColorGetGreen (p) * alpha_factor; @@ -2404,12 +2404,12 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i sx += 1.0f; } while (sx < sx2); - + sy += 1.0f; } - + while (sy < sy2); - + if (spixels != 0.0f) { red /= spixels; green /= spixels; @@ -2419,7 +2419,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i if ( alpha_sum != 0.0f) { if( contrib_sum != 0.0f) { alpha_sum /= contrib_sum; - } + } red /= alpha_sum; green /= alpha_sum; blue /= alpha_sum; @@ -2444,7 +2444,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i /* - * Rotate function Added on 2003/12 + * Rotate function Added on 2003/12 * by Pierre-Alain Joye (pajoye@pearfr.org) **/ /* Begin rotate function */ @@ -2990,7 +2990,7 @@ void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) } else { fill_color = c; } - + if (!im->polyAllocated) { im->polyInts = (int *) gdMalloc(sizeof(int) * n); im->polyAllocated = n; @@ -3018,7 +3018,7 @@ void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) } if (maxy >= gdImageSY(im)) { maxy = gdImageSY(im) - 1; - } + } /* Fix in 1.3: count a vertex only once */ for (y = miny; y <= maxy; y++) { @@ -3212,7 +3212,7 @@ int gdImageCompare (gdImagePtr im1, gdImagePtr im2) int gdAlphaBlend (int dst, int src) { - /* 2.0.12: TBB: alpha in the destination should be a + /* 2.0.12: TBB: alpha in the destination should be a * component of the result. Thanks to Frank Warmerdam for * pointing out the issue. */ @@ -3302,12 +3302,12 @@ static int gdLayerOverlay (int dst, int src) static int gdAlphaOverlayColor (int src, int dst, int max ) { /* this function implements the algorithm - * + * * for dst[rgb] < 0.5, * c[rgb] = 2.src[rgb].dst[rgb] * and for dst[rgb] > 0.5, * c[rgb] = -2.src[rgb].dst[rgb] + 2.dst[rgb] + 2.src[rgb] - 1 - * + * */ dst = dst << 1; @@ -3361,7 +3361,7 @@ void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) } -/* Filters function added on 2003/12 +/* Filters function added on 2003/12 * by Pierre-Alain Joye (pajoye@pearfr.org) **/ /* Begin filters function */ @@ -3381,7 +3381,7 @@ int gdImageNegate(gdImagePtr src) if (src==NULL) { return 0; } - + f = GET_PIXEL_FUNCTION(src); for (y=0; y<src->sy; ++y) { @@ -3391,7 +3391,7 @@ int gdImageNegate(gdImagePtr src) g = gdImageGreen(src, pxl); b = gdImageBlue(src, pxl); a = gdImageAlpha(src, pxl); - + new_pxl = gdImageColorAllocateAlpha(src, 255-r, 255-g, 255-b, a); if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, 255-r, 255-g, 255-b, a); @@ -3452,7 +3452,7 @@ int gdImageBrightness(gdImagePtr src, int brightness) if (src==NULL || (brightness < -255 || brightness>255)) { return 0; } - + if (brightness==0) { return 1; } @@ -3460,16 +3460,16 @@ int gdImageBrightness(gdImagePtr src, int brightness) for (y=0; y<src->sy; ++y) { for (x=0; x<src->sx; ++x) { pxl = f (src, x, y); - + r = gdImageRed(src, pxl); g = gdImageGreen(src, pxl); b = gdImageBlue(src, pxl); a = gdImageAlpha(src, pxl); - + r = r + brightness; g = g + brightness; b = b + brightness; - + r = (r > 255)? 255 : ((r < 0)? 0:r); g = (g > 255)? 255 : ((g < 0)? 0:g); b = (b > 255)? 255 : ((b < 0)? 0:b); @@ -3501,14 +3501,14 @@ int gdImageContrast(gdImagePtr src, double contrast) if (src==NULL) { return 0; } - + contrast = (double)(100.0-contrast)/100.0; contrast = contrast*contrast; - + for (y=0; y<src->sy; ++y) { for (x=0; x<src->sx; ++x) { - pxl = f(src, x, y); - + pxl = f(src, x, y); + r = gdImageRed(src, pxl); g = gdImageGreen(src, pxl); b = gdImageBlue(src, pxl); @@ -3525,7 +3525,7 @@ int gdImageContrast(gdImagePtr src, double contrast) bf = bf*contrast; bf = bf+0.5; bf = bf*255.0; - + gf = (double)g/255.0; gf = gf-0.5; gf = gf*contrast; @@ -3560,12 +3560,12 @@ int gdImageColor(gdImagePtr src, int red, int green, int blue) if (src==NULL || (red<-255||red>255) || (green<-255||green>255) || (blue<-255||blue>255)) { return 0; } - + f = GET_PIXEL_FUNCTION(src); - + for (y=0; y<src->sy; ++y) { for (x=0; x<src->sx; ++x) { - pxl = f(src, x, y); + pxl = f(src, x, y); r = gdImageRed(src, pxl); g = gdImageGreen(src, pxl); b = gdImageBlue(src, pxl); @@ -3607,7 +3607,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo /* We need the orinal image with each safe neoghb. pixel */ srcback = gdImageCreateTrueColor (src->sx, src->sy); gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); - + if (srcback==NULL) { return 0; } @@ -3618,16 +3618,16 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo for(x=0; x<src->sx; x++) { new_r = new_g = new_b = 0; new_a = gdImageAlpha(srcback, pxl); - + for (j=0; j<3; j++) { for (i=0; i<3; i++) { - pxl = f(srcback, x-(3>>1)+i, y-(3>>1)+j); + pxl = f(srcback, x-(3>>1)+i, y-(3>>1)+j); new_r += (float)gdImageRed(srcback, pxl) * filter[j][i]; new_g += (float)gdImageGreen(srcback, pxl) * filter[j][i]; new_b += (float)gdImageBlue(srcback, pxl) * filter[j][i]; } - } - + } + new_r = (new_r/filter_div)+offset; new_g = (new_g/filter_div)+offset; new_b = (new_b/filter_div)+offset; @@ -3645,8 +3645,8 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo } } } - gdImageDestroy(srcback); - return 1; + gdImageDestroy(srcback); + return 1; } int gdImageSelectiveBlur( gdImagePtr src) @@ -3666,11 +3666,11 @@ int gdImageSelectiveBlur( gdImagePtr src) if (src==NULL) { return 0; } - + /* We need the orinal image with each safe neoghb. pixel */ srcback = gdImageCreateTrueColor (src->sx, src->sy); gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); - + if (srcback==NULL) { return 0; } @@ -3680,72 +3680,72 @@ int gdImageSelectiveBlur( gdImagePtr src) for(y = 0; y<src->sy; y++) { for (x=0; x<src->sx; x++) { flt_r_sum = flt_g_sum = flt_b_sum = 0.0; - cpxl = f(src, x, y); + cpxl = f(src, x, y); for (j=0; j<3; j++) { for (i=0; i<3; i++) { if ((j == 1) && (i == 1)) { flt_r[1][1] = flt_g[1][1] = flt_b[1][1] = 0.5; } else { - pxl = f(src, x-(3>>1)+i, y-(3>>1)+j); + pxl = f(src, x-(3>>1)+i, y-(3>>1)+j); new_a = gdImageAlpha(srcback, pxl); new_r = ((float)gdImageRed(srcback, cpxl)) - ((float)gdImageRed (srcback, pxl)); - + if (new_r < 0.0f) { new_r = -new_r; - } + } if (new_r != 0) { flt_r[j][i] = 1.0f/new_r; } else { flt_r[j][i] = 1.0f; - } + } new_g = ((float)gdImageGreen(srcback, cpxl)) - ((float)gdImageGreen(srcback, pxl)); - + if (new_g < 0.0f) { new_g = -new_g; - } + } if (new_g != 0) { flt_g[j][i] = 1.0f/new_g; } else { flt_g[j][i] = 1.0f; - } + } new_b = ((float)gdImageBlue(srcback, cpxl)) - ((float)gdImageBlue(srcback, pxl)); if (new_b < 0.0f) { new_b = -new_b; - } + } if (new_b != 0) { flt_b[j][i] = 1.0f/new_b; } else { flt_b[j][i] = 1.0f; } } - + flt_r_sum += flt_r[j][i]; flt_g_sum += flt_g[j][i]; flt_b_sum += flt_b [j][i]; } } - + for (j=0; j<3; j++) { for (i=0; i<3; i++) { if (flt_r_sum != 0.0) { flt_r[j][i] /= flt_r_sum; - } + } if (flt_g_sum != 0.0) { flt_g[j][i] /= flt_g_sum; - } + } if (flt_b_sum != 0.0) { flt_b [j][i] /= flt_b_sum; - } + } } } new_r = new_g = new_b = 0.0; - + for (j=0; j<3; j++) { for (i=0; i<3; i++) { pxl = f(src, x-(3>>1)+i, y-(3>>1)+j); @@ -3764,7 +3764,7 @@ int gdImageSelectiveBlur( gdImagePtr src) } if ((y >= 0) && (y < src->sy)) { gdImageSetPixel (src, x, y, new_pxl); - } + } } } gdImageDestroy(srcback); @@ -3776,7 +3776,7 @@ int gdImageEdgeDetectQuick(gdImagePtr src) float filter[3][3] = {{1.0,1.0,1.0}, {0.0,0.0,0.0}, {-1.0,-1.0,-1.0}}; - + return gdImageConvolution(src, filter, 1, 127); } @@ -3785,8 +3785,8 @@ int gdImageGaussianBlur(gdImagePtr im) float filter[3][3] = {{1.0,2.0,1.0}, {2.0,4.0,2.0}, {1.0,2.0,1.0}}; - - return gdImageConvolution(im, filter, 16, 0); + + return gdImageConvolution(im, filter, 16, 0); } int gdImageEmboss(gdImagePtr im) @@ -3794,7 +3794,7 @@ int gdImageEmboss(gdImagePtr im) float filter[3][3] = {{-1.0,0.0,-1.0}, {0.0,4.0,0.0}, {-1.0,0.0,-1.0}}; - + return gdImageConvolution(im, filter, 1, 127); } @@ -3803,7 +3803,7 @@ int gdImageMeanRemoval(gdImagePtr im) float filter[3][3] = {{-1.0,-1.0,-1.0}, {-1.0,9.0,-1.0}, {-1.0,-1.0,-1.0}}; - + return gdImageConvolution(im, filter, 1, 0); } @@ -3812,9 +3812,9 @@ int gdImageSmooth(gdImagePtr im, float weight) float filter[3][3] = {{1.0,1.0,1.0}, {1.0,0.0,1.0}, {1.0,1.0,1.0}}; - + filter[1][1] = weight; - + return gdImageConvolution(im, filter, weight+8, 0); } /* End filters function */ diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index 20f5561378..accc257ebc 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -21,8 +21,8 @@ extern "C" { * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation. This software is provided "AS IS." Thomas Boutell and - * Boutell.Com, Inc. disclaim all warranties, either express or implied, - * including but not limited to implied warranties of merchantability and + * Boutell.Com, Inc. disclaim all warranties, either express or implied, + * including but not limited to implied warranties of merchantability and * fitness for a particular purpose, with respect to this code and accompanying * documentation. */ @@ -43,19 +43,19 @@ void php_gd_error(const char *format, ...); /* Image type. See functions below; you will not need to change the elements directly. Use the provided macros to - access sx, sy, the color table, and colorsTotal for + access sx, sy, the color table, and colorsTotal for read-only purposes. */ -/* If 'truecolor' is set true, the image is truecolor; +/* If 'truecolor' is set true, the image is truecolor; pixels are represented by integers, which - must be 32 bits wide or more. + must be 32 bits wide or more. True colors are repsented as follows: ARGB Where 'A' (alpha channel) occupies only the - LOWER 7 BITS of the MSB. This very small + LOWER 7 BITS of the MSB. This very small loss of alpha channel resolution allows gd 2.x to keep backwards compatibility by allowing signed integers to be used to represent colors, @@ -78,7 +78,7 @@ void php_gd_error(const char *format, ...); #define gdEffectOverlay 3 -/* This function accepts truecolor pixel values only. The +/* This function accepts truecolor pixel values only. The source color is composited with the destination color based on the alpha channel value of the source color. The resulting color is opaque. */ @@ -96,11 +96,11 @@ typedef struct gdImageStruct { int colorsTotal; int red[gdMaxColors]; int green[gdMaxColors]; - int blue[gdMaxColors]; + int blue[gdMaxColors]; int open[gdMaxColors]; /* For backwards compatibility, this is set to the first palette entry with 100% transparency, - and is also set and reset by the + and is also set and reset by the gdImageColorTransparent function. Newer applications can allocate palette entries with any desired level of transparency; however, @@ -112,7 +112,7 @@ typedef struct gdImageStruct { int *polyInts; int polyAllocated; struct gdImageStruct *brush; - struct gdImageStruct *tile; + struct gdImageStruct *tile; int brushColorMap[gdMaxColors]; int tileColorMap[gdMaxColors]; int styleLength; @@ -126,10 +126,10 @@ typedef struct gdImageStruct { really support multiple levels of transparency in palettes, to my knowledge, as of 2/15/01. Most common browsers will display 100% opaque and - 100% transparent correctly, and do something + 100% transparent correctly, and do something unpredictable and/or undesirable for levels in between. TBB */ - int alpha[gdMaxColors]; + int alpha[gdMaxColors]; /* Truecolor flag and pixels. New 2.0 fields appear here at the end to minimize breakage of existing object code. */ int trueColor; @@ -137,7 +137,7 @@ typedef struct gdImageStruct { /* Should alpha channel be copied, or applied, each time a pixel is drawn? This applies to truecolor images only. No attempt is made to alpha-blend in palette images, - even if semitransparent palette entries exist. + even if semitransparent palette entries exist. To do that, build your image as a truecolor image, then quantize down to 8 bits. */ int alphaBlendingFlag; @@ -147,7 +147,7 @@ typedef struct gdImageStruct { PNG at the moment; other future formats may also have that capability. JPEG doesn't. */ int saveAlphaFlag; - + /* 2.0.12: anti-aliased globals */ int AA; @@ -156,7 +156,7 @@ typedef struct gdImageStruct { unsigned char **AA_opacity; int AA_polygon; /* Stored and pre-computed variables for determining the perpendicular - * distance from a point to the anti-aliased line being drawn: + * distance from a point to the anti-aliased line being drawn: */ int AAL_x1; int AAL_y1; @@ -230,7 +230,7 @@ gdImagePtr gdImageCreateTrueColor(int sx, int sy); gdImagePtr gdImageCreateFromPng(FILE *fd); gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in); gdImagePtr gdImageCreateFromWBMP(FILE *inFile); -gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile); +gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile); gdImagePtr gdImageCreateFromJpeg(FILE *infile); gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile); @@ -264,11 +264,11 @@ void gdImageDestroy(gdImagePtr im); /* Replaces or blends with the background depending on the most recent call to gdImageAlphaBlending and the - alpha channel value of 'color'; default is to overwrite. + alpha channel value of 'color'; default is to overwrite. Tiling and line styling are also implemented - here. All other gd drawing functions pass through this call, + here. All other gd drawing functions pass through this call, allowing for many useful effects. */ - + void gdImageSetPixel(gdImagePtr im, int x, int y, int color); int gdImageGetPixel(gdImagePtr im, int x, int y); @@ -296,9 +296,9 @@ void gdImageString16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s void gdImageStringUp16(gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color); /* 2.0.16: for thread-safe use of gdImageStringFT and friends, - * call this before allowing any thread to call gdImageStringFT. + * call this before allowing any thread to call gdImageStringFT. * Otherwise it is invoked by the first thread to invoke - * gdImageStringFT, with a very small but real risk of a race condition. + * gdImageStringFT, with a very small but real risk of a race condition. * Return 0 on success, nonzero on failure to initialize freetype. */ int gdFontCacheSetup(void); @@ -347,7 +347,7 @@ typedef struct { void gdImagePolygon(gdImagePtr im, gdPointPtr p, int n, int c); void gdImageFilledPolygon(gdImagePtr im, gdPointPtr p, int n, int c); -/* These functions still work with truecolor images, +/* These functions still work with truecolor images, for which they never return error. */ int gdImageColorAllocate(gdImagePtr im, int r, int g, int b); /* gd 2.0: palette entries with non-opaque transparency are permitted. */ @@ -428,7 +428,7 @@ void gdImagePngCtx(gdImagePtr im, gdIOCtx *out); /* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all, * 1 is FASTEST but produces larger files, 9 provides the best * compression (smallest files) but takes a long time to compress, and - * -1 selects the default compiled into the zlib library. + * -1 selects the default compiled into the zlib library. */ void gdImagePngEx(gdImagePtr im, FILE * out, int level); void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level); @@ -486,7 +486,7 @@ void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); gdArc and gdChord are mutually exclusive; gdChord just connects the starting and ending angles with a straight line, while gdArc produces - a rounded edge. gdPie is a synonym for gdArc. + a rounded edge. gdPie is a synonym for gdArc. gdNoFill indicates that the arc or chord should be outlined, not filled. gdEdged, used together with gdNoFill, indicates that the beginning and ending @@ -505,7 +505,7 @@ void gdImageFilledEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color void gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color); void gdImageFill(gdImagePtr im, int x, int y, int color); void gdImageCopy(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h); -void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, +void gdImageCopyMerge(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct); void gdImageCopyMergeGray(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct); @@ -521,8 +521,8 @@ void gdImageCopyResized(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int destination pixel, taking into account what portion of the destination pixel each source pixel represents. This is a floating point operation, but this is not a performance issue - on modern hardware, except for some embedded devices. If the - destination is a palette image, gdImageCopyResized is + on modern hardware, except for some embedded devices. If the + destination is a palette image, gdImageCopyResized is substituted automatically. */ void gdImageCopyResampled(gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); @@ -537,7 +537,7 @@ void gdImageSetTile(gdImagePtr im, gdImagePtr tile); void gdImageSetAntiAliased(gdImagePtr im, int c); void gdImageSetAntiAliasedDontBlend(gdImagePtr im, int c, int dont_blend); void gdImageSetStyle(gdImagePtr im, int *style, int noOfPixels); -/* Line thickness (defaults to 1). Affects lines, ellipses, +/* Line thickness (defaults to 1). Affects lines, ellipses, rectangles, polygons and so forth. */ void gdImageSetThickness(gdImagePtr im, int thickness); /* On or off (1 or 0) for all three of these. */ @@ -582,7 +582,7 @@ gdIOCtx* gdNewDynamicCtx(int, void*); gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out); void* gdDPExtractData(struct gdIOCtx* ctx, int *size); -#define GD2_CHUNKSIZE 128 +#define GD2_CHUNKSIZE 128 #define GD2_CHUNKSIZE_MIN 64 #define GD2_CHUNKSIZE_MAX 4096 @@ -592,7 +592,7 @@ void* gdDPExtractData(struct gdIOCtx* ctx, int *size); #define GD2_FMT_COMPRESSED 2 -/* filters section +/* filters section * * Negate the imag src, white becomes black, * The red, green, and blue intensities of an image are negated. diff --git a/ext/gd/libgd/gd_arc_f_buggy.c b/ext/gd/libgd/gd_arc_f_buggy.c index 7b8f819079..f51d916e5c 100644 --- a/ext/gd/libgd/gd_arc_f_buggy.c +++ b/ext/gd/libgd/gd_arc_f_buggy.c @@ -1,6 +1,6 @@ /* This is potentially great stuff, but fails against the test - program at the end. This would probably be much more - efficent than the implementation currently in gd.c if the + program at the end. This would probably be much more + efficent than the implementation currently in gd.c if the errors in the output were corrected. TBB */ #if 0 @@ -698,7 +698,7 @@ gdArcClosest (int width, int height, int angle) #define WIDTH 500 #define HEIGHT 300 -int +int main (int argc, char *argv[]) { gdImagePtr im = gdImageCreate (WIDTH, HEIGHT); diff --git a/ext/gd/libgd/gd_gd.c b/ext/gd/libgd/gd_gd.c index e6ef7ff9c3..49e7c58549 100644 --- a/ext/gd/libgd/gd_gd.c +++ b/ext/gd/libgd/gd_gd.c @@ -57,7 +57,7 @@ int _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag) } GD2_DBG(printf("Pallette had %d colours (T=%d)\n", im->colorsTotal, im->transparent)); - + if (im->trueColor) { return TRUE; } @@ -214,7 +214,7 @@ void _gdPutColors (gdImagePtr im, gdIOCtx * out) static void _gdPutHeader (gdImagePtr im, gdIOCtx * out) { - /* 65535 indicates this is a gd 2.x .gd file. + /* 65535 indicates this is a gd 2.x .gd file. * 2.0.12: 65534 indicates truecolor. */ if (im->trueColor) { diff --git a/ext/gd/libgd/gd_gd2.c b/ext/gd/libgd/gd_gd2.c index 2fdbdd44d5..9f9d485d8a 100644 --- a/ext/gd/libgd/gd_gd2.c +++ b/ext/gd/libgd/gd_gd2.c @@ -26,7 +26,7 @@ /* 2.11: not part of the API, as the save routine can figure it out * from im->trueColor, and the load routine doesn't need to tell * the end user the saved format. NOTE: adding 2 is assumed - * to result in the correct format value for truecolor! + * to result in the correct format value for truecolor! */ #define GD2_FMT_TRUECOLOR_RAW 3 #define GD2_FMT_TRUECOLOR_COMPRESSED 4 @@ -220,7 +220,7 @@ static int _gd2ReadChunk (int offset, char *compBuf, int compSize, char *chunkBu return FALSE; } GD2_DBG(php_gd_error("Got chunk\n")); - + return TRUE; } @@ -280,7 +280,7 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in) } chunkBuf = gdCalloc(chunkMax, 1); compBuf = gdCalloc(compMax, 1); - + GD2_DBG(php_gd_error("Largest compressed chunk is %d bytes\n", compMax)); } @@ -377,7 +377,7 @@ fail2: return 0; } -gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h) +gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h) { gdImagePtr im; gdIOCtx *in = gdNewFileCtx(inFile); @@ -456,7 +456,7 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, if (chunkMax <= 0) { goto fail2; } - + chunkBuf = gdCalloc(chunkMax, 1); compBuf = gdCalloc(compMax, 1); } @@ -556,11 +556,11 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, /* Only use a point that is in the image. */ if ((x >= srcx) && (x < (srcx + w)) && (x < fsx) && (x >= 0) && (y >= srcy) && (y < (srcy + h)) && (y < fsy) && (y >= 0)) { - if (im->trueColor) { + if (im->trueColor) { im->tpixels[y - srcy][x - srcx] = ch; } else { im->pixels[y - srcy][x - srcx] = ch; - } + } } } } @@ -576,7 +576,7 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, if (chunkIdx) { gdFree(chunkIdx); } - + return im; fail2: @@ -632,7 +632,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt) int compMax = 0; /* Force fmt to a valid value since we don't return anything. */ - if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)) { + if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)) { fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED; } if (im->trueColor) { @@ -672,12 +672,12 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt) chunkData = safe_emalloc(cs * bytesPerPixel, cs, 0); memset(chunkData, 0, cs * bytesPerPixel * cs); if (compMax <= 0) { - goto fail; + goto fail; } compData = gdCalloc(compMax, 1); /* Save the file position of chunk index, and allocate enough space for - * each chunk_info block . + * each chunk_info block . */ idxPos = gdTell(out); idxSize = ncx * ncy * sizeof(t_chunk_info); @@ -726,7 +726,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt) } } else { for (x = xlo; x < xhi; x++) { - GD2_DBG(php_gd_error("%d, ",x)); + GD2_DBG(php_gd_error("%d, ",x)); if (im->trueColor) { gdPutInt(im->tpixels[y][x], out); @@ -735,7 +735,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt) } } } - GD2_DBG(php_gd_error("y=%d done.\n",y)); + GD2_DBG(php_gd_error("y=%d done.\n",y)); } if (gd2_compressed(fmt)) { @@ -774,7 +774,7 @@ fail: if (chunkData) { gdFree(chunkData); } - if (compData) { + if (compData) { gdFree(compData); } if (chunkIdx) { @@ -788,7 +788,7 @@ void gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt) gdIOCtx *out = gdNewFileCtx(outFile); _gdImageGd2(im, out, cs, fmt); - + out->gd_free(out); } @@ -800,6 +800,6 @@ void *gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size) _gdImageGd2(im, out, cs, fmt); rv = gdDPExtractData(out, size); out->gd_free(out); - + return rv; } diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index a5cd664461..724511b17f 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -189,21 +189,21 @@ gdImageCreateFromGifCtx(gdIOCtxPtr fd) } im->interlace = BitSet(buf[8], INTERLACE); if (! useGlobalColormap) { - if (ReadColorMap(fd, bitPixel, localColorMap)) { + if (ReadColorMap(fd, bitPixel, localColorMap)) { return 0; } - ReadImage(im, fd, imw, imh, localColorMap, - BitSet(buf[8], INTERLACE)); + ReadImage(im, fd, imw, imh, localColorMap, + BitSet(buf[8], INTERLACE)); /*1.4//imageCount != imageNumber); */ } else { ReadImage(im, fd, imw, imh, - ColorMap, + ColorMap, BitSet(buf[8], INTERLACE)); /*1.4//imageCount != imageNumber); */ } if (Transparent != (-1)) { gdImageColorTransparent(im, Transparent); - } + } goto terminated; } @@ -221,7 +221,7 @@ terminated: } else { break; } - } + } return im; } @@ -295,7 +295,7 @@ GetDataBlock(gdIOCtx *fd, unsigned char *buf) int rv; int i; char *tmp = NULL; - + rv = GetDataBlock_(fd,buf); if (VERBOSE) { if (rv > 0) { @@ -331,7 +331,7 @@ GetCode_(gdIOCtx *fd, int code_size, int flag) if (done) { if (curbit >= lastbit) { /* Oh well */ - } + } return -1; } buf[0] = buf[last_byte-2]; @@ -386,7 +386,7 @@ LWZReadByte_(gdIOCtx *fd, int flag, int input_code_size) max_code = clear_code+2; GetCode(fd, 0, TRUE); - + fresh = TRUE; for (i = 0; i < clear_code; ++i) { @@ -498,15 +498,15 @@ LWZReadByte(gdIOCtx *fd, int flag, int input_code_size) static void ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace) /*1.4//, int ignore) */ { - unsigned char c; + unsigned char c; int v; int xpos = 0, ypos = 0, pass = 0; int i; /* Stash the color map into the image */ for (i=0; (i<gdMaxColors); i++) { - im->red[i] = cmap[CM_RED][i]; - im->green[i] = cmap[CM_GREEN][i]; - im->blue[i] = cmap[CM_BLUE][i]; + im->red[i] = cmap[CM_RED][i]; + im->green[i] = cmap[CM_GREEN][i]; + im->blue[i] = cmap[CM_BLUE][i]; im->open[i] = 1; } /* Many (perhaps most) of these colors will remain marked open. */ @@ -515,7 +515,7 @@ ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap) ** Initialize the Compression routines */ if (! ReadOK(fd,&c,1)) { - return; + return; } if (LWZReadByte(fd, TRUE, c) < 0) { return; diff --git a/ext/gd/libgd/gd_io.h b/ext/gd/libgd/gd_io.h index 20408e2415..b893751b7b 100644 --- a/ext/gd/libgd/gd_io.h +++ b/ext/gd/libgd/gd_io.h @@ -6,7 +6,7 @@ #ifdef VMS #define Putchar gdPutchar #endif - + typedef struct gdIOCtx { int (*getC)(struct gdIOCtx*); int (*getBuf)(struct gdIOCtx*, void*, int); diff --git a/ext/gd/libgd/gd_io_dp.c b/ext/gd/libgd/gd_io_dp.c index 8872afa213..d24dd94c2c 100644 --- a/ext/gd/libgd/gd_io_dp.c +++ b/ext/gd/libgd/gd_io_dp.c @@ -136,7 +136,7 @@ static long dynamicTell (struct gdIOCtx *ctx) dpIOCtx *dctx; dctx = (dpIOCtx *) ctx; - + return (dctx->dp->pos); } @@ -284,7 +284,7 @@ static int appendDynamic (dynamicPtr * dp, const void *src, int size) int bytesNeeded; char *tmp; - if (!dp->dataGood) { + if (!dp->dataGood) { return FALSE; } diff --git a/ext/gd/libgd/gd_io_ss.c b/ext/gd/libgd/gd_io_ss.c index 15ab18d9bb..0275cdc403 100644 --- a/ext/gd/libgd/gd_io_ss.c +++ b/ext/gd/libgd/gd_io_ss.c @@ -12,7 +12,7 @@ * used internally until it settles down a bit. * * This module just layers the Source/Sink interface on top of the IOCtx; no - * support is provided for tell/seek, so GD2 writing is not possible, and + * support is provided for tell/seek, so GD2 writing is not possible, and * retrieving parts of GD2 files is also not possible. * * A new SS context does not need to be created with both a Source and a Sink. @@ -86,7 +86,7 @@ static int sourceGetbuf (gdIOCtx * ctx, void *buf, int size) res = ((lctx->src->source) (lctx->src->context, buf, size)); /* - * Translate the return values from the Source object: + * Translate the return values from the Source object: * 0 is EOF, -1 is error */ diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index ce5d84a0fb..e043af62d7 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -1,7 +1,7 @@ /* * gd_jpeg.c: Read and write JPEG (JFIF) format image files using the * gd graphics library (http://www.boutell.com/gd/). - * + * * This software is based in part on the work of the Independent JPEG * Group. For more information on the IJG JPEG software (and JPEG * documentation, etc.), see ftp://ftp.uu.net/graphics/jpeg/. @@ -18,7 +18,7 @@ * major CGI brain damage * * 2.0.10: more efficient gdImageCreateFromJpegCtx, thanks to - * Christian Aberger + * Christian Aberger */ #include <stdio.h> @@ -219,7 +219,7 @@ gdImagePtr gdImageCreateFromJpeg (FILE * inFile) void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile); -/* +/* * Create a gd-format image from the JPEG-format INFILE. Returns the * image, or NULL upon error. */ @@ -259,7 +259,7 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile) jpeg_gdIOCtx_src (&cinfo, infile); retval = jpeg_read_header (&cinfo, TRUE); - if (retval != JPEG_HEADER_OK) { + if (retval != JPEG_HEADER_OK) { php_gd_error_ex(E_WARNING, "gd-jpeg: warning: jpeg_read_header returned %d, expected %d", retval, JPEG_HEADER_OK); } @@ -289,9 +289,9 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile) * latest libjpeg, replaced by something else. Unfortunately * there is still no right way to find out if the file was * progressive or not; just declare your intent before you - * write one by calling gdImageInterlace(im, 1) yourself. + * write one by calling gdImageInterlace(im, 1) yourself. * After all, we're not really supposed to rework JPEGs and - * write them out again anyway. Lossy compression, remember? + * write them out again anyway. Lossy compression, remember? */ #if 0 gdImageInterlace (im, cinfo.progressive_mode != 0); @@ -450,7 +450,7 @@ safeboolean fill_input_buffer (j_decompress_ptr cinfo) int got = gdGetBuf(src->buffer + nbytes, INPUT_BUF_SIZE - nbytes, src->infile); if (got == EOF || got == 0) { - /* EOF or error. If we got any data, don't worry about it. If we didn't, then this is unexpected. */ + /* EOF or error. If we got any data, don't worry about it. If we didn't, then this is unexpected. */ if (!nbytes) { nbytes = -1; } @@ -458,7 +458,7 @@ safeboolean fill_input_buffer (j_decompress_ptr cinfo) } nbytes += got; } - + if (nbytes <= 0) { if (src->start_of_file) { /* Treat empty input file as fatal error */ ERREXIT (cinfo, JERR_INPUT_EMPTY); @@ -560,7 +560,7 @@ void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof (unsigned char)); - + } src = (my_src_ptr) cinfo->src; diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index dbb139fc61..d0eb09d058 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -23,7 +23,7 @@ out all fprintf() statements to disable that). GD 2.0 supports RGBA truecolor and will read and write truecolor PNGs. - GD 2.0 supports 8 bits of color resolution per channel and + GD 2.0 supports 8 bits of color resolution per channel and 7 bits of alpha channel resolution. Images with more than 8 bits per channel are reduced to 8 bits. Images with an alpha channel are only able to resolve down to '1/128th opaque' instead of '1/256th', @@ -121,7 +121,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) memset (infile, 0, sizeof(infile)); /* first do a quick check that the file really is a PNG image; could - * have used slightly more general png_sig_cmp() function instead + * have used slightly more general png_sig_cmp() function instead */ gdGetBuf(sig, 8, infile); if (!png_check_sig (sig, 8)) { /* bad signature */ @@ -148,7 +148,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) /* we could create a second info struct here (end_info), but it's only * useful if we want to keep pre- and post-IDAT chunk info separated - * (mainly for PNG-aware image editors and converters) + * (mainly for PNG-aware image editors and converters) */ /* setjmp() must be called in every non-callback function that calls a @@ -197,7 +197,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) #endif /* DEBUG */ if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) { /* gd 2.0: we support this rather thoroughly now. Grab the - * first fully transparent entry, if any, as the value of + * first fully transparent entry, if any, as the value of * the simple-transparency index, mostly for backwards * binary compatibility. The alpha channel is where it's * really at these days. @@ -251,7 +251,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) * custom 16-bit code to handle the case where there are gdFree * palette entries. This error will be extremely rare in * general, though. (Quite possibly there is only one such - * image in existence.) + * image in existence.) */ } break; @@ -260,16 +260,16 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) case PNG_COLOR_TYPE_RGB_ALPHA: /* gd 2.0: we now support truecolor. See the comment above * for a rare situation in which the transparent pixel may not - * work properly with 16-bit channels. + * work properly with 16-bit channels. */ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { png_get_tRNS(png_ptr, info_ptr, NULL, NULL, &trans_color_rgb); if (bit_depth == 16) { /* png_set_strip_16() not yet in effect */ - transparent = gdTrueColor(trans_color_rgb->red >> 8, + transparent = gdTrueColor(trans_color_rgb->red >> 8, trans_color_rgb->green >> 8, trans_color_rgb->blue >> 8); } else { - transparent = gdTrueColor(trans_color_rgb->red, + transparent = gdTrueColor(trans_color_rgb->red, trans_color_rgb->green, trans_color_rgb->blue); } @@ -337,7 +337,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile) register png_byte b = row_pointers[h][boffset++]; /* gd has only 7 bits of alpha channel resolution, and - * 127 is transparent, 0 opaque. A moment of convenience, + * 127 is transparent, 0 opaque. A moment of convenience, * a lifetime of compatibility. */ @@ -471,14 +471,14 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) * gd is intentionally imperfect and doesn't spend a lot of time * fussing with such things. */ - + /* png_set_filter(png_ptr, 0, PNG_FILTER_NONE); */ /* 2.0.12: this is finally a parameter */ png_set_compression_level(png_ptr, level); /* can set this to a smaller value without compromising compression if all - * image data is 16K or less; will save some decoder memory [min == 8] + * image data is 16K or less; will save some decoder memory [min == 8] */ /* png_set_compression_window_bits(png_ptr, 15); */ @@ -507,13 +507,13 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) bit_depth = 1; } else if (colors <= 4) { bit_depth = 2; - } else if (colors <= 16) { + } else if (colors <= 16) { bit_depth = 4; } else { bit_depth = 8; } } - + interlace_type = im->interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE; if (im->trueColor) { @@ -540,9 +540,9 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) if (!im->trueColor) { /* Oy veh. Remap the PNG palette to put the entries with interesting alpha channel * values first. This minimizes the size of the tRNS chunk and thus the size - * of the PNG file as a whole. + * of the PNG file as a whole. */ - + int tc = 0; int i; int j; @@ -573,7 +573,7 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) for (i = 0; i < im->colorsTotal; i++) { if (!im->open[i]) { if (im->alpha[i] != gdAlphaOpaque) { - /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ + /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ trans_values[j] = 255 - ((im->alpha[i] << 1) + (im->alpha[i] >> 6)); mapping[i] = j++; } else { @@ -653,7 +653,7 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) * PNG's convention in which 255 is opaque. */ a = gdTrueColorGetAlpha(thisPixel); - /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ + /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ *pOutputRow++ = 255 - ((a << 1) + (a >> 6)); } } @@ -665,7 +665,7 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level) for (j = 0; j < height; ++j) { gdFree(row_pointers[j]); } - + gdFree(row_pointers); } else { if (remap) { diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c index b60a055aef..b2c64d9ba8 100644 --- a/ext/gd/libgd/gd_topal.c +++ b/ext/gd/libgd/gd_topal.c @@ -41,7 +41,7 @@ * If it is not working, it's not Thomas G. Lane's fault. */ -/* +/* * SETTING THIS ONE CAUSES STRIPED IMAGE * to be done: solve this * #define ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS @@ -148,7 +148,7 @@ * color space, and repeatedly splits the "largest" remaining box until we * have as many boxes as desired colors. Then the mean color in each * remaining box becomes one of the possible output colors. - * + * * The second pass over the image maps each input pixel to the closest output * color (optionally after applying a Floyd-Steinberg dithering correction). * This mapping is logically trivial, but making it go fast enough requires @@ -546,7 +546,7 @@ have_c2min: for (c2 = c2max; c2 >= c2min; c2--) { for (c0 = c0min; c0 <= c0max; c0++) { histp = &histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) { + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) { if (*histp != 0) { boxp->c2max = c2max = c2; goto have_c2max; @@ -1284,7 +1284,7 @@ pass2_no_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output *outptr++ = (JSAMPLE) (*cachep - 1); #else *outptr++ = (*cachep - 1); -#endif +#endif } } } @@ -1849,7 +1849,7 @@ gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted) } im->pixels = 0; } - + for (i = 0; i < HIST_C0_ELEMS; i++) { if (cquantize->histogram[i]) { gdFree(cquantize->histogram[i]); diff --git a/ext/gd/libgd/gd_wbmp.c b/ext/gd/libgd/gd_wbmp.c index 7307d6f9e9..81eadd348e 100644 --- a/ext/gd/libgd/gd_wbmp.c +++ b/ext/gd/libgd/gd_wbmp.c @@ -1,8 +1,8 @@ /* WBMP: Wireless Bitmap Type 0: B/W, Uncompressed Bitmap - Specification of the WBMP format can be found in the file: + Specification of the WBMP format can be found in the file: SPEC-WAESpec-19990524.pdf - You can download the WAP specification on: http://www.wapforum.com/ + You can download the WAP specification on: http://www.wapforum.com/ gd_wbmp.c @@ -14,7 +14,7 @@ (wbmp library included, but you can find the latest distribution at http://www.vandenbrande.com/wbmp) - Implemented: gdImageCreateFromWBMPCtx, gdImageCreateFromWBMP + Implemented: gdImageCreateFromWBMPCtx, gdImageCreateFromWBMP --------------------------------------------------------------------------- @@ -32,7 +32,7 @@ ** implied warranty. --------------------------------------------------------------------------- - Parts od this code are inspired by 'pbmtowbmp.c' and 'wbmptopbm.c' by + Parts od this code are inspired by 'pbmtowbmp.c' and 'wbmptopbm.c' by Terje Sannum <terje@looplab.com>. ** ** Permission to use, copy, modify, and distribute this software and its @@ -87,7 +87,7 @@ int gd_getin (void *in) ** Write the image as a wbmp file ** Parameters are: ** image: gd image structure; - ** fg: the index of the foreground color. any other value will be + ** fg: the index of the foreground color. any other value will be ** considered as background and will not be written ** out: the stream where to write */ @@ -196,6 +196,6 @@ void * gdImageWBMPPtr (gdImagePtr im, int *size, int fg) gdImageWBMPCtx(im, fg, out); rv = gdDPExtractData(out, size); out->gd_free(out); - + return rv; } diff --git a/ext/gd/libgd/gdcache.c b/ext/gd/libgd/gdcache.c index e2219c0cbd..a6e507a4bb 100644 --- a/ext/gd/libgd/gdcache.c +++ b/ext/gd/libgd/gdcache.c @@ -11,11 +11,11 @@ #ifdef NEED_CACHE -/* +/* * gdcache.c * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has + * Caches of pointers to user structs in which the least-recently-used + * element is replaced in the event of a cache miss after the cache has * reached a given size. * * John Ellson (ellson@graphviz.org) Oct 31, 1997 @@ -30,17 +30,17 @@ * The head structure has a pointer to the most-recently-used * element, and elements are moved to this position in the list each * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata - * - a function to provide a new userdata struct to the cache + * user defined functions: + * - a function to test if a cached userdata matches some keydata + * - a function to provide a new userdata struct to the cache * if there has been a cache miss. * - a function to release a userdata struct when it is * no longer being managed by the cache * * In the event of a cache miss the cache is allowed to grow up to * a specified maximum size. After the maximum size is reached then - * the least-recently-used element is discarded to make room for the - * new. The most-recently-returned value is always left at the + * the least-recently-used element is discarded to make room for the + * new. The most-recently-returned value is always left at the * beginning of the list after retrieval. * * In the current implementation the cache is traversed by a linear diff --git a/ext/gd/libgd/gdcache.h b/ext/gd/libgd/gdcache.h index 45d037475d..6a6e892447 100644 --- a/ext/gd/libgd/gdcache.h +++ b/ext/gd/libgd/gdcache.h @@ -1,8 +1,8 @@ -/* +/* * gdcache.h * - * Caches of pointers to user structs in which the least-recently-used - * element is replaced in the event of a cache miss after the cache has + * Caches of pointers to user structs in which the least-recently-used + * element is replaced in the event of a cache miss after the cache has * reached a given size. * * John Ellson (ellson@graphviz.org) Oct 31, 1997 @@ -17,17 +17,17 @@ * The head structure has a pointer to the most-recently-used * element, and elements are moved to this position in the list each * time they are used. The head also contains pointers to three - * user defined functions: - * - a function to test if a cached userdata matches some keydata - * - a function to provide a new userdata struct to the cache + * user defined functions: + * - a function to test if a cached userdata matches some keydata + * - a function to provide a new userdata struct to the cache * if there has been a cache miss. * - a function to release a userdata struct when it is * no longer being managed by the cache * * In the event of a cache miss the cache is allowed to grow up to * a specified maximum size. After the maximum size is reached then - * the least-recently-used element is discarded to make room for the - * new. The most-recently-returned value is always left at the + * the least-recently-used element is discarded to make room for the + * new. The most-recently-returned value is always left at the * beginning of the list after retrieval. * * In the current implementation the cache is traversed by a linear diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 4d34d5ec9f..bd254733bc 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -39,9 +39,8 @@ char * gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string) { - /* 2.0.6: valid return */ - return gdImageStringFT (im, brect, fg, fontlist, ptsize, - angle, x, y, string); + /* 2.0.6: valid return */ + return gdImageStringFT (im, brect, fg, fontlist, ptsize, angle, x, y, string); } #ifndef HAVE_LIBFREETYPE @@ -50,14 +49,14 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, gdFTStringExtraPtr strex) { - return "libgd was not built with FreeType font support\n"; + return "libgd was not built with FreeType font support\n"; } char * gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string) { - return "libgd was not built with FreeType font support\n"; + return "libgd was not built with FreeType font support\n"; } #else @@ -73,8 +72,8 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, #define TWEENCOLORCACHESIZE 32 /* - * Line separation as a factor of font height. - * No space between if LINESPACE = 1.00 + * Line separation as a factor of font height. + * No space between if LINESPACE = 1.00 * Line separation will be rounded up to next pixel row. */ #define LINESPACE 1.05 @@ -117,40 +116,35 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, typedef struct { - char *fontlist; /* key */ - FT_Library *library; - FT_Face face; - FT_Bool have_char_map_unicode, have_char_map_big5, have_char_map_sjis, - have_char_map_apple_roman; - gdCache_head_t *glyphCache; -} -font_t; + char *fontlist; /* key */ + FT_Library *library; + FT_Face face; + FT_Bool have_char_map_unicode, have_char_map_big5, have_char_map_sjis, have_char_map_apple_roman; + gdCache_head_t *glyphCache; +} font_t; typedef struct - { - char *fontlist; /* key */ - FT_Library *library; - } -fontkey_t; +{ + char *fontlist; /* key */ + FT_Library *library; +} fontkey_t; typedef struct - { - int pixel; /* key */ - int bgcolor; /* key */ - int fgcolor; /* key *//* -ve means no antialias */ - gdImagePtr im; /* key */ - int tweencolor; - } -tweencolor_t; +{ + int pixel; /* key */ + int bgcolor; /* key */ + int fgcolor; /* key *//* -ve means no antialias */ + gdImagePtr im; /* key */ + int tweencolor; +} tweencolor_t; typedef struct - { - int pixel; /* key */ - int bgcolor; /* key */ - int fgcolor; /* key *//* -ve means no antialias */ - gdImagePtr im; /* key */ - } -tweencolorkey_t; +{ + int pixel; /* key */ + int bgcolor; /* key */ + int fgcolor; /* key *//* -ve means no antialias */ + gdImagePtr im; /* key */ +} tweencolorkey_t; /******************************************************************** * gdTcl_UtfToUniChar is borrowed from Tcl ... @@ -200,160 +194,125 @@ tweencolorkey_t; #define Tcl_UniChar int #define TCL_UTF_MAX 3 -static int -gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr) +static int gdTcl_UtfToUniChar (char *str, Tcl_UniChar * chPtr) /* str is the UTF8 next character pointer */ /* chPtr is the int for the result */ { - int byte; - - /* HTML4.0 entities in decimal form, e.g. Å */ - byte = *((unsigned char *) str); - if (byte == '&') - { - int i, n = 0; - - byte = *((unsigned char *) (str + 1)); - if (byte == '#') - { - for (i = 2; i < 8; i++) - { - byte = *((unsigned char *) (str + i)); - if (byte >= '0' && byte <= '9') - { - n = (n * 10) + (byte - '0'); + int byte; + + /* HTML4.0 entities in decimal form, e.g. Å */ + byte = *((unsigned char *) str); + if (byte == '&') { + int i, n = 0; + + byte = *((unsigned char *) (str + 1)); + if (byte == '#') { + for (i = 2; i < 8; i++) { + byte = *((unsigned char *) (str + i)); + if (byte >= '0' && byte <= '9') { + n = (n * 10) + (byte - '0'); + } else { + break; + } + } + if (byte == ';') { + *chPtr = (Tcl_UniChar) n; + return ++i; + } } - else - break; - } - if (byte == ';') - { - *chPtr = (Tcl_UniChar) n; - return ++i; - } } - } - /* - * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones. - */ + /* Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones. */ - byte = *((unsigned char *) str); + byte = *((unsigned char *) str); #ifdef JISX0208 - if (0xA1 <= byte && byte <= 0xFE) - { - int ku, ten; - - ku = (byte & 0x7F) - 0x20; - ten = (str[1] & 0x7F) - 0x20; - if ((ku < 1 || ku > 92) || (ten < 1 || ten > 94)) - { - *chPtr = (Tcl_UniChar) byte; - return 1; - } + if (0xA1 <= byte && byte <= 0xFE) { + int ku, ten; + + ku = (byte & 0x7F) - 0x20; + ten = (str[1] & 0x7F) - 0x20; + if ((ku < 1 || ku > 92) || (ten < 1 || ten > 94)) { + *chPtr = (Tcl_UniChar) byte; + return 1; + } - *chPtr = (Tcl_UniChar) UnicodeTbl[ku - 1][ten - 1]; - return 2; - } - else + *chPtr = (Tcl_UniChar) UnicodeTbl[ku - 1][ten - 1]; + return 2; + } else #endif /* JISX0208 */ - if (byte < 0xC0) - { - /* - * Handles properly formed UTF-8 characters between - * 0x01 and 0x7F. Also treats \0 and naked trail - * bytes 0x80 to 0xBF as valid characters representing - * themselves. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } - else if (byte < 0xE0) - { - if ((str[1] & 0xC0) == 0x80) - { - /* - * Two-byte-character lead-byte followed - * by a trail-byte. - */ - - *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) - | (str[1] & 0x3F)); - return 2; - } - /* - * A two-byte-character lead-byte not followed by trail-byte - * represents itself. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } - else if (byte < 0xF0) - { - if (((str[1] & 0xC0) == 0x80) && ((str[2] & 0xC0) == 0x80)) - { - /* - * Three-byte-character lead byte followed by - * two trail bytes. - */ - - *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) - | ((str[1] & 0x3F) << 6) | (str[2] & 0x3F)); - return 3; + if (byte < 0xC0) { + /* Handles properly formed UTF-8 characters between + * 0x01 and 0x7F. Also treats \0 and naked trail + * bytes 0x80 to 0xBF as valid characters representing + * themselves. + */ + + *chPtr = (Tcl_UniChar) byte; + return 1; + } else if (byte < 0xE0) { + if ((str[1] & 0xC0) == 0x80) { + /* Two-byte-character lead-byte followed by a trail-byte. */ + + *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (str[1] & 0x3F)); + return 2; + } + /* + * A two-byte-character lead-byte not followed by trail-byte + * represents itself. + */ + + *chPtr = (Tcl_UniChar) byte; + return 1; + } else if (byte < 0xF0) { + if (((str[1] & 0xC0) == 0x80) && ((str[2] & 0xC0) == 0x80)) { + /* Three-byte-character lead byte followed by two trail bytes. */ + + *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) | ((str[1] & 0x3F) << 6) | (str[2] & 0x3F)); + return 3; + } + /* A three-byte-character lead-byte not followed by two trail-bytes represents itself. */ + + *chPtr = (Tcl_UniChar) byte; + return 1; } - /* - * A three-byte-character lead-byte not followed by - * two trail-bytes represents itself. - */ - - *chPtr = (Tcl_UniChar) byte; - return 1; - } #if TCL_UTF_MAX > 3 - else - { - int ch, total, trail; - - total = totalBytes[byte]; - trail = total - 1; - if (trail > 0) - { - ch = byte & (0x3F >> trail); - do - { - str++; - if ((*str & 0xC0) != 0x80) - { - *chPtr = byte; - return 1; + else { + int ch, total, trail; + + total = totalBytes[byte]; + trail = total - 1; + + if (trail > 0) { + ch = byte & (0x3F >> trail); + do { + str++; + if ((*str & 0xC0) != 0x80) { + *chPtr = byte; + return 1; + } + ch <<= 6; + ch |= (*str & 0x3F); + trail--; + } while (trail > 0); + *chPtr = ch; + return total; } - ch <<= 6; - ch |= (*str & 0x3F); - trail--; - } - while (trail > 0); - *chPtr = ch; - return total; } - } #endif - *chPtr = (Tcl_UniChar) byte; - return 1; + *chPtr = (Tcl_UniChar) byte; + return 1; } /********************************************************************/ /* font cache functions */ -static int -fontTest (void *element, void *key) +static int fontTest (void *element, void *key) { - font_t *a = (font_t *) element; - fontkey_t *b = (fontkey_t *) key; + font_t *a = (font_t *) element; + fontkey_t *b = (fontkey_t *) key; - return (strcmp (a->fontlist, b->fontlist) == 0); + return (strcmp (a->fontlist, b->fontlist) == 0); } static void *fontFetch (char **error, void *key) @@ -381,7 +340,7 @@ static void *fontFetch (char **error, void *key) fontsearchpath = getenv ("GDFONTPATH"); if (!fontsearchpath) { fontsearchpath = DEFAULT_FONTPATH; - } + } fontlist = gdEstrdup(a->fontlist); /* @@ -391,7 +350,7 @@ static void *fontFetch (char **error, void *key) /* make a fresh copy each time - strtok corrupts it. */ path = gdEstrdup (fontsearchpath); - /* if name is an absolute filename then test directly */ + /* if name is an absolute filename then test directly */ if (*name == '/' || (name[0] != 0 && name[1] == ':' && (name[2] == '/' || name[2] == '\\'))) { snprintf(fullname, sizeof(fullname) - 1, "%s", name); if (access(fullname, R_OK) == 0) { @@ -429,15 +388,15 @@ static void *fontFetch (char **error, void *key) path = NULL; if (font_found) { break; - } + } } - + if (path) { gdFree(path); } - + gdFree(fontlist); - + if (!font_found) { gdPFree(a->fontlist); gdPFree(a); @@ -548,216 +507,184 @@ static int tweenColorTest (void *element, void *key) * does the work so that text can be alpha blended across a complex * background (TBB; and for real in 2.0.2). */ -static void * -tweenColorFetch (char **error, void *key) +static void * tweenColorFetch (char **error, void *key) { - tweencolor_t *a; - tweencolorkey_t *b = (tweencolorkey_t *) key; - int pixel, npixel, bg, fg; - gdImagePtr im; - - a = (tweencolor_t *) gdMalloc (sizeof (tweencolor_t)); - pixel = a->pixel = b->pixel; - bg = a->bgcolor = b->bgcolor; - fg = a->fgcolor = b->fgcolor; - im = b->im; - - /* if fg is specified by a negative color idx, then don't antialias */ - if (fg < 0) - { - if ((pixel + pixel) >= NUMCOLORS) - a->tweencolor = -fg; - else - a->tweencolor = bg; - } - else - { - npixel = NUMCOLORS - pixel; - if (im->trueColor) - { - /* 2.0.1: use gdImageSetPixel to do the alpha blending work, - or to just store the alpha level. All we have to do here - is incorporate our knowledge of the percentage of this - pixel that is really "lit" by pushing the alpha value - up toward transparency in edge regions. */ - a->tweencolor = gdTrueColorAlpha ( - gdTrueColorGetRed (fg), - gdTrueColorGetGreen (fg), - gdTrueColorGetBlue (fg), - gdAlphaMax - (gdTrueColorGetAlpha (fg) * pixel / NUMCOLORS)); - } - else - { - a->tweencolor = gdImageColorResolve (im, - (pixel * im->red[fg] + npixel * im->red[bg]) / NUMCOLORS, - (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS, - (pixel * im->blue[fg] + npixel * im->blue[bg]) / NUMCOLORS); - } - } - return (void *) a; + tweencolor_t *a; + tweencolorkey_t *b = (tweencolorkey_t *) key; + int pixel, npixel, bg, fg; + gdImagePtr im; + + a = (tweencolor_t *) gdMalloc (sizeof (tweencolor_t)); + pixel = a->pixel = b->pixel; + bg = a->bgcolor = b->bgcolor; + fg = a->fgcolor = b->fgcolor; + im = b->im; + + /* if fg is specified by a negative color idx, then don't antialias */ + if (fg < 0) { + if ((pixel + pixel) >= NUMCOLORS) { + a->tweencolor = -fg; + } else { + a->tweencolor = bg; + } + } else { + npixel = NUMCOLORS - pixel; + if (im->trueColor) { + /* 2.0.1: use gdImageSetPixel to do the alpha blending work, + * or to just store the alpha level. All we have to do here + * is incorporate our knowledge of the percentage of this + * pixel that is really "lit" by pushing the alpha value + * up toward transparency in edge regions. + */ + a->tweencolor = gdTrueColorAlpha( + gdTrueColorGetRed(fg), + gdTrueColorGetGreen(fg), + gdTrueColorGetBlue(fg), + gdAlphaMax - (gdTrueColorGetAlpha (fg) * pixel / NUMCOLORS)); + } else { + a->tweencolor = gdImageColorResolve(im, + (pixel * im->red[fg] + npixel * im->red[bg]) / NUMCOLORS, + (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS, + (pixel * im->blue[fg] + npixel * im->blue[bg]) / NUMCOLORS); + } + } + return (void *) a; } -static void -tweenColorRelease (void *element) +static void tweenColorRelease (void *element) { - gdFree ((char *) element); + gdFree((char *) element); } /* draw_bitmap - transfers glyph bitmap to GD image */ -static char * -gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y) +static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y) { - unsigned char *pixel = NULL; - int *tpixel = NULL; - int x, y, row, col, pc, pcr; - - tweencolor_t *tc_elem; - tweencolorkey_t tc_key; - - /* copy to image, mapping colors */ - tc_key.fgcolor = fg; - tc_key.im = im; - /* Truecolor version; does not require the cache */ - if (im->trueColor) - { - for (row = 0; row < bitmap.rows; row++) - { - pc = row * bitmap.pitch; - pcr = pc; - y = pen_y + row; - /* clip if out of bounds */ - /* 2.0.16: clipping rectangle, not image bounds */ - if ((y > im->cy2) || (y < im->cy1)) - continue; - for (col = 0; col < bitmap.width; col++, pc++) - { - int level; - if (bitmap.pixel_mode == ft_pixel_mode_grays) - { - /* - * Scale to 128 levels of alpha for gd use. - * alpha 0 is opacity, so be sure to invert at the end - */ - level = (bitmap.buffer[pc] * gdAlphaMax / - (bitmap.num_grays - 1)); - } - else if (bitmap.pixel_mode == ft_pixel_mode_mono) - { - /* 2.0.5: mode_mono fix from Giuliano Pochini */ - level = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07))) - ? gdAlphaTransparent : - gdAlphaOpaque; - } - else - { - return "Unsupported ft_pixel_mode"; - } - if ((fg >= 0) && (im->trueColor)) { - /* Consider alpha in the foreground color itself to be an - upper bound on how opaque things get, when truecolor is - available. Without truecolor this results in far too many - color indexes. */ - level = level * (gdAlphaMax - gdTrueColorGetAlpha(fg)) / gdAlphaMax; - } - level = gdAlphaMax - level; - x = pen_x + col; - /* clip if out of bounds */ - /* 2.0.16: clip to clipping rectangle, Matt McNabb */ - if ((x > im->cx2) || (x < im->cx1)) - continue; - /* get pixel location in gd buffer */ - tpixel = &im->tpixels[y][x]; - if (fg < 0) { - if (level < (gdAlphaMax / 2)) { - *tpixel = -fg; - } - } else { - if (im->alphaBlendingFlag) { - *tpixel = gdAlphaBlend(*tpixel, (level << 24) + (fg & 0xFFFFFF)); - } else { - *tpixel = (level << 24) + (fg & 0xFFFFFF); - } - } - } - } - return (char *) NULL; - } - /* Non-truecolor case, restored to its more or less original form */ - for (row = 0; row < bitmap.rows; row++) - { - int pcr; - pc = row * bitmap.pitch; - pcr = pc; - if(bitmap.pixel_mode==ft_pixel_mode_mono) - pc *= 8; /* pc is measured in bits for monochrome images */ - - y = pen_y + row; - - /* clip if out of bounds */ - if (y >= im->sy || y < 0) - continue; - - for (col = 0; col < bitmap.width; col++, pc++) - { - if (bitmap.pixel_mode == ft_pixel_mode_grays) - { - /* - * Round to NUMCOLORS levels of antialiasing for - * index color images since only 256 colors are - * available. - */ - tc_key.pixel = ((bitmap.buffer[pc] * NUMCOLORS) - + bitmap.num_grays / 2) - / (bitmap.num_grays - 1); - } - else if (bitmap.pixel_mode == ft_pixel_mode_mono) - { - tc_key.pixel = ((bitmap.buffer[pc / 8] - << (pc % 8)) & 128) ? NUMCOLORS : 0; - /* 2.0.5: mode_mono fix from Giuliano Pochini */ - tc_key.pixel = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07))) - ? NUMCOLORS : 0; - } - else - { - return "Unsupported ft_pixel_mode"; - } - if (tc_key.pixel > 0) /* if not background */ - { - x = pen_x + col; - - /* clip if out of bounds */ - if (x >= im->sx || x < 0) - continue; - /* get pixel location in gd buffer */ - pixel = &im->pixels[y][x]; - if (tc_key.pixel == NUMCOLORS) - { - /* use fg color directly. gd 2.0.2: watch out for - negative indexes (thanks to David Marwood). */ - *pixel = (fg < 0) ? -fg : fg; + unsigned char *pixel = NULL; + int *tpixel = NULL; + int x, y, row, col, pc, pcr; + + tweencolor_t *tc_elem; + tweencolorkey_t tc_key; + + /* copy to image, mapping colors */ + tc_key.fgcolor = fg; + tc_key.im = im; + /* Truecolor version; does not require the cache */ + if (im->trueColor) { + for (row = 0; row < bitmap.rows; row++) { + pc = row * bitmap.pitch; + pcr = pc; + y = pen_y + row; + /* clip if out of bounds */ + /* 2.0.16: clipping rectangle, not image bounds */ + if ((y > im->cy2) || (y < im->cy1)) { + continue; + } + for (col = 0; col < bitmap.width; col++, pc++) { + int level; + if (bitmap.pixel_mode == ft_pixel_mode_grays) { + /* Scale to 128 levels of alpha for gd use. + * alpha 0 is opacity, so be sure to invert at the end + */ + level = (bitmap.buffer[pc] * gdAlphaMax / (bitmap.num_grays - 1)); + } else if (bitmap.pixel_mode == ft_pixel_mode_mono) { + /* 2.0.5: mode_mono fix from Giuliano Pochini */ + level = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07))) ? gdAlphaTransparent : gdAlphaOpaque; + } else { + return "Unsupported ft_pixel_mode"; + } + if ((fg >= 0) && (im->trueColor)) { + /* Consider alpha in the foreground color itself to be an + * upper bound on how opaque things get, when truecolor is + * available. Without truecolor this results in far too many + * color indexes. + */ + level = level * (gdAlphaMax - gdTrueColorGetAlpha(fg)) / gdAlphaMax; + } + level = gdAlphaMax - level; + x = pen_x + col; + /* clip if out of bounds */ + /* 2.0.16: clip to clipping rectangle, Matt McNabb */ + if ((x > im->cx2) || (x < im->cx1)) { + continue; + } + /* get pixel location in gd buffer */ + tpixel = &im->tpixels[y][x]; + if (fg < 0) { + if (level < (gdAlphaMax / 2)) { + *tpixel = -fg; + } + } else { + if (im->alphaBlendingFlag) { + *tpixel = gdAlphaBlend(*tpixel, (level << 24) + (fg & 0xFFFFFF)); + } else { + *tpixel = (level << 24) + (fg & 0xFFFFFF); + } + } + } } - else - { - /* find antialised color */ - - tc_key.bgcolor = *pixel; - tc_elem = (tweencolor_t *) gdCacheGet ( - tc_cache, &tc_key); - *pixel = tc_elem->tweencolor; + return (char *) NULL; + } + /* Non-truecolor case, restored to its more or less original form */ + for (row = 0; row < bitmap.rows; row++) { + int pcr; + pc = row * bitmap.pitch; + pcr = pc; + if (bitmap.pixel_mode==ft_pixel_mode_mono) { + pc *= 8; /* pc is measured in bits for monochrome images */ + } + y = pen_y + row; + + /* clip if out of bounds */ + if (y >= im->sy || y < 0) { + continue; + } + + for (col = 0; col < bitmap.width; col++, pc++) { + if (bitmap.pixel_mode == ft_pixel_mode_grays) { + /* + * Round to NUMCOLORS levels of antialiasing for + * index color images since only 256 colors are + * available. + */ + tc_key.pixel = ((bitmap.buffer[pc] * NUMCOLORS) + bitmap.num_grays / 2) / (bitmap.num_grays - 1); + } else if (bitmap.pixel_mode == ft_pixel_mode_mono) { + tc_key.pixel = ((bitmap.buffer[pc / 8] << (pc % 8)) & 128) ? NUMCOLORS : 0; + /* 2.0.5: mode_mono fix from Giuliano Pochini */ + tc_key.pixel = ((bitmap.buffer[(col>>3)+pcr]) & (1<<(~col&0x07))) ? NUMCOLORS : 0; + } else { + return "Unsupported ft_pixel_mode"; + } + if (tc_key.pixel > 0) { /* if not background */ + x = pen_x + col; + + /* clip if out of bounds */ + if (x >= im->sx || x < 0) { + continue; + } + /* get pixel location in gd buffer */ + pixel = &im->pixels[y][x]; + if (tc_key.pixel == NUMCOLORS) { + /* use fg color directly. gd 2.0.2: watch out for + * negative indexes (thanks to David Marwood). + */ + *pixel = (fg < 0) ? -fg : fg; + } else { + /* find antialised color */ + tc_key.bgcolor = *pixel; + tc_elem = (tweencolor_t *) gdCacheGet(tc_cache, &tc_key); + *pixel = tc_elem->tweencolor; + } + } } - } } - } - return (char *) NULL; + return (char *) NULL; } static int gdroundupdown (FT_F26Dot6 v1, int updown) { - return (!updown) - ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) - : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); + return (!updown) ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); } extern int any2eucjp (char *, char *, unsigned int); @@ -800,7 +727,7 @@ int gdFontCacheSetup(void) /* gdImageStringFT - render a utf8 string onto a gd image */ char * -gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, +gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string) { return gdImageStringFTEx(im, brect, fg, fontlist, ptsize, angle, x, y, string, 0); @@ -856,7 +783,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi } } /*****/ - + gdMutexLock(gdFontCacheMutex); /* get the font (via font cache) */ fontkey.fontlist = fontlist; @@ -989,7 +916,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi next += len; } break; - case gdFTEX_Shift_JIS: + case gdFTEX_Shift_JIS: if (font->have_char_map_sjis) { unsigned char c; int jiscode; diff --git a/ext/gd/libgd/gdhelpers.h b/ext/gd/libgd/gdhelpers.h index 33223318f1..5e7d9bee73 100644 --- a/ext/gd/libgd/gdhelpers.h +++ b/ext/gd/libgd/gdhelpers.h @@ -1,4 +1,4 @@ -#ifndef GDHELPERS_H +#ifndef GDHELPERS_H #define GDHELPERS_H 1 #include <sys/types.h> diff --git a/ext/gd/libgd/gdkanji.c b/ext/gd/libgd/gdkanji.c index ad839c8bb3..37f3bd10a0 100644 --- a/ext/gd/libgd/gdkanji.c +++ b/ext/gd/libgd/gdkanji.c @@ -75,7 +75,7 @@ error (const char *format,...) va_list args; char *tmp; TSRMLS_FETCH(); - + va_start(args, format); vspprintf(&tmp, 0, format, args); va_end(args); diff --git a/ext/gd/libgd/gdxpm.c b/ext/gd/libgd/gdxpm.c index 95bbf94a0c..5663837aee 100644 --- a/ext/gd/libgd/gdxpm.c +++ b/ext/gd/libgd/gdxpm.c @@ -1,8 +1,8 @@ -/* +/* add ability to load xpm files to gd, requires the xpm library. - Caolan.McNamara@ul.ie + Caolan.McNamara@ul.ie http://www.csn.ul.ie/~caolan */ #include <stdio.h> diff --git a/ext/gd/libgd/testac.c b/ext/gd/libgd/testac.c index 55a5434d21..30c54e1641 100644 --- a/ext/gd/libgd/testac.c +++ b/ext/gd/libgd/testac.c @@ -33,7 +33,7 @@ main (int argc, char *argv[]) } /* Load original PNG, which should contain alpha channel information. We will use it in two ways: preserving it - literally, for use with compatible browsers, and + literally, for use with compatible browsers, and compositing it ourselves against a background of our choosing (alpha blending). We'll change its size and try creating palette versions of it. */ @@ -80,7 +80,7 @@ testDrawing ( /* Create output image. */ im_out = gdImageCreateTrueColor ((int) (gdImageSX (im_in) * scale), (int) (gdImageSY (im_in) * scale)); - /* + /* Request alpha blending. This causes future drawing operations to perform alpha channel blending with the background, resulting in an opaque image. @@ -111,7 +111,7 @@ testDrawing ( /* If this image is the result of alpha channel blending, it will not contain an interesting alpha channel itself. - Save a little file size by not saving the alpha channel. + Save a little file size by not saving the alpha channel. Otherwise the file would typically be slightly larger. */ gdImageSaveAlpha (im_out, !blending); diff --git a/ext/gd/libgd/wbmp.c b/ext/gd/libgd/wbmp.c index eead82deda..fad3566922 100644 --- a/ext/gd/libgd/wbmp.c +++ b/ext/gd/libgd/wbmp.c @@ -28,7 +28,7 @@ /* getmbi ** ------ - ** Get a multibyte integer from a generic getin function + ** Get a multibyte integer from a generic getin function ** 'getin' can be getc, with in = NULL ** you can find getin as a function just above the main function ** This way you gain a lot of flexibilty about how this package @@ -224,7 +224,7 @@ readwbmp (int (*getin) (void *in), void *in, Wbmp ** return_wbmp) ** Why not just giving a filedescriptor to this function? ** Well, the incentive to write this function was the complete ** integration in gd library from www.boutell.com. They use - ** their own io functions, so the passing of a function seemed to be + ** their own io functions, so the passing of a function seemed to be ** a logic(?) decision ... ** */ @@ -319,7 +319,7 @@ putout (int c, void *out) return (putc (c, (FILE *) out)); } -/* getin from file descriptor +/* getin from file descriptor ** -------------------------- */ int diff --git a/ext/gd/libgd/wbmp.h b/ext/gd/libgd/wbmp.h index 2f61b0a095..654a1c9db5 100644 --- a/ext/gd/libgd/wbmp.h +++ b/ext/gd/libgd/wbmp.h @@ -8,7 +8,7 @@ ** (c) 2000 Johan Van den Brande <johan@vandenbrande.com> ** ** Header file -*/ +*/ #ifndef __WBMP_H #define __WBMP_H 1 @@ -18,7 +18,7 @@ ** A Wireless bitmap structure ** */ - + typedef struct Wbmp_ { int type; /* type of the wbmp */ @@ -26,22 +26,22 @@ typedef struct Wbmp_ int height; /* height of the image */ int *bitmap; /* pointer to data: 0 = WHITE , 1 = BLACK */ } Wbmp; - + #define WBMP_WHITE 1 #define WBMP_BLACK 0 - + /* Proto's ** ------- ** */ -void putmbi( int i, void (*putout)(int c, void *out), void *out); +void putmbi( int i, void (*putout)(int c, void *out), void *out); int getmbi ( int (*getin)(void *in), void *in ); int skipheader( int (*getin)(void *in), void *in ); Wbmp *createwbmp( int width, int height, int color ); int readwbmp( int (*getin)(void *in), void *in, Wbmp **wbmp ); int writewbmp( Wbmp *wbmp, void (*putout)( int c, void *out), void *out); void freewbmp( Wbmp *wbmp ); -void printwbmp( Wbmp *wbmp ); +void printwbmp( Wbmp *wbmp ); #endif diff --git a/ext/gd/libgd/webpng.c b/ext/gd/libgd/webpng.c index f3c35e306f..81a00e749c 100644 --- a/ext/gd/libgd/webpng.c +++ b/ext/gd/libgd/webpng.c @@ -193,7 +193,7 @@ main (int argc, char **argv) maxy = gdImageSY(im); printf("alpha channel information:\n"); - + if (im->trueColor) { for (y = 0; y < maxy; y++) { for (x = 0; x < maxx; x++) { @@ -215,9 +215,9 @@ main (int argc, char **argv) } else printf("NOT a true color image\n"); - no = 0; + no = 0; printf("%d alpha channels\n", nalpha); - + } else { diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c index 100fe9b950..9c344fe999 100644 --- a/ext/gd/libgd/xbm.c +++ b/ext/gd/libgd/xbm.c @@ -46,7 +46,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd) int ch; char h[8]; unsigned int b; - + rewind(fd); while (fgets(fline, MAX_XBM_LINE_SIZE, fd)) { fline[MAX_XBM_LINE_SIZE-1] = '\0'; @@ -59,7 +59,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd) } else { type++; } - + if (!strcmp("width", type)) { width = (unsigned int) value; } @@ -159,7 +159,7 @@ void gdCtxPrintf(gdIOCtx * out, const char *format, ...) char *buf; int len; va_list args; - + va_start(args, format); len = vspprintf(&buf, 0, format, args); va_end(args); |