From 28c8daaa0657de9c8894a5c9bbad604c8a8a6013 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sat, 26 Jan 2008 01:54:42 +0000 Subject: [PATCH] 2008-01-25 Jim Evins * src/bc.c: Fixed Code128C backend parameters. * src/label-barcode.c: (get_size): Bug #1766425. If barcode is not renderable with either input data or default data, use a default size. Also fixed small leak. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/branches/glabels-2_2@732 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 9 +++++++++ glabels2/src/bc.c | 2 +- glabels2/src/label-barcode.c | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 74862a9e..3405a27b 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,12 @@ +2008-01-25 Jim Evins + + * src/bc.c: + Fixed Code128C backend parameters. + * src/label-barcode.c: (get_size): + Bug #1766425. If barcode is not renderable with either + input data or default data, use a default size. Also + fixed small leak. + 2008-01-22 Jim Evins * NEWS: diff --git a/glabels2/src/bc.c b/glabels2/src/bc.c index 89de2fbb..bcb427f5 100644 --- a/glabels2/src/bc.c +++ b/glabels2/src/bc.c @@ -134,7 +134,7 @@ static const Backend backends[] = { TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10}, { "Code128C", N_("Code 128C"), gl_barcode_gnubarcode_new, - TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10}, + TRUE, TRUE, TRUE, FALSE, "0000000000", TRUE, 10}, { "Code128B", N_("Code 128B"), gl_barcode_gnubarcode_new, TRUE, TRUE, TRUE, TRUE, "0000000000", TRUE, 10}, diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c index 9cb08043..1901cfb1 100644 --- a/glabels2/src/label-barcode.c +++ b/glabels2/src/label-barcode.c @@ -290,6 +290,7 @@ get_size (glLabelObject *object, w_parent, h_parent, data); + g_free (data); if ( gbc == NULL ) { /* Try again with default digits. */ @@ -301,13 +302,22 @@ get_size (glLabelObject *object, w_parent, h_parent, data); + g_free (data); } - *w = gbc->width; - *h = gbc->height; + if ( gbc != NULL ) + { + *w = gbc->width; + *h = gbc->height; + } + else + { + /* If we still can't render, just set a default size. */ + *w = 144; + *h = 72; + } gl_barcode_free (&gbc); - g_free (data); gl_debug (DEBUG_LABEL, "END"); } -- 2.39.5