use gdIOCtxPtr more consistently

We have gdIOCtxPtr for gdIOCtx*, so switch the public headers to it
consistently.
master
Mike Frysinger 2021-05-28 21:19:20 -04:00
parent df8f989825
commit 19c7a5d651
8 changed files with 149 additions and 153 deletions

View File

@ -646,45 +646,45 @@ BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
stays truecolor; palette PNG stays palette-based;
JPEG is always truecolor. */
BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx(gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
/* These read the first frame only */
BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegEx (FILE * infile, int ignore_warning);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtxEx(gdIOCtxPtr infile, int ignore_warning);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromHeif(FILE *inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromHeifPtr(int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromHeifCtx(gdIOCtx *infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromHeifCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromAvif(FILE *inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifPtr(int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifCtx(gdIOCtx *infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTiff(FILE *inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtx *infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTga( FILE * fp );
BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtxPtr ctx);
BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaPtr(int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromBmp (FILE * inFile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx (gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx(gdIOCtxPtr infile);
BGD_DECLARE(gdImagePtr) gdImageCreateFromFile(const char *filename);
@ -725,22 +725,22 @@ gdSource, *gdSourcePtr;
BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx(gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx(gdIOCtxPtr in);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
int h);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx(gdIOCtxPtr in, int srcx, int srcy,
int w, int h);
BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
int w, int h);
/* 2.0.10: prototype was missing */
BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtxPtr out);
/* NOTE: filename, not FILE */
BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename);
@ -1086,11 +1086,11 @@ BGD_DECLARE(int) gdImageColorReplaceCallback(gdImagePtr im, gdCallbackImageColor
BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out);
BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out);
BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out);
BGD_DECLARE(void) gdImagePngCtx(gdImagePtr im, gdIOCtxPtr out);
BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile);
BGD_DECLARE(void *) gdImageTiffPtr(gdImagePtr im, int *size);
BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out);
BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtxPtr out);
BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression);
BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression);
@ -1101,10 +1101,10 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
compression (smallest files) but takes a long time to compress, and
-1 selects the default compiled into the zlib library. */
BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
BGD_DECLARE(void) gdImagePngCtxEx(gdImagePtr im, gdIOCtxPtr out, int level);
BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtxPtr out);
BGD_DECLARE(int) gdImageFile(gdImagePtr im, const char *filename);
BGD_DECLARE(int) gdSupportsFileType(const char *filename, int writing);
@ -1120,7 +1120,7 @@ BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
/* 100 is highest quality (there is always a little loss with JPEG).
0 is lowest. 10 is about the lowest useful setting. */
BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtxPtr out, int quality);
/* Best to free this memory with gdFree(), not free() */
BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality);
@ -1129,19 +1129,19 @@ BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization
BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile);
BGD_DECLARE(void *) gdImageWebpPtr (gdImagePtr im, int *size);
BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quantization);
BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
BGD_DECLARE(void) gdImageWebpCtx(gdImagePtr im, gdIOCtxPtr outfile, int quantization);
BGD_DECLARE(void) gdImageHeifEx(gdImagePtr im, FILE *outFile, int quality, gdHeifCodec codec, gdHeifChroma chroma);
BGD_DECLARE(void) gdImageHeif(gdImagePtr im, FILE *outFile);
BGD_DECLARE(void *) gdImageHeifPtr(gdImagePtr im, int *size);
BGD_DECLARE(void *) gdImageHeifPtrEx(gdImagePtr im, int *size, int quality, gdHeifCodec codec, gdHeifChroma chroma);
BGD_DECLARE(void) gdImageHeifCtx(gdImagePtr im, gdIOCtx *outfile, int quality, gdHeifCodec codec, gdHeifChroma chroma);
BGD_DECLARE(void) gdImageHeifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, gdHeifCodec codec, gdHeifChroma chroma);
BGD_DECLARE(void) gdImageAvif(gdImagePtr im, FILE *outFile);
BGD_DECLARE(void) gdImageAvifEx(gdImagePtr im, FILE *outFile, int quality, int speed);
BGD_DECLARE(void *) gdImageAvifPtr(gdImagePtr im, int *size);
BGD_DECLARE(void *) gdImageAvifPtrEx(gdImagePtr im, int *size, int quality, int speed);
BGD_DECLARE(void) gdImageAvifCtx(gdImagePtr im, gdIOCtx *outfile, int quality, int speed);
BGD_DECLARE(void) gdImageAvifCtx(gdImagePtr im, gdIOCtxPtr outfile, int quality, int speed);
/**
* Group: GifAnim
@ -1169,9 +1169,9 @@ enum {
BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops);
BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out);
BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtxPtr out, int GlobalCM, int Loops);
BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtxPtr out);
BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
@ -1544,14 +1544,14 @@ BGD_DECLARE(gdImagePtr) gdImageCopyGaussianBlurred(gdImagePtr src, int radius,
/* I/O Support routines. */
BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
BGD_DECLARE(gdIOCtxPtr) gdNewFileCtx(FILE *);
/* If data is null, size is ignored and an initial data buffer is
allocated automatically. NOTE: this function assumes gd has the right
to free or reallocate "data" at will! Also note that gd will free
"data" when the IO context is freed. If data is not null, it must point
to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
If not, see gdNewDynamicCtxEx for an alternative. */
BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
BGD_DECLARE(gdIOCtxPtr) gdNewDynamicCtx(int size, void *data);
/* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
needed as described above. If freeFlag is zero, gd will never free
or reallocate "data", which means that the context should only be used
@ -1560,9 +1560,9 @@ BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
not large enough and an image write is attempted, the write operation
will fail. Those wishing to write an image to a buffer in memory have
a much simpler alternative in the gdImage[something]Ptr functions. */
BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
BGD_DECLARE(gdIOCtxPtr) gdNewDynamicCtxEx(int size, void *data, int freeFlag);
BGD_DECLARE(gdIOCtxPtr) gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
BGD_DECLARE(void *) gdDPExtractData(gdIOCtxPtr ctx, int *size);
#define GD2_CHUNKSIZE 128
#define GD2_CHUNKSIZE_MIN 64

