cvs: gd /libgd/src gd_io_ss.c

[email protected] ("Mattias Bengtsson") Fri, 21 Dec 2007 20:10:48 -0000
Newsgroups php.gd.cvs
Message-ID <cvsmattias1198267847@cvsserver>
mattias		Fri Dec 21 20:10:48 2007 UTC

  Modified files:              
    /gd/libgd/src	gd_io_ss.c 
  Log:
  - ws + cs
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_io_ss.c?r1=1.9&r2=1.10&diff_format=u
Index: gd/libgd/src/gd_io_ss.c
diff -u gd/libgd/src/gd_io_ss.c:1.9 gd/libgd/src/gd_io_ss.c:1.10
--- gd/libgd/src/gd_io_ss.c:1.9	Wed Jan  3 21:50:39 2007
+++ gd/libgd/src/gd_io_ss.c	Fri Dec 21 20:10:47 2007
@@ -1,28 +1,27 @@
-
 /*
-   * io_ss.c
-   *
-   * Implements the Source/Sink interface.
-   *
-   * As will all I/O modules, most functions are for local use only (called
-   * via function pointers in the I/O context).
-   *
-   * The Source/Sink model is the primary 'user' interface for alternate data
-   * sources; the IOCtx interface is intended (at least in version 1.5) to be
-   * 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 
-   * 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.
-   *
-   * Written/Modified 1999, Philip Warner.
-   *
+ * io_ss.c
+ *
+ * Implements the Source/Sink interface.
+ *
+ * As will all I/O modules, most functions are for local use only (called
+ * via function pointers in the I/O context).
+ *
+ * The Source/Sink model is the primary 'user' interface for alternate data
+ * sources; the IOCtx interface is intended (at least in version 1.5) to be
+ * 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 
+ * 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.
+ *
+ * Written/Modified 1999, Philip Warner.
+ *
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#	include "config.h"
 #endif
 
 #include <math.h>
@@ -35,131 +34,110 @@
 
 typedef struct ssIOCtx
 {
-  gdIOCtx ctx;
-  gdSourcePtr src;
-  gdSinkPtr snk;
+	gdIOCtx ctx;
+	gdSourcePtr src;
+	gdSinkPtr snk;
 }
 ssIOCtx;
 
 typedef struct ssIOCtx *ssIOCtxPtr;
 
-static int sourceGetbuf (gdIOCtx *, void *, int);
-static int sourceGetchar (gdIOCtx * ctx);
-static int sinkPutbuf (gdIOCtx * ctx, const void *buf, int size);
-static void sinkPutchar (gdIOCtx * ctx, int a);
-static void gdFreeSsCtx (gdIOCtx * ctx);
+static int sourceGetbuf(gdIOCtx *, void *, int);
+static int sourceGetchar(gdIOCtx *ctx);
+static int sinkPutbuf(gdIOCtx *ctx, const void *buf, int size);
+static void sinkPutchar(gdIOCtx *ctx, int a);
+static void gdFreeSsCtx(gdIOCtx *ctx);
 
 /* return data as a dynamic pointer */
-BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr src, gdSinkPtr snk)
+BGD_DECLARE(gdIOCtx *) gdNewSSCtx(gdSourcePtr src, gdSinkPtr snk)
 {
-  ssIOCtxPtr ctx;
+	ssIOCtxPtr ctx;
 
-  ctx = (ssIOCtxPtr) gdMalloc (sizeof (ssIOCtx));
-  if (ctx == NULL)
-    {
-      return NULL;
-    }
+	ctx = (ssIOCtxPtr)gdMalloc(sizeof (ssIOCtx));
+	if (ctx == NULL) {
+		return NULL;
+	}
 
-  ctx->src = src;
-  ctx->snk = snk;
+	ctx->src = src;
+	ctx->snk = snk;
 
-  ctx->ctx.getC = sourceGetchar;
-  ctx->ctx.getBuf = sourceGetbuf;
+	ctx->ctx.getC = sourceGetchar;
+	ctx->ctx.getBuf = sourceGetbuf;
 
-  ctx->ctx.putC = sinkPutchar;
-  ctx->ctx.putBuf = sinkPutbuf;
+	ctx->ctx.putC = sinkPutchar;
+	ctx->ctx.putBuf = sinkPutbuf;
 
-  ctx->ctx.tell = NULL;
-  ctx->ctx.seek = NULL;
+	ctx->ctx.tell = NULL;
+	ctx->ctx.seek = NULL;
 
-  ctx->ctx.gd_free = gdFreeSsCtx;
+	ctx->ctx.gd_free = gdFreeSsCtx;
 
-  return (gdIOCtx *) ctx;
+	return (gdIOCtx *)ctx;
 }
 
-static void
-gdFreeSsCtx (gdIOCtx * ctx)
+static void gdFreeSsCtx(gdIOCtx *ctx)
 {
-  gdFree (ctx);
+	gdFree(ctx);
 }
 
-
-static int
-sourceGetbuf (gdIOCtx * ctx, void *buf, int size)
+static int sourceGetbuf(gdIOCtx *ctx, void *buf, int size)
 {
-  ssIOCtx *lctx;
-  int res;
+	ssIOCtx *lctx;
+	int res;
 
-  lctx = (ssIOCtx *) ctx;
+	lctx = (ssIOCtx *)ctx;
 
-  res = ((lctx->src->source) (lctx->src->context, buf, size));
+	res = ((lctx->src->source)(lctx->src->context, buf, size));
 
-/*
-   ** Translate the return values from the Source object: 
-   ** 0 is EOF, -1 is error
- */
-
-  if (res == 0)
-    {
-      return 0;
-    }
-  else if (res < 0)
-    {
-      return 0;
-    }
-  else
-    {
-      return res;
-    };
+	/*
+	 * Translate the return values from the Source object: 
+	 * 0 is EOF, -1 is error
+	 */
 
+	if (res == 0) {
+		return 0;
+	} else if (res < 0) {
+		return 0;
+	} else {
+		return res;
+	}
 }
 
-static int
-sourceGetchar (gdIOCtx * ctx)
+static int sourceGetchar(gdIOCtx *ctx)
 {
-  int res;
-  unsigned char buf;
-
-  res = sourceGetbuf (ctx, &buf, 1);
+	int res;
+	unsigned char buf;
 
-  if (res == 1)
-    {
-      return buf;
-    }
-  else
-    {
-      return EOF;
-    };
+	res = sourceGetbuf(ctx, &buf, 1);
 
+	if (res == 1) {
+		return buf;
+	} else {
+		return EOF;
+	}
 }
 
-static int
-sinkPutbuf (gdIOCtx * ctx, const void *buf, int size)
+static int sinkPutbuf(gdIOCtx *ctx, const void *buf, int size)
 {
-  ssIOCtxPtr lctx;
-  int res;
-
-  lctx = (ssIOCtx *) ctx;
+	ssIOCtxPtr lctx;
+	int res;
 
-  res = (lctx->snk->sink) (lctx->snk->context, buf, size);
+	lctx = (ssIOCtx *)ctx;
 
-  if (res <= 0)
-    {
-      return 0;
-    }
-  else
-    {
-      return res;
-    };
+	res = (lctx->snk->sink)(lctx->snk->context, buf, size);
 
+	if (res <= 0) {
+		return 0;
+	} else {
+		return res;
+	}
 }
 
-static void
-sinkPutchar (gdIOCtx * ctx, int a)
+static void sinkPutchar(gdIOCtx *ctx, int a)
 {
-  unsigned char b;
+	unsigned char b;
 
-  b = a;
-  sinkPutbuf (ctx, &b, 1);
+	b = a;
 
+	sinkPutbuf(ctx, &b, 1);
 }