~ubuntu-branches/ubuntu/lucid/graphviz/lucid-updates

« back to all changes in this revision

Viewing changes to lib/gvc/gvc.c

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2008-06-19 20:23:23 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080619202323-ls23h96ntj9ny94m
Tags: 2.18-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Build depend on liblualib50-dev instead of liblua5.1-0-dev.
  - Drop libttf-dev (libttf-dev is in universe) (LP: #174749).
  - Replace gs-common with ghostscript.
  - Build-depend on python-dev instead of python2.4-dev or python2.5-dev.
  - Mention the correct python version for the python bindings in the
    package description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: gvc.c,v 1.31 2007/11/02 17:02:07 ellson Exp $ $Revision: 1.31 $ */
 
1
/* $Id: gvc.c,v 1.32 2008/02/02 09:11:28 glenlow Exp $ $Revision: 1.32 $ */
2
2
/* vim:set shiftwidth=4 ts=8: */
3
3
 
4
4
/**********************************************************
150
150
}
151
151
 
152
152
/* Render layout in a specified format to a malloc'ed string */
153
 
int gvRenderData(GVC_t *gvc, graph_t *g, char *format, char **result)
 
153
int gvRenderData(GVC_t *gvc, graph_t *g, char *format, char **result, unsigned int *length)
154
154
{
155
155
    int rc;
156
156
    GVJ_t *job;
172
172
        return -1;
173
173
    }
174
174
 
175
 
#define OUTPUT_DATA_INITIAL_ALLOCATION 1000
 
175
/* page size on Linux, Mac OS X and Windows */
 
176
#define OUTPUT_DATA_INITIAL_ALLOCATION 4096
176
177
 
177
178
    if(!result || !(*result = malloc(OUTPUT_DATA_INITIAL_ALLOCATION))) {
178
179
        agerr(AGERR, "failure malloc'ing for result string");
179
180
        return -1;
180
181
    }
181
182
 
182
 
    **result = '\0';
183
183
    job->output_data = *result;
184
184
    job->output_data_allocated = OUTPUT_DATA_INITIAL_ALLOCATION;
185
185
    job->output_data_position = 0;
189
189
    gvdevice_finalize(job);
190
190
 
191
191
    *result = job->output_data;
 
192
        *length = job->output_data_position;
192
193
    gvjobs_delete(gvc);
193
194
 
194
195
    return 0;