View File

@ -39,52 +39,48 @@ extern "C" {
> typedef struct gdIOCtx
> {
> int (*getC) (struct gdIOCtx *);
> int (*getBuf) (struct gdIOCtx *, void *, int wanted);
> int (*getC)(gdIOCtxPtr);
> int (*getBuf)(gdIOCtxPtr, void *, int wanted);
>
> void (*putC) (struct gdIOCtx *, int);
> int (*putBuf) (struct gdIOCtx *, const void *, int wanted);
> void (*putC)(gdIOCtxPtr, int);
> int (*putBuf)(gdIOCtxPtr, const void *, int wanted);
>
> // seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek!
> int (*seek) (struct gdIOCtx *, const int);
> long (*tell) (struct gdIOCtx *);
> int (*seek)(gdIOCtxPtr, const int);
> long (*tell)(gdIOCtxPtr);
>
> void (*gd_free) (struct gdIOCtx *);
> void (*gd_free)(gdIOCtxPtr);
> } gdIOCtx;
*/
typedef struct gdIOCtx *gdIOCtxPtr;
typedef struct gdIOCtx {
int (*getC)(struct gdIOCtx *);
int (*getBuf)(struct gdIOCtx *, void *, int);
void (*putC)(struct gdIOCtx *, int);
int (*putBuf)(struct gdIOCtx *, const void *, int);
int (*getC)(gdIOCtxPtr);
int (*getBuf)(gdIOCtxPtr, void *, int);
void (*putC)(gdIOCtxPtr, int);
int (*putBuf)(gdIOCtxPtr, const void *, int);
/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek)(struct gdIOCtx *, const int);
long (*tell)(struct gdIOCtx *);
void (*gd_free)(struct gdIOCtx *);
int (*seek)(gdIOCtxPtr, const int);
long (*tell)(gdIOCtxPtr);
void (*gd_free)(gdIOCtxPtr);
void *data;
} gdIOCtx;
typedef struct gdIOCtx *gdIOCtxPtr;
void gdPutC(const unsigned char c, gdIOCtxPtr ctx);
int gdPutBuf(const void *, int, gdIOCtxPtr);
void gdPutWord(int w, gdIOCtxPtr ctx);
void gdPutInt(int w, gdIOCtxPtr ctx);
void gdPutC(const unsigned char c, gdIOCtx *ctx);
int gdPutBuf(const void *, int, gdIOCtx *);
void gdPutWord(int w, gdIOCtx *ctx);
void gdPutInt(int w, gdIOCtx *ctx);
int gdGetC(gdIOCtxPtr ctx);
int gdGetBuf(void *, int, gdIOCtxPtr);
int gdGetByte(int *result, gdIOCtxPtr ctx);
int gdGetWord(int *result, gdIOCtxPtr ctx);
int gdGetWordLSB(signed short int *result, gdIOCtxPtr ctx);
int gdGetInt(int *result, gdIOCtxPtr ctx);
int gdGetIntLSB(signed int *result, gdIOCtxPtr ctx);
int gdGetC(gdIOCtx *ctx);
int gdGetBuf(void *, int, gdIOCtx *);
int gdGetByte(int *result, gdIOCtx *ctx);
int gdGetWord(int *result, gdIOCtx *ctx);
int gdGetWordLSB(signed short int *result, gdIOCtx *ctx);
int gdGetInt(int *result, gdIOCtx *ctx);
int gdGetIntLSB(signed int *result, gdIOCtx *ctx);
int gdSeek(gdIOCtx *ctx, const int offset);
long gdTell(gdIOCtx *ctx);
int gdSeek(gdIOCtxPtr ctx, const int offset);
long gdTell(gdIOCtxPtr ctx);
#ifdef __cplusplus
}

