Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions
gd_io_file.c File Reference
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gdhelpers.h"

Go to the source code of this file.

Classes

struct  fileIOCtx

Defines

#define SEEK_SET   0

Typedefs

typedef struct fileIOCtx fileIOCtx

Functions

gdIOCtxnewFileCtx (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 fileSeek (struct gdIOCtx *, const int)
static long fileTell (struct gdIOCtx *)
static void gdFreeFileCtx (gdIOCtx *ctx)
gdIOCtxgdNewFileCtx (FILE *f)

Class Documentation

struct fileIOCtx

Definition at line 31 of file gd_io_file.c.

Collaboration diagram for fileIOCtx:
Class Members
gdIOCtx ctx
FILE * f

Define Documentation

#define SEEK_SET   0

Definition at line 20 of file gd_io_file.c.


Typedef Documentation

typedef struct fileIOCtx fileIOCtx

Function Documentation

static int fileGetbuf ( gdIOCtx ctx,
void *  buf,
int  size 
) [static]

Definition at line 86 of file gd_io_file.c.

{
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       return fread(buf, 1, size, fctx->f);
}

Here is the caller graph for this function:

static int fileGetchar ( gdIOCtx ctx) [static]

Definition at line 105 of file gd_io_file.c.

{
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       return getc (fctx->f);
}

Here is the caller graph for this function:

static int filePutbuf ( gdIOCtx ctx,
const void *  buf,
int  size 
) [static]

Definition at line 77 of file gd_io_file.c.

{
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       return fwrite(buf, 1, size, fctx->f);

}

Here is the caller graph for this function:

static void filePutchar ( gdIOCtx ctx,
int  a 
) [static]

Definition at line 94 of file gd_io_file.c.

{
       unsigned char b;
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       b = a;

       putc (b, fctx->f);
}

Here is the caller graph for this function:

static int fileSeek ( struct gdIOCtx ctx,
const int  pos 
) [static]

Definition at line 114 of file gd_io_file.c.

{
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       return (fseek (fctx->f, pos, SEEK_SET) == 0);
}

Here is the caller graph for this function:

static long fileTell ( struct gdIOCtx ctx) [static]

Definition at line 122 of file gd_io_file.c.

{
       fileIOCtx *fctx;
       fctx = (fileIOCtx *) ctx;

       return ftell (fctx->f);
}

Here is the caller graph for this function:

static void gdFreeFileCtx ( gdIOCtx ctx) [static]

Definition at line 71 of file gd_io_file.c.

{
       gdFree(ctx);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gdIOCtx* gdNewFileCtx ( FILE *  f)

Definition at line 49 of file gd_io_file.c.

{
       fileIOCtx *ctx;

       ctx = (fileIOCtx *) gdMalloc(sizeof (fileIOCtx));

       ctx->f = f;

       ctx->ctx.getC = fileGetchar;
       ctx->ctx.putC = filePutchar;

       ctx->ctx.getBuf = fileGetbuf;
       ctx->ctx.putBuf = filePutbuf;

       ctx->ctx.tell = fileTell;
       ctx->ctx.seek = fileSeek;

       ctx->ctx.gd_free = gdFreeFileCtx;

       return (gdIOCtx *) ctx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gdIOCtx* newFileCtx ( FILE *  f)