summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-27 00:12:05 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-27 00:21:57 -0300
commit0509840b201526851e33182b98fcf61edf70b626 (patch)
tree6f42654d0e87f7c665b21c560fb03404d29e0e57
parent369c95f88d33f708777b82711ef6d7db3066857a (diff)
downloadeeshow-0509840b201526851e33182b98fcf61edf70b626.tar.gz
eeshow-0509840b201526851e33182b98fcf61edf70b626.tar.bz2
eeshow-0509840b201526851e33182b98fcf61edf70b626.zip
gfx/gfx.c (gfx_end): let "end" function return an integer
-rw-r--r--gfx/cro.c8
-rw-r--r--gfx/diff.c4
-rw-r--r--gfx/gfx.c7
-rw-r--r--gfx/gfx.h4
4 files changed, 16 insertions, 7 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 0e274bf..1668ca5 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -641,7 +641,7 @@ static void cr_pdf_new_sheet(void *ctx)
}
-static void cr_pdf_end(void *ctx)
+static int cr_pdf_end(void *ctx)
{
struct cro_ctx *cc = ctx;
int w, h;
@@ -688,6 +688,8 @@ static void cr_pdf_end(void *ctx)
if (cc->toc)
pdftoc_end(cc->toc);
+
+ return 0;
}
@@ -708,13 +710,15 @@ static void *cr_png_init(void)
}
-static void cr_png_end(void *ctx)
+static int cr_png_end(void *ctx)
{
struct cro_ctx *cc = ctx;
int w, h, stride;
cro_img_end(cc, &w, &h, &stride);
cro_img_write(cc->s, cc->output_name);
+
+ return 0;
}
diff --git a/gfx/diff.c b/gfx/diff.c
index 32e150c..e9d6273 100644
--- a/gfx/diff.c
+++ b/gfx/diff.c
@@ -434,7 +434,7 @@ static cairo_t *make_diff(cairo_t *cr, int cx, int cy, float scale,
/* ----- Diff to file ------------------------------------------------------ */
-static void diff_end(void *ctx)
+static int diff_end(void *ctx)
{
struct diff *diff = ctx;
cairo_t *old_cr;
@@ -451,6 +451,8 @@ static void diff_end(void *ctx)
cairo_surface_destroy(s);
cairo_destroy(old_cr);
+
+ return 0;
}
diff --git a/gfx/gfx.c b/gfx/gfx.c
index a0f055f..a75b054 100644
--- a/gfx/gfx.c
+++ b/gfx/gfx.c
@@ -148,9 +148,12 @@ void *gfx_user(struct gfx *gfx)
}
-void gfx_end(struct gfx *gfx)
+int gfx_end(struct gfx *gfx)
{
+ int res = 0;
+
if (gfx->ops->end)
- gfx->ops->end(gfx->user);
+ res = gfx->ops->end(gfx->user);
free(gfx);
+ return res;
}
diff --git a/gfx/gfx.h b/gfx/gfx.h
index 85fdc32..bcc0a3e 100644
--- a/gfx/gfx.h
+++ b/gfx/gfx.h
@@ -45,7 +45,7 @@ struct gfx_ops {
bool (*args)(void *ctx, int argc, char *const *argv);
void (*sheet_name)(void *ctx, const char *name);
void (*new_sheet)(void *ctx);
- void (*end)(void *ctx);
+ int (*end)(void *ctx);
};
@@ -78,6 +78,6 @@ void gfx_sheet_name(struct gfx *gfx, const char *name);
void gfx_new_sheet(struct gfx *gfx);
bool gfx_multi_sheet(struct gfx *gfx);
void *gfx_user(struct gfx *gfx); /* transitional kludge */
-void gfx_end(struct gfx *gfx);
+int gfx_end(struct gfx *gfx);
#endif /* !GFX_GFX_H */