View File

@ -52,17 +52,17 @@ static int allocDynamic(dynamicPtr *dp, int initialSize, void *data);
static int appendDynamic(dynamicPtr *dp, const void *src, int size);
static int gdReallocDynamic(dynamicPtr *dp, int required);
static int trimDynamic(dynamicPtr *dp);
static void gdFreeDynamicCtx(struct gdIOCtx *ctx);
static void gdFreeDynamicCtx(gdIOCtxPtr ctx);
static dynamicPtr *newDynamic(int initialSize, void *data, int freeOKFlag);
static int dynamicPutbuf(struct gdIOCtx *, const void *, int);
static void dynamicPutchar(struct gdIOCtx *, int a);
static int dynamicPutbuf(gdIOCtxPtr, const void *, int);
static void dynamicPutchar(gdIOCtxPtr, int a);
static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len);
static int dynamicGetchar(gdIOCtxPtr ctx);
static int dynamicSeek(struct gdIOCtx *, const int);
static long dynamicTell(struct gdIOCtx *);
static int dynamicSeek(gdIOCtxPtr, const int);
static long dynamicTell(gdIOCtxPtr);
/*
Function: gdNewDynamicCtx
@ -113,7 +113,7 @@ BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx(int initialSize, void *data, int freeOK
/*
Function: gdDPExtractData
*/
BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size)
BGD_DECLARE(void *) gdDPExtractData(gdIOCtxPtr ctx, int *size)
{
dynamicPtr *dp;
dpIOCtx *dctx;
@ -143,7 +143,7 @@ BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size)
return data;
}
static void gdFreeDynamicCtx(struct gdIOCtx *ctx)
static void gdFreeDynamicCtx(gdIOCtxPtr ctx)
{
dynamicPtr *dp;
dpIOCtx *dctx;
@ -166,7 +166,7 @@ static void gdFreeDynamicCtx(struct gdIOCtx *ctx)
gdFree(dp);
}
static long dynamicTell(struct gdIOCtx *ctx)
static long dynamicTell(gdIOCtxPtr ctx)
{
dpIOCtx *dctx;
@ -174,7 +174,7 @@ static long dynamicTell(struct gdIOCtx *ctx)
return (dctx->dp->pos);
}
static int dynamicSeek(struct gdIOCtx *ctx, const int pos)
static int dynamicSeek(gdIOCtxPtr ctx, const int pos)
{
int bytesNeeded;
dynamicPtr *dp;
@ -241,7 +241,7 @@ static dynamicPtr *newDynamic(int initialSize, void *data, int freeOKFlag)
return dp;
}
static int dynamicPutbuf(struct gdIOCtx *ctx, const void *buf, int size)
static int dynamicPutbuf(gdIOCtxPtr ctx, const void *buf, int size)
{
dpIOCtx *dctx;
dctx = (dpIOCtx *)ctx;
@ -255,7 +255,7 @@ static int dynamicPutbuf(struct gdIOCtx *ctx, const void *buf, int size)
};
}
static void dynamicPutchar(struct gdIOCtx *ctx, int a)
static void dynamicPutchar(gdIOCtxPtr ctx, int a)
{
unsigned char b;
dpIOCtxPtr dctx;

View File

@ -37,23 +37,23 @@ typedef struct fileIOCtx {
}
fileIOCtx;
gdIOCtx *newFileCtx(FILE *f);
gdIOCtxPtr newFileCtx(FILE *f);
static int fileGetbuf(gdIOCtx *, void *, int);
static int filePutbuf(gdIOCtx *, const void *, int);
static void filePutchar(gdIOCtx *, int);
static int fileGetchar(gdIOCtx *ctx);
static int fileGetbuf(gdIOCtxPtr, void *, int);
static int filePutbuf(gdIOCtxPtr, const void *, int);
static void filePutchar(gdIOCtxPtr, int);
static int fileGetchar(gdIOCtxPtr ctx);
static int fileSeek(struct gdIOCtx *, const int);
static long fileTell(struct gdIOCtx *);
static void gdFreeFileCtx(gdIOCtx *ctx);
static int fileSeek(gdIOCtxPtr, const int);
static long fileTell(gdIOCtxPtr);
static void gdFreeFileCtx(gdIOCtxPtr ctx);
/*
Function: gdNewFileCtx
Return data as a dynamic pointer.
*/
BGD_DECLARE(gdIOCtx *) gdNewFileCtx(FILE *f)
BGD_DECLARE(gdIOCtxPtr) gdNewFileCtx(FILE *f)
{
fileIOCtx *ctx;
@ -76,16 +76,16 @@ BGD_DECLARE(gdIOCtx *) gdNewFileCtx(FILE *f)
ctx->ctx.gd_free = gdFreeFileCtx;
return (gdIOCtx *)ctx;
return (gdIOCtxPtr)ctx;
}
static void gdFreeFileCtx(gdIOCtx *ctx)
static void gdFreeFileCtx(gdIOCtxPtr ctx)
{
gdFree(ctx);
}
static int filePutbuf(gdIOCtx *ctx, const void *buf, int size)
static int filePutbuf(gdIOCtxPtr ctx, const void *buf, int size)
{
fileIOCtx *fctx;
fctx = (fileIOCtx *)ctx;
@ -93,7 +93,7 @@ static int filePutbuf(gdIOCtx *ctx, const void *buf, int size)
return fwrite(buf, 1, size, fctx->f);
}
static int fileGetbuf(gdIOCtx *ctx, void *buf, int size)
static int fileGetbuf(gdIOCtxPtr ctx, void *buf, int size)
{
fileIOCtx *fctx;
fctx = (fileIOCtx *)ctx;
@ -101,7 +101,7 @@ static int fileGetbuf(gdIOCtx *ctx, void *buf, int size)
return (fread(buf, 1, size, fctx->f));
}
static void filePutchar(gdIOCtx *ctx, int a)
static void filePutchar(gdIOCtxPtr ctx, int a)
{
unsigned char b;
fileIOCtx *fctx;
@ -112,7 +112,7 @@ static void filePutchar(gdIOCtx *ctx, int a)
putc(b, fctx->f);
}
static int fileGetchar(gdIOCtx *ctx)
static int fileGetchar(gdIOCtxPtr ctx)
{
fileIOCtx *fctx;
fctx = (fileIOCtx *)ctx;
@ -120,14 +120,14 @@ static int fileGetchar(gdIOCtx *ctx)
return getc(fctx->f);
}
static int fileSeek(struct gdIOCtx *ctx, const int pos)
static int fileSeek(gdIOCtxPtr ctx, const int pos)
{
fileIOCtx *fctx;
fctx = (fileIOCtx *)ctx;
return (fseek(fctx->f, pos, SEEK_SET) == 0);
}
static long fileTell (struct gdIOCtx *ctx)
static long fileTell(gdIOCtxPtr ctx)
{
fileIOCtx *fctx;
fctx = (fileIOCtx *)ctx;

View File

@ -25,7 +25,7 @@
If an error occurs, or the end-of-file is reached, the return value
is a short byte count (or zero).
*/
int istreamIOCtx::Getbuf (struct gdIOCtx * ctx, void * buf, int size)
int istreamIOCtx::Getbuf(gdIOCtxPtr ctx, void *buf, int size)
{
stream_type * _str = ( (istreamIOCtx * ) ctx )->_M_stream;
_str->read((char * )buf, size);
@ -36,7 +36,7 @@ int istreamIOCtx::Getbuf (struct gdIOCtx * ctx, void * buf, int size)
If an error occurs, or the end-of-file is reached, the return value
is a short byte count (or zero).
*/
int istreamIOCtx::Putbuf (struct gdIOCtx * , const void * , int )
int istreamIOCtx::Putbuf(gdIOCtxPtr, const void *, int)
{
return 0;
}
@ -44,7 +44,7 @@ int istreamIOCtx::Putbuf (struct gdIOCtx * , const void * , int )
/** Reads the next character from stream and returns it as an
unsigned char cast to an int, or EOF on end of file or error.
*/
int istreamIOCtx::Getchar (struct gdIOCtx * ctx)
int istreamIOCtx::Getchar(gdIOCtxPtr ctx)
{
stream_type * _str = ( (istreamIOCtx * ) ctx )->_M_stream;
return _str->get();
@ -52,14 +52,14 @@ int istreamIOCtx::Getchar (struct gdIOCtx * ctx)
/** Write the character to stream
Character is cast to unsigned char before writing
*/
void istreamIOCtx::Putchar (struct gdIOCtx * , int )
void istreamIOCtx::Putchar(gdIOCtxPtr, int)
{
}
/** Seek to position offset from the beginning of the stream
must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek!
*/
int istreamIOCtx::Seek (struct gdIOCtx * ctx, const int pos)
int istreamIOCtx::Seek(gdIOCtxPtr ctx, const int pos)
{
stream_type * _str = ( (istreamIOCtx * ) ctx )->_M_stream;
_str->seekg(pos);
@ -68,14 +68,14 @@ int istreamIOCtx::Seek (struct gdIOCtx * ctx, const int pos)
/** Obtains the current value of the stream position.
Returns -1 on error.
*/
long istreamIOCtx::Tell (struct gdIOCtx * ctx)
long istreamIOCtx::Tell(gdIOCtxPtr ctx)
{
stream_type * _str = ( (istreamIOCtx * ) ctx )->_M_stream;
return _str->tellg();
}
/** Deallocate the context
*/
void istreamIOCtx::FreeCtx (struct gdIOCtx * ctx)
void istreamIOCtx::FreeCtx(gdIOCtxPtr ctx)
{
delete (istreamIOCtx * )ctx;
}
@ -85,7 +85,7 @@ void istreamIOCtx::FreeCtx (struct gdIOCtx * ctx)
If an error occurs, or the end-of-file is reached, the return value
is a short byte count (or zero).
*/
int ostreamIOCtx::Getbuf (struct gdIOCtx * , void * , int )
int ostreamIOCtx::Getbuf(gdIOCtxPtr, void *, int)
{
return 0;
}
@ -94,7 +94,7 @@ int ostreamIOCtx::Getbuf (struct gdIOCtx * , void * , int )
If an error occurs, or the end-of-file is reached, the return value
is a short byte count (or zero).
*/
int ostreamIOCtx::Putbuf (struct gdIOCtx * ctx, const void * buf, int size)
int ostreamIOCtx::Putbuf(gdIOCtxPtr ctx, const void * buf, int size)
{
stream_type * _str = ( (ostreamIOCtx * ) ctx )->_M_stream;
_str->write((const char * )buf, size);
@ -104,14 +104,14 @@ int ostreamIOCtx::Putbuf (struct gdIOCtx * ctx, const void * buf, int size)
/** Reads the next character from stream and returns it as an
unsigned char cast to an int, or EOF on end of file or error.
*/
int ostreamIOCtx::Getchar (struct gdIOCtx * )
int ostreamIOCtx::Getchar(gdIOCtxPtr)
{
return EOF;
}
/** Write the character to stream
Character is cast to unsigned char before writing
*/
void ostreamIOCtx::Putchar (struct gdIOCtx * ctx, int c)
void ostreamIOCtx::Putchar(gdIOCtxPtr ctx, int c)
{
stream_type * _str = ( (ostreamIOCtx * ) ctx )->_M_stream;
_str->put((char)c);
@ -120,7 +120,7 @@ void ostreamIOCtx::Putchar (struct gdIOCtx * ctx, int c)
/** Seek to position offset from the beginning of the stream
must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek!
*/
int ostreamIOCtx::Seek (struct gdIOCtx * ctx, const int pos)
int ostreamIOCtx::Seek(gdIOCtxPtr ctx, const int pos)
{
stream_type * _str = ( (ostreamIOCtx * ) ctx )->_M_stream;
_str->seekp(pos);
@ -129,14 +129,14 @@ int ostreamIOCtx::Seek (struct gdIOCtx * ctx, const int pos)
/** Obtains the current value of the stream position.
Returns -1 on error.
*/
long ostreamIOCtx::Tell (struct gdIOCtx * ctx)
long ostreamIOCtx::Tell(gdIOCtxPtr ctx)
{
stream_type * _str = ( (ostreamIOCtx * ) ctx )->_M_stream;
return _str->tellp();
}
/** Deallocate the context
*/
void ostreamIOCtx::FreeCtx (struct gdIOCtx * ctx)
void ostreamIOCtx::FreeCtx(gdIOCtxPtr ctx)
{
delete (ostreamIOCtx * )ctx;
}

View File

@ -49,13 +49,13 @@ public:
init( & __stream);
}
static int Getbuf (struct gdIOCtx * ctx, void * buf, int size);
static int Putbuf (struct gdIOCtx * , const void * , int );
static void Putchar (struct gdIOCtx * , int );
static int Getchar (struct gdIOCtx * ctx);
static int Seek (struct gdIOCtx * ctx, const int pos);
static long Tell (struct gdIOCtx * ctx);
static void FreeCtx (struct gdIOCtx * ctx);
static int Getbuf(gdIOCtxPtr ctx, void *buf, int size);
static int Putbuf(gdIOCtxPtr, const void *, int);
static void Putchar(gdIOCtxPtr, int);
static int Getchar(gdIOCtxPtr ctx);
static int Seek(gdIOCtxPtr ctx, const int pos);
static long Tell(gdIOCtxPtr ctx);
static void FreeCtx(gdIOCtxPtr ctx);
void init(stream_type * __stream) {
getC = Getchar;
@ -72,7 +72,7 @@ private:
};
/** Allocate a new instance of the class
*/
inline gdIOCtx * gdNewIstreamCtx (std::istream * __stream)
inline gdIOCtxPtr gdNewIstreamCtx(std::istream *__stream)
{
return new istreamIOCtx(* __stream);
}
@ -93,13 +93,13 @@ public:
init( & __stream);
}
static int Getbuf (struct gdIOCtx * , void * , int );
static int Putbuf (struct gdIOCtx * ctx, const void * buf, int size);
static int Getchar (struct gdIOCtx * );
static void Putchar (struct gdIOCtx * ctx, int a);
static int Seek (struct gdIOCtx * ctx, const int pos);
static long Tell (struct gdIOCtx * ctx);
static void FreeCtx (struct gdIOCtx * ctx);
static int Getbuf(gdIOCtxPtr, void *, int);
static int Putbuf(gdIOCtxPtr ctx, const void *buf, int size);
static int Getchar(gdIOCtxPtr);
static void Putchar(gdIOCtxPtr ctx, int a);
static int Seek(gdIOCtxPtr ctx, const int pos);
static long Tell(gdIOCtxPtr ctx);
static void FreeCtx(gdIOCtxPtr ctx);
void init(stream_type * __stream) {
getC = Getchar;
@ -116,7 +116,7 @@ private:
};
/** Allocate a new instance of the class
*/
inline gdIOCtx * gdNewOstreamCtx (std::ostream * __stream)
inline gdIOCtxPtr gdNewOstreamCtx(std::ostream *__stream)
{
return new ostreamIOCtx(* __stream);
}

View File

@ -45,8 +45,8 @@ typedef struct oTga_ {
#define TGA_RLE_FLAG 128
int read_header_tga(gdIOCtx *ctx, oTga *tga);
int read_image_tga(gdIOCtx *ctx, oTga *tga);
int read_header_tga(gdIOCtxPtr ctx, oTga *tga);
int read_image_tga(gdIOCtxPtr ctx, oTga *tga);
void free_tga(oTga *tga);
#endif //__TGA_H

View File

@ -311,7 +311,7 @@ public:
e.g. GD::Image img(input, GD::Png_tag()); // read a png file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, Png_tag)
Image(gdIOCtxPtr in, Png_tag)
:im(0) {
CreateFromPng(in);
}
@ -349,7 +349,7 @@ public:
e.g. GD::Image img(input, GD::Gif_tag()); // read a gif file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, Gif_tag)
Image(gdIOCtxPtr in, Gif_tag)
:im(0) {
CreateFromGif(in);
}
@ -387,7 +387,7 @@ public:
e.g. GD::Image img(input, GD::WBMP_tag()); // read a monchrome WBMP file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, WBMP_tag)
Image(gdIOCtxPtr in, WBMP_tag)
:im(0) {
CreateFromWBMP(in);
}
@ -425,7 +425,7 @@ public:
e.g. GD::Image img(input, GD::Jpeg_tag()); // read a jpeg file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, Jpeg_tag)
Image(gdIOCtxPtr in, Jpeg_tag)
:im(0) {
CreateFromJpeg(in);
}
@ -463,7 +463,7 @@ public:
e.g. GD::Image img(input, GD::Gd_tag()); // read a gd file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, Gd_tag)
Image(gdIOCtxPtr in, Gd_tag)
:im(0) {
CreateFromGd(in);
}
@ -501,7 +501,7 @@ public:
e.g. GD::Image img(input, GD::Gd2_tag()); // read a gd2 file from input
\param[in] in The io context from which to read the image data
*/
Image(gdIOCtx * in, Gd2_tag)
Image(gdIOCtxPtr in, Gd2_tag)
:im(0) {
CreateFromGd2(in);
}
@ -605,7 +605,7 @@ public:
clear();
return ((im = gdImageCreateFromPng(in)) != 0);
}
bool CreateFromPng(gdIOCtx * in) {
bool CreateFromPng(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromPngCtx(in)) != 0);
}
@ -624,7 +624,7 @@ public:
clear();
return ((im = gdImageCreateFromGif(in)) != 0);
}
bool CreateFromGif(gdIOCtx * in) {
bool CreateFromGif(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromGifCtx(in)) != 0);
}
@ -642,7 +642,7 @@ public:
clear();
return ((im = gdImageCreateFromWBMP(in)) != 0);
}
bool CreateFromWBMP(gdIOCtx * in) {
bool CreateFromWBMP(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromWBMPCtx(in)) != 0);
}
@ -680,7 +680,7 @@ public:
You can call Width() and Height() member functions of the image to determine its
size. The returned image is always a truecolor image.
*/
bool CreateFromJpeg(gdIOCtx * in) {
bool CreateFromJpeg(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromJpegCtx(in)) != 0);
}
@ -715,7 +715,7 @@ public:
clear();
return ((im = gdImageCreateFromGd(in)) != 0);
}
bool CreateFromGd(gdIOCtx * in) {
bool CreateFromGd(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromGdCtx(in)) != 0);
}
@ -733,7 +733,7 @@ public:
clear();
return ((im = gdImageCreateFromGd2(in)) != 0);
}
bool CreateFromGd2(gdIOCtx * in) {
bool CreateFromGd2(gdIOCtxPtr in) {
clear();
return ((im = gdImageCreateFromGd2Ctx(in)) != 0);
}
@ -751,7 +751,7 @@ public:
clear();
return ((im = gdImageCreateFromGd2Part(in, srcx, srcy, w, h)) != 0);
}
bool CreateFromGd2Part(gdIOCtx * in, int srcx, int srcy, int w, int h) {
bool CreateFromGd2Part(gdIOCtxPtr in, int srcx, int srcy, int w, int h) {
clear();
return ((im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h)) != 0);
}
@ -767,7 +767,7 @@ public:
bool CreateFromGd2Part(FILE * in, const Point & src, const Size & s) {
return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
}
bool CreateFromGd2Part(gdIOCtx * in, const Point & src, const Size & s) {
bool CreateFromGd2Part(gdIOCtxPtr in, const Point & src, const Size & s) {
return CreateFromGd2Part(in, src.X(), src.Y(), s.W(), s.H());
}
bool CreateFromGd2Part(int size, void * data, const Point & src, const Size & s) {
@ -1055,9 +1055,9 @@ public:
}
/**
Write out this image in GIF file format to \p out.
\param out A gdIOCtx * handle
\param out A gdIOCtxPtr handle
*/
void Gif(gdIOCtx * out) const {
void Gif(gdIOCtxPtr out) const {
gdImageGifCtx(im, out);
}
/**
@ -1086,9 +1086,9 @@ public:
}
/**
Write out this image in PNG file format to \p out.
\param out A gdIOCtx * handle
\param out A gdIOCtxPtr handle
*/
void Png(gdIOCtx * out) const {
void Png(gdIOCtxPtr out) const {
gdImagePngCtx(im, out);
}
/**
@ -1117,10 +1117,10 @@ public:
}
/**
Write out this image in PNG file format to \p out.
\param out A gdIOCtx * handle
\param out A gdIOCtxPtr handle
\param level The level of compression: 0 == "no compression", 1 == "compressed as quickly as possible" --> 9 == "compressed as much as possible", -1 == zlib default compression level
*/
void Png(gdIOCtx * out, int level) const {
void Png(gdIOCtxPtr out, int level) const {
gdImagePngCtxEx(im, out, level);
}
/**
@ -1153,9 +1153,9 @@ public:
/**
Write out this image in WBMP file format ( black and white only ) to \p out.
\param fg The color index of the foreground. All other pixels considered background.
\param out A gdIOCtx * handle
\param out A gdIOCtxPtr handle
*/
void WBMP(int fg, gdIOCtx * out) const {
void WBMP(int fg, gdIOCtxPtr out) const {
gdImageWBMPCtx(im, fg, out);
}
/**
@ -1187,10 +1187,10 @@ public:
}
/**
Write out this image in JPEG file format to \p out.
\param out A gdIOCtx * handle
\param out A gdIOCtxPtr handle
\param quality Should be a value in the range 0-95, higher numbers imply both higher quality and larger image size. Default value is -1, indicating "use a sensible default value".
*/
void Jpeg(gdIOCtx * out, int quality = -1) const {
void Jpeg(gdIOCtxPtr out, int quality = -1) const {
gdImageJpegCtx(im, out, quality);
}
/**
@ -1224,16 +1224,16 @@ public:
inline static void GifAnimEnd(FILE * out) {
gdImageGifAnimEnd(out);
}
void GifAnimBegin(gdIOCtx * out, int GlobalCM, int Loops) const {
void GifAnimBegin(gdIOCtxPtr out, int GlobalCM, int Loops) const {
gdImageGifAnimBeginCtx(im, out, GlobalCM, Loops);
}
void GifAnimAdd(gdIOCtx * out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm) const {
void GifAnimAdd(gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm) const {
gdImageGifAnimAddCtx(im, out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm);
}
void GifAnimAdd(gdIOCtx * out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, const GD::Image & previm) const {
void GifAnimAdd(gdIOCtxPtr out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, const GD::Image & previm) const {
GifAnimAdd(out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm.im);
}
inline static void GifAnimEnd(gdIOCtx * out) {
inline static void GifAnimEnd(gdIOCtxPtr out) {
gdImageGifAnimEndCtx(out);
}
void * GifAnimBegin(int * size, int GlobalCM, int Loops) const {