mirror of
https://github.com/php/php-src.git
synced 2025-01-10 13:03:54 +08:00
Nuke EOLs from error messages
This commit is contained in:
parent
98ce7bf37b
commit
b385e0ad39
@ -726,12 +726,12 @@ main (int argc, char *argv[])
|
||||
out = fopen ("test/arctest.png", "wb");
|
||||
if (!out)
|
||||
{
|
||||
php_gd_error("Can't create test/arctest.png\n");
|
||||
php_gd_error("Can't create test/arctest.png");
|
||||
exit (1);
|
||||
}
|
||||
gdImagePng (im, out);
|
||||
fclose (out);
|
||||
php_gd_error("Test image written to test/arctest.png\n");
|
||||
php_gd_error("Test image written to test/arctest.png");
|
||||
/* Destroy it */
|
||||
gdImageDestroy (im);
|
||||
|
||||
|
@ -60,7 +60,7 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
int sidx;
|
||||
int nc;
|
||||
|
||||
GD2_DBG(php_gd_error("Reading gd2 header info\n"));
|
||||
GD2_DBG(php_gd_error("Reading gd2 header info"));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
ch = gdGetC(in);
|
||||
@ -71,11 +71,11 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
}
|
||||
id[4] = 0;
|
||||
|
||||
GD2_DBG(php_gd_error("Got file code: %s\n", id));
|
||||
GD2_DBG(php_gd_error("Got file code: %s", id));
|
||||
|
||||
/* Equiv. of 'magick'. */
|
||||
if (strcmp(id, GD2_ID) != 0) {
|
||||
GD2_DBG(php_gd_error("Not a valid gd2 file\n"));
|
||||
GD2_DBG(php_gd_error("Not a valid gd2 file"));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
@ -83,32 +83,32 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
if (gdGetWord(vers, in) != 1) {
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Version: %d\n", *vers));
|
||||
GD2_DBG(php_gd_error("Version: %d", *vers));
|
||||
|
||||
if ((*vers != 1) && (*vers != 2)) {
|
||||
GD2_DBG(php_gd_error("Bad version: %d\n", *vers));
|
||||
GD2_DBG(php_gd_error("Bad version: %d", *vers));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
/* Image Size */
|
||||
if (!gdGetWord(sx, in)) {
|
||||
GD2_DBG(php_gd_error("Could not get x-size\n"));
|
||||
GD2_DBG(php_gd_error("Could not get x-size"));
|
||||
goto fail1;
|
||||
}
|
||||
if (!gdGetWord(sy, in)) {
|
||||
GD2_DBG(php_gd_error("Could not get y-size\n"));
|
||||
GD2_DBG(php_gd_error("Could not get y-size"));
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Image is %dx%d\n", *sx, *sy));
|
||||
GD2_DBG(php_gd_error("Image is %dx%d", *sx, *sy));
|
||||
|
||||
/* Chunk Size (pixels, not bytes!) */
|
||||
if (gdGetWord(cs, in) != 1) {
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("ChunkSize: %d\n", *cs));
|
||||
GD2_DBG(php_gd_error("ChunkSize: %d", *cs));
|
||||
|
||||
if ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {
|
||||
GD2_DBG(php_gd_error("Bad chunk size: %d\n", *cs));
|
||||
GD2_DBG(php_gd_error("Bad chunk size: %d", *cs));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
@ -116,10 +116,10 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
if (gdGetWord(fmt, in) != 1) {
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Format: %d\n", *fmt));
|
||||
GD2_DBG(php_gd_error("Format: %d", *fmt));
|
||||
|
||||
if ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {
|
||||
GD2_DBG(php_gd_error("Bad data format: %d\n", *fmt));
|
||||
GD2_DBG(php_gd_error("Bad data format: %d", *fmt));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
@ -127,17 +127,17 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
if (gdGetWord(ncx, in) != 1) {
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("%d Chunks Wide\n", *ncx));
|
||||
GD2_DBG(php_gd_error("%d Chunks Wide", *ncx));
|
||||
|
||||
/* # of chunks high */
|
||||
if (gdGetWord(ncy, in) != 1) {
|
||||
goto fail1;
|
||||
}
|
||||
GD2_DBG(php_gd_error("%d Chunks vertically\n", *ncy));
|
||||
GD2_DBG(php_gd_error("%d Chunks vertically", *ncy));
|
||||
|
||||
if (gd2_compressed(*fmt)) {
|
||||
nc = (*ncx) * (*ncy);
|
||||
GD2_DBG(php_gd_error("Reading %d chunk index entries\n", nc));
|
||||
GD2_DBG(php_gd_error("Reading %d chunk index entries", nc));
|
||||
sidx = sizeof(t_chunk_info) * nc;
|
||||
if (sidx <= 0) {
|
||||
goto fail1;
|
||||
@ -154,7 +154,7 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
*chunkIdx = cidx;
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("gd2 header complete\n"));
|
||||
GD2_DBG(php_gd_error("gd2 header complete"));
|
||||
|
||||
return 1;
|
||||
|
||||
@ -167,7 +167,7 @@ static gdImagePtr _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy, int *cs,
|
||||
gdImagePtr im;
|
||||
|
||||
if (_gd2GetHeader (in, sx, sy, cs, vers, fmt, ncx, ncy, cidx) != 1) {
|
||||
GD2_DBG(php_gd_error("Bad GD2 header\n"));
|
||||
GD2_DBG(php_gd_error("Bad GD2 header"));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
@ -177,15 +177,15 @@ static gdImagePtr _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy, int *cs,
|
||||
im = gdImageCreate(*sx, *sy);
|
||||
}
|
||||
if (im == NULL) {
|
||||
GD2_DBG(php_gd_error("Could not create gdImage\n"));
|
||||
GD2_DBG(php_gd_error("Could not create gdImage"));
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
if (!_gdGetColors(in, im, (*vers) == 2)) {
|
||||
GD2_DBG(php_gd_error("Could not read color palette\n"));
|
||||
GD2_DBG(php_gd_error("Could not read color palette"));
|
||||
goto fail2;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Image palette completed: %d colours\n", im->colorsTotal));
|
||||
GD2_DBG(php_gd_error("Image palette completed: %d colours", im->colorsTotal));
|
||||
|
||||
return im;
|
||||
|
||||
@ -202,24 +202,24 @@ static int _gd2ReadChunk (int offset, char *compBuf, int compSize, char *chunkBu
|
||||
int zerr;
|
||||
|
||||
if (gdTell(in) != offset) {
|
||||
GD2_DBG(php_gd_error("Positioning in file to %d\n", offset));
|
||||
GD2_DBG(php_gd_error("Positioning in file to %d", offset));
|
||||
gdSeek(in, offset);
|
||||
} else {
|
||||
GD2_DBG(php_gd_error("Already Positioned in file to %d\n", offset));
|
||||
GD2_DBG(php_gd_error("Already Positioned in file to %d", offset));
|
||||
}
|
||||
|
||||
/* Read and uncompress an entire chunk. */
|
||||
GD2_DBG(php_gd_error("Reading file\n"));
|
||||
GD2_DBG(php_gd_error("Reading file"));
|
||||
if (gdGetBuf(compBuf, compSize, in) != compSize) {
|
||||
return FALSE;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Got %d bytes. Uncompressing into buffer of %d bytes\n", compSize, (int)*chunkLen));
|
||||
GD2_DBG(php_gd_error("Got %d bytes. Uncompressing into buffer of %d bytes", compSize, (int)*chunkLen));
|
||||
zerr = uncompress((unsigned char *) chunkBuf, chunkLen, (unsigned char *) compBuf, compSize);
|
||||
if (zerr != Z_OK) {
|
||||
GD2_DBG(php_gd_error("Error %d from uncompress\n", zerr));
|
||||
GD2_DBG(php_gd_error("Error %d from uncompress", zerr));
|
||||
return FALSE;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Got chunk\n"));
|
||||
GD2_DBG(php_gd_error("Got chunk"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -291,7 +291,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));
|
||||
GD2_DBG(php_gd_error("Largest compressed chunk is %d bytes", compMax));
|
||||
}
|
||||
|
||||
/* Read the data... */
|
||||
@ -303,13 +303,13 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
yhi = im->sy;
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("Processing Chunk %d (%d, %d), y from %d to %d\n", chunkNum, cx, cy, ylo, yhi));
|
||||
GD2_DBG(php_gd_error("Processing Chunk %d (%d, %d), y from %d to %d", chunkNum, cx, cy, ylo, yhi));
|
||||
|
||||
if (gd2_compressed(fmt)) {
|
||||
chunkLen = chunkMax;
|
||||
|
||||
if (!_gd2ReadChunk(chunkIdx[chunkNum].offset, compBuf, chunkIdx[chunkNum].size, (char *) chunkBuf, &chunkLen, in)) {
|
||||
GD2_DBG(php_gd_error("Error reading comproessed chunk\n"));
|
||||
GD2_DBG(php_gd_error("Error reading comproessed chunk"));
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
}
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("Freeing memory\n"));
|
||||
GD2_DBG(php_gd_error("Freeing memory"));
|
||||
|
||||
if (chunkBuf) {
|
||||
gdFree(chunkBuf);
|
||||
@ -368,7 +368,7 @@ gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
|
||||
gdFree(chunkIdx);
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("Done\n"));
|
||||
GD2_DBG(php_gd_error("Done"));
|
||||
|
||||
return im;
|
||||
|
||||
@ -438,7 +438,7 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("File size is %dx%d\n", fsx, fsy));
|
||||
GD2_DBG(php_gd_error("File size is %dx%d", fsx, fsy));
|
||||
|
||||
/* This is the difference - make a file based on size of chunks. */
|
||||
if (gd2_truecolor(fmt)) {
|
||||
@ -453,7 +453,7 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
|
||||
if (!_gdGetColors(in, im, vers == 2)) {
|
||||
goto fail2;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Image palette completed: %d colours\n", im->colorsTotal));
|
||||
GD2_DBG(php_gd_error("Image palette completed: %d colours", im->colorsTotal));
|
||||
|
||||
/* Process the header info */
|
||||
nc = ncx * ncy;
|
||||
@ -502,7 +502,7 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
|
||||
|
||||
/* Remember file position of image data. */
|
||||
dstart = gdTell(in);
|
||||
GD2_DBG(php_gd_error("Data starts at %d\n", dstart));
|
||||
GD2_DBG(php_gd_error("Data starts at %d", dstart));
|
||||
|
||||
/* Loop through the chunks. */
|
||||
for (cy = scy; (cy <= ecy); cy++) {
|
||||
@ -520,10 +520,10 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
|
||||
xhi = fsx;
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("Processing Chunk (%d, %d), from %d to %d\n", cx, cy, ylo, yhi));
|
||||
GD2_DBG(php_gd_error("Processing Chunk (%d, %d), from %d to %d", cx, cy, ylo, yhi));
|
||||
|
||||
if (!gd2_compressed(fmt)) {
|
||||
GD2_DBG(php_gd_error("Using raw format data\n"));
|
||||
GD2_DBG(php_gd_error("Using raw format data"));
|
||||
if (im->trueColor) {
|
||||
dpos = (cy * (cs * fsx) * 4 + cx * cs * (yhi - ylo) * 4) + dstart;
|
||||
} else {
|
||||
@ -532,23 +532,23 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
|
||||
|
||||
/* gd 2.0.11: gdSeek returns TRUE on success, not 0. Longstanding bug. 01/16/03 */
|
||||
if (!gdSeek(in, dpos)) {
|
||||
php_gd_error_ex(E_WARNING, "Error from seek: %d\n", errno);
|
||||
php_gd_error_ex(E_WARNING, "Error from seek: %d", errno);
|
||||
goto fail2;
|
||||
}
|
||||
GD2_DBG(php_gd_error("Reading (%d, %d) from position %d\n", cx, cy, dpos - dstart));
|
||||
GD2_DBG(php_gd_error("Reading (%d, %d) from position %d", cx, cy, dpos - dstart));
|
||||
} else {
|
||||
chunkNum = cx + cy * ncx;
|
||||
|
||||
chunkLen = chunkMax;
|
||||
if (!_gd2ReadChunk (chunkIdx[chunkNum].offset, compBuf, chunkIdx[chunkNum].size, chunkBuf, &chunkLen, in)) {
|
||||
php_gd_error("Error reading comproessed chunk\n");
|
||||
php_gd_error("Error reading comproessed chunk");
|
||||
goto fail2;
|
||||
}
|
||||
chunkPos = 0;
|
||||
GD2_DBG(php_gd_error("Reading (%d, %d) from chunk %d\n", cx, cy, chunkNum));
|
||||
GD2_DBG(php_gd_error("Reading (%d, %d) from chunk %d", cx, cy, chunkNum));
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error(" into (%d, %d) - (%d, %d)\n", xlo, ylo, xhi, yhi));
|
||||
GD2_DBG(php_gd_error(" into (%d, %d) - (%d, %d)", xlo, ylo, xhi, yhi));
|
||||
|
||||
for (y = ylo; (y < yhi); y++) {
|
||||
for (x = xlo; x < xhi; x++) {
|
||||
@ -701,7 +701,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
*/
|
||||
idxPos = gdTell(out);
|
||||
idxSize = ncx * ncy * sizeof(t_chunk_info);
|
||||
GD2_DBG(php_gd_error("Index size is %d\n", idxSize));
|
||||
GD2_DBG(php_gd_error("Index size is %d", idxSize));
|
||||
gdSeek(out, idxPos + idxSize);
|
||||
|
||||
chunkIdx = safe_emalloc(idxSize, sizeof(t_chunk_info), 0);
|
||||
@ -710,8 +710,8 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
|
||||
_gdPutColors (im, out);
|
||||
|
||||
GD2_DBG(php_gd_error("Size: %dx%d\n", im->sx, im->sy));
|
||||
GD2_DBG(php_gd_error("Chunks: %dx%d\n", ncx, ncy));
|
||||
GD2_DBG(php_gd_error("Size: %dx%d", im->sx, im->sy));
|
||||
GD2_DBG(php_gd_error("Chunks: %dx%d", ncx, ncy));
|
||||
|
||||
for (cy = 0; (cy < ncy); cy++) {
|
||||
for (cx = 0; (cx < ncx); cx++) {
|
||||
@ -721,7 +721,7 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
yhi = im->sy;
|
||||
}
|
||||
|
||||
GD2_DBG(php_gd_error("Processing Chunk (%dx%d), y from %d to %d\n", cx, cy, ylo, yhi));
|
||||
GD2_DBG(php_gd_error("Processing Chunk (%dx%d), y from %d to %d", cx, cy, ylo, yhi));
|
||||
chunkLen = 0;
|
||||
for (y = ylo; (y < yhi); y++) {
|
||||
GD2_DBG(php_gd_error("y=%d: ",y));
|
||||
@ -755,21 +755,21 @@ 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.",y));
|
||||
}
|
||||
|
||||
if (gd2_compressed(fmt)) {
|
||||
compLen = compMax;
|
||||
if (compress((unsigned char *) &compData[0], &compLen, (unsigned char *) &chunkData[0], chunkLen) != Z_OK) {
|
||||
php_gd_error("Error from compressing\n");
|
||||
php_gd_error("Error from compressing");
|
||||
} else {
|
||||
chunkIdx[chunkNum].offset = gdTell(out);
|
||||
chunkIdx[chunkNum++].size = compLen;
|
||||
GD2_DBG(php_gd_error("Chunk %d size %d offset %d\n", chunkNum, chunkIdx[chunkNum - 1].size, chunkIdx[chunkNum - 1].offset));
|
||||
GD2_DBG(php_gd_error("Chunk %d size %d offset %d", chunkNum, chunkIdx[chunkNum - 1].size, chunkIdx[chunkNum - 1].offset));
|
||||
|
||||
if (gdPutBuf (compData, compLen, out) <= 0) {
|
||||
/* Any alternate suggestions for handling this? */
|
||||
php_gd_error_ex(E_WARNING, "Error %d on write\n", errno);
|
||||
php_gd_error_ex(E_WARNING, "Error %d on write", errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -778,19 +778,19 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
|
||||
|
||||
if (gd2_compressed(fmt)) {
|
||||
/* Save the position, write the index, restore position (paranoia). */
|
||||
GD2_DBG(php_gd_error("Seeking %d to write index\n", idxPos));
|
||||
GD2_DBG(php_gd_error("Seeking %d to write index", idxPos));
|
||||
posSave = gdTell(out);
|
||||
gdSeek(out, idxPos);
|
||||
GD2_DBG(php_gd_error("Writing index\n"));
|
||||
GD2_DBG(php_gd_error("Writing index"));
|
||||
for (x = 0; x < chunkNum; x++) {
|
||||
GD2_DBG(php_gd_error("Chunk %d size %d offset %d\n", x, chunkIdx[x].size, chunkIdx[x].offset));
|
||||
GD2_DBG(php_gd_error("Chunk %d size %d offset %d", x, chunkIdx[x].size, chunkIdx[x].offset));
|
||||
gdPutInt(chunkIdx[x].offset, out);
|
||||
gdPutInt(chunkIdx[x].size, out);
|
||||
}
|
||||
gdSeek(out, posSave);
|
||||
}
|
||||
fail:
|
||||
GD2_DBG(php_gd_error("Freeing memory\n"));
|
||||
GD2_DBG(php_gd_error("Freeing memory"));
|
||||
if (chunkData) {
|
||||
gdFree(chunkData);
|
||||
}
|
||||
@ -800,7 +800,7 @@ fail:
|
||||
if (chunkIdx) {
|
||||
gdFree(chunkIdx);
|
||||
}
|
||||
GD2_DBG(php_gd_error("Done\n"));
|
||||
GD2_DBG(php_gd_error("Done"));
|
||||
}
|
||||
|
||||
void gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt)
|
||||
|
@ -359,7 +359,7 @@ GetCode(gdIOCtx *fd, int code_size, int flag)
|
||||
int rv;
|
||||
|
||||
rv = GetCode_(fd,code_size,flag);
|
||||
if (VERBOSE) php_gd_error_ex(E_NOTICE, "[GetCode(,%d,%d) returning %d]\n",code_size,flag,rv);
|
||||
if (VERBOSE) php_gd_error_ex(E_NOTICE, "[GetCode(,%d,%d) returning %d]",code_size,flag,rv);
|
||||
return(rv);
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ LWZReadByte(gdIOCtx *fd, int flag, int input_code_size)
|
||||
int rv;
|
||||
|
||||
rv = LWZReadByte_(fd,flag,input_code_size);
|
||||
if (VERBOSE) php_gd_error_ex(E_NOTICE, "[LWZReadByte(,%d,%d) returning %d]\n",flag,input_code_size,rv);
|
||||
if (VERBOSE) php_gd_error_ex(E_NOTICE, "[LWZReadByte(,%d,%d) returning %d]",flag,input_code_size,rv);
|
||||
return(rv);
|
||||
}
|
||||
|
||||
|
@ -52,20 +52,20 @@ void gdPutC (const unsigned char c, gdIOCtx * ctx)
|
||||
|
||||
void gdPutWord (int w, gdIOCtx * ctx)
|
||||
{
|
||||
IO_DBG (php_gd_error("Putting word...\n"));
|
||||
IO_DBG (php_gd_error("Putting word..."));
|
||||
(ctx->putC) (ctx, (unsigned char) (w >> 8));
|
||||
(ctx->putC) (ctx, (unsigned char) (w & 0xFF));
|
||||
IO_DBG (php_gd_error("put.\n"));
|
||||
IO_DBG (php_gd_error("put."));
|
||||
}
|
||||
|
||||
void gdPutInt (int w, gdIOCtx * ctx)
|
||||
{
|
||||
IO_DBG (php_gd_error("Putting int...\n"));
|
||||
IO_DBG (php_gd_error("Putting int..."));
|
||||
(ctx->putC) (ctx, (unsigned char) (w >> 24));
|
||||
(ctx->putC) (ctx, (unsigned char) ((w >> 16) & 0xFF));
|
||||
(ctx->putC) (ctx, (unsigned char) ((w >> 8) & 0xFF));
|
||||
(ctx->putC) (ctx, (unsigned char) (w & 0xFF));
|
||||
IO_DBG (php_gd_error("put.\n"));
|
||||
IO_DBG (php_gd_error("put."));
|
||||
}
|
||||
|
||||
int gdGetC (gdIOCtx * ctx)
|
||||
@ -121,9 +121,9 @@ int gdGetInt (int *result, gdIOCtx * ctx)
|
||||
|
||||
int gdPutBuf (const void *buf, int size, gdIOCtx * ctx)
|
||||
{
|
||||
IO_DBG (php_gd_error("Putting buf...\n"));
|
||||
IO_DBG (php_gd_error("Putting buf..."));
|
||||
return (ctx->putBuf) (ctx, buf, size);
|
||||
IO_DBG (php_gd_error("put.\n"));
|
||||
IO_DBG (php_gd_error("put."));
|
||||
}
|
||||
|
||||
int gdGetBuf (void *buf, int size, gdIOCtx * ctx)
|
||||
@ -133,14 +133,14 @@ int gdGetBuf (void *buf, int size, gdIOCtx * ctx)
|
||||
|
||||
int gdSeek (gdIOCtx * ctx, const int pos)
|
||||
{
|
||||
IO_DBG (php_gd_error("Seeking...\n"));
|
||||
IO_DBG (php_gd_error("Seeking..."));
|
||||
return ((ctx->seek) (ctx, pos));
|
||||
IO_DBG (php_gd_error("Done.\n"));
|
||||
IO_DBG (php_gd_error("Done."));
|
||||
}
|
||||
|
||||
long gdTell (gdIOCtx * ctx)
|
||||
{
|
||||
IO_DBG (php_gd_error("Telling...\n"));
|
||||
IO_DBG (php_gd_error("Telling..."));
|
||||
return ((ctx->tell) (ctx));
|
||||
IO_DBG (php_gd_error ("told.\n"));
|
||||
IO_DBG (php_gd_error ("told."));
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
|
||||
|
||||
nlines = jpeg_write_scanlines (&cinfo, rowptr, 1);
|
||||
if (nlines != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1\n", nlines);
|
||||
php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1", nlines);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -197,7 +197,7 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
|
||||
|
||||
nlines = jpeg_write_scanlines (&cinfo, rowptr, 1);
|
||||
if (nlines != 1) {
|
||||
php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1\n", nlines);
|
||||
php_gd_error_ex(E_WARNING, "gd_jpeg: warning: jpeg_write_scanlines returns %u -- expected 1", nlines);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ static void gdPngErrorHandler (png_structp png_ptr, png_const_charp msg)
|
||||
* been defined.
|
||||
*/
|
||||
|
||||
php_gd_error_ex(E_ERROR, "gd-png: fatal libpng error: %s\n", msg);
|
||||
php_gd_error_ex(E_ERROR, "gd-png: fatal libpng error: %s", msg);
|
||||
|
||||
jmpbuf_ptr = png_get_error_ptr (png_ptr);
|
||||
if (jmpbuf_ptr == NULL) { /* we are completely hosed now */
|
||||
php_gd_error_ex(E_ERROR, "gd-png: EXTREMELY fatal error: jmpbuf unrecoverable; terminating.\n");
|
||||
php_gd_error_ex(E_ERROR, "gd-png: EXTREMELY fatal error: jmpbuf unrecoverable; terminating.");
|
||||
}
|
||||
|
||||
longjmp (jmpbuf_ptr->jmpbuf, 1);
|
||||
@ -142,13 +142,13 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
#endif
|
||||
if (png_ptr == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate libpng main struct\n");
|
||||
php_gd_error("gd-png error: cannot allocate libpng main struct");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate libpng info struct\n");
|
||||
php_gd_error("gd-png error: cannot allocate libpng info struct");
|
||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||
|
||||
return NULL;
|
||||
@ -164,7 +164,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
*/
|
||||
#ifndef PNG_SETJMP_NOT_SUPPORTED
|
||||
if (setjmp(gdPngJmpbufStruct.jmpbuf)) {
|
||||
php_gd_error("gd-png error: setjmp returns error condition\n");
|
||||
php_gd_error("gd-png error: setjmp returns error condition");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
return NULL;
|
||||
@ -183,7 +183,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
im = gdImageCreate((int) width, (int) height);
|
||||
}
|
||||
if (im == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate gdImage struct\n");
|
||||
php_gd_error("gd-png error: cannot allocate gdImage struct");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
gdFree(image_data);
|
||||
gdFree(row_pointers);
|
||||
@ -201,7 +201,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
|
||||
#ifdef DEBUG
|
||||
php_gd_error("gd-png color_type is palette, colors: %d\n", num_palette);
|
||||
php_gd_error("gd-png color_type is palette, colors: %d", num_palette);
|
||||
#endif /* DEBUG */
|
||||
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) {
|
||||
/* gd 2.0: we support this rather thoroughly now. Grab the
|
||||
@ -225,7 +225,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
/* create a fake palette and check for single-shade transparency */
|
||||
if ((palette = (png_colorp) gdMalloc (256 * sizeof (png_color))) == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate gray palette\n");
|
||||
php_gd_error("gd-png error: cannot allocate gray palette");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
return NULL;
|
||||
@ -369,7 +369,7 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
|
||||
if (!im->trueColor) {
|
||||
for (i = num_palette; i < gdMaxColors; ++i) {
|
||||
if (!open[i]) {
|
||||
php_gd_error("gd-png warning: image data references out-of-range color index (%d)\n", i);
|
||||
php_gd_error("gd-png warning: image data references out-of-range color index (%d)", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -450,13 +450,13 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
#endif
|
||||
if (png_ptr == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate libpng main struct\n");
|
||||
php_gd_error("gd-png error: cannot allocate libpng main struct");
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
php_gd_error("gd-png error: cannot allocate libpng info struct\n");
|
||||
php_gd_error("gd-png error: cannot allocate libpng info struct");
|
||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||
|
||||
return;
|
||||
@ -464,7 +464,7 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
|
||||
|
||||
#ifndef PNG_SETJMP_NOT_SUPPORTED
|
||||
if (setjmp (gdPngJmpbufStruct.jmpbuf)) {
|
||||
php_gd_error("gd-png error: setjmp returns error condition\n");
|
||||
php_gd_error("gd-png error: setjmp returns error condition");
|
||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||
|
||||
return;
|
||||
|
@ -38,11 +38,11 @@ gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
|
||||
#else /* no HAVE_LIBPNG */
|
||||
void gdImagePngToSink (gdImagePtr im, gdSinkPtr outSink)
|
||||
{
|
||||
php_gd_error("PNG support is not available\n");
|
||||
php_gd_error("PNG support is not available");
|
||||
}
|
||||
gdImagePtr gdImageCreateFromPngSource (gdSourcePtr inSource)
|
||||
{
|
||||
php_gd_error("PNG support is not available\n");
|
||||
php_gd_error("PNG support is not available");
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_LIBPNG */
|
||||
|
@ -98,7 +98,7 @@ void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out)
|
||||
|
||||
/* create the WBMP */
|
||||
if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) {
|
||||
php_gd_error("Could not create WBMP\n");
|
||||
php_gd_error("Could not create WBMP");
|
||||
}
|
||||
|
||||
/* fill up the WBMP structure */
|
||||
@ -114,7 +114,7 @@ void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out)
|
||||
|
||||
/* write the WBMP to a gd file descriptor */
|
||||
if (writewbmp (wbmp, &gd_putout, out)) {
|
||||
php_gd_error("Could not save WBMP\n");
|
||||
php_gd_error("Could not save WBMP");
|
||||
}
|
||||
/* des submitted this bugfix: gdFree the memory. */
|
||||
freewbmp(wbmp);
|
||||
|
@ -117,7 +117,7 @@ gdImagePtr gdImageCreateFromXpm (char *filename)
|
||||
|
||||
colors[i] = gdImageColorResolve(im, red, green, blue);
|
||||
if (colors[i] == -1) {
|
||||
php_gd_error("ARRRGH\n");
|
||||
php_gd_error("ARRRGH");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
|
||||
}
|
||||
}
|
||||
|
||||
php_gd_error("EOF before image was complete\n");
|
||||
php_gd_error("EOF before image was complete");
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user