cvs: gd /libgd/src gd_io_file.c
[email protected] ("Mattias Bengtsson") Fri, 21 Dec 2007 22:02:50 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvsmattias1198274570@cvsserver> |
mattias Fri Dec 21 22:02:50 2007 UTC
Modified files:
/gd/libgd/src gd_io_file.c
Log:
- ws + cs
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_io_file.c?r1=1.10&r2=1.11&diff_format=u
Index: gd/libgd/src/gd_io_file.c
diff -u gd/libgd/src/gd_io_file.c:1.10 gd/libgd/src/gd_io_file.c:1.11
--- gd/libgd/src/gd_io_file.c:1.10 Wed Apr 5 15:52:22 2006
+++ gd/libgd/src/gd_io_file.c Fri Dec 21 22:02:50 2007
@@ -1,27 +1,26 @@
-
/*
- * io_file.c
- *
- * Implements the file interface.
- *
- * As will all I/O modules, most functions are for local use only (called
- * via function pointers in the I/O context).
- *
- * Most functions are just 'wrappers' for standard file functions.
- *
- * Written/Modified 1999, Philip Warner.
- *
+ * io_file.c
+ *
+ * Implements the file interface.
+ *
+ * As will all I/O modules, most functions are for local use only (called
+ * via function pointers in the I/O context).
+ *
+ * Most functions are just 'wrappers' for standard file functions.
+ *
+ * Written/Modified 1999, Philip Warner.
+ *
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
/* For platforms with incomplete ANSI defines. Fortunately,
- SEEK_SET is defined to be zero by the standard. */
+ * SEEK_SET is defined to be zero by the standard. */
#ifndef SEEK_SET
-#define SEEK_SET 0
+# define SEEK_SET 0
#endif /* SEEK_SET */
#include <math.h>
@@ -34,111 +33,100 @@
typedef struct fileIOCtx
{
- gdIOCtx ctx;
- FILE *f;
+ gdIOCtx ctx;
+ FILE *f;
}
fileIOCtx;
-gdIOCtx *newFileCtx (FILE * f);
+gdIOCtx *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 fileSeek (struct gdIOCtx *, const int);
-static long fileTell (struct gdIOCtx *);
-static void gdFreeFileCtx (gdIOCtx * ctx);
+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);
/* return data as a dynamic pointer */
-BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE * f)
+BGD_DECLARE(gdIOCtx *) gdNewFileCtx(FILE *f)
{
- fileIOCtx *ctx;
+ fileIOCtx *ctx;
- ctx = (fileIOCtx *) gdMalloc (sizeof (fileIOCtx));
- if (ctx == NULL)
- {
- return NULL;
- }
+ ctx = (fileIOCtx *)gdMalloc(sizeof(fileIOCtx));
+ if(ctx == NULL) {
+ return NULL;
+ }
- ctx->f = f;
+ ctx->f = f;
- ctx->ctx.getC = fileGetchar;
- ctx->ctx.putC = filePutchar;
+ ctx->ctx.getC = fileGetchar;
+ ctx->ctx.putC = filePutchar;
- ctx->ctx.getBuf = fileGetbuf;
- ctx->ctx.putBuf = filePutbuf;
+ ctx->ctx.getBuf = fileGetbuf;
+ ctx->ctx.putBuf = filePutbuf;
- ctx->ctx.tell = fileTell;
- ctx->ctx.seek = fileSeek;
+ ctx->ctx.tell = fileTell;
+ ctx->ctx.seek = fileSeek;
- ctx->ctx.gd_free = gdFreeFileCtx;
+ ctx->ctx.gd_free = gdFreeFileCtx;
- return (gdIOCtx *) ctx;
+ return (gdIOCtx *)ctx;
}
-static void
-gdFreeFileCtx (gdIOCtx * ctx)
+static void gdFreeFileCtx(gdIOCtx *ctx)
{
- gdFree (ctx);
+ gdFree(ctx);
}
-static int
-filePutbuf (gdIOCtx * ctx, const void *buf, int size)
+static int filePutbuf(gdIOCtx *ctx, const void *buf, int size)
{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return fwrite (buf, 1, size, fctx->f);
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
+ return fwrite(buf, 1, size, fctx->f);
}
-static int
-fileGetbuf (gdIOCtx * ctx, void *buf, int size)
+static int fileGetbuf(gdIOCtx *ctx, void *buf, int size)
{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
-
- return (fread (buf, 1, size, fctx->f));
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
+ return (fread(buf, 1, size, fctx->f));
}
-static void
-filePutchar (gdIOCtx * ctx, int a)
+static void filePutchar(gdIOCtx *ctx, int a)
{
- unsigned char b;
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
+ unsigned char b;
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
- b = a;
+ b = a;
- putc (b, fctx->f);
+ putc(b, fctx->f);
}
-static int
-fileGetchar (gdIOCtx * ctx)
+static int fileGetchar(gdIOCtx *ctx)
{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
- return getc (fctx->f);
+ return getc(fctx->f);
}
-
-static int
-fileSeek (struct gdIOCtx *ctx, const int pos)
+static int fileSeek(struct gdIOCtx *ctx, const int pos)
{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
- return (fseek (fctx->f, pos, SEEK_SET) == 0);
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
+ return (fseek(fctx->f, pos, SEEK_SET) == 0);
}
-static long
-fileTell (struct gdIOCtx *ctx)
+static long fileTell (struct gdIOCtx *ctx)
{
- fileIOCtx *fctx;
- fctx = (fileIOCtx *) ctx;
+ fileIOCtx *fctx;
+ fctx = (fileIOCtx *)ctx;
- return ftell (fctx->f);
+ return ftell(fctx->f);
}