本文整理汇总了C++中pdc_free函数的典型用法代码示例。如果您正苦于以下问题:C++ pdc_free函数的具体用法?C++ pdc_free怎么用?C++ pdc_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdc_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pdf_add_pdflib_resource
void
pdf_add_pdflib_resource(PDF *p, const char *category, const char *resname)
{
char *newresname;
int newlen;
pdc_encoding htenc;
int htcp;
pdf_prepare_name_string(p, resname, 0, PDC_FILENAMELEN,
&newresname, &newlen, &htenc, &htcp);
if (newlen)
{
char *tmpresname = pdc_utf16_to_utf8(p->pdc, newresname, newlen,
PDC_CONV_EBCDIC | PDC_CONV_WITHBOM,
&newlen);
pdc_free(p->pdc, newresname);
newresname = tmpresname;
newlen = 0;
}
pdc_add_resource_ext(p->pdc, category, newresname, NULL, htenc, htcp);
if (newresname != resname)
pdc_free(p->pdc, newresname);
}
示例2: pdc_fclose
void
pdc_fclose(pdc_file *sfp)
{
if (sfp)
{
if (sfp->fp)
{
pdc_fclose_logg(sfp->pdc, sfp->fp);
sfp->fp = NULL;
}
else if (sfp->wrmode)
{
if (sfp->data)
{
pdc_free(sfp->pdc, sfp->data);
sfp->data = NULL;
}
}
if (sfp->filename)
{
pdc_free(sfp->pdc, sfp->filename);
sfp->filename = NULL;
}
pdc_free(sfp->pdc, sfp);
}
}
示例3: pdf__delete_pvf
int
pdf__delete_pvf(PDF *p, const char *filename, int reserved)
{
pdf_virtfile *vfile, *lastvfile = NULL;
(void) reserved;
/* Find virtual file in file system */
vfile = pdf_find_pvf(p, filename, &lastvfile);
if (vfile)
{
/* File exists but locked */
if (vfile->lockcount > 0)
{
return pdc_undef;
}
/* Delete */
if (vfile->iscopy == pdc_true)
{
pdc_free(p->pdc, (void *) vfile->data);
vfile->data = NULL;
}
pdc_free(p->pdc, vfile->name);
if (lastvfile)
lastvfile->next = vfile->next;
else
p->filesystem = vfile->next;
pdc_free(p->pdc, vfile);
}
return pdc_true;
}
示例4: pdc_read_file
void *
pdc_read_file(pdc_core *pdc, FILE *fp, pdc_off_t *o_filelen, int incore)
{
static const char fn[] = "pdc_read_file";
pdc_off_t filelen = 0, len = 0;
char *content = NULL;
#if !defined(MVS) || !defined(I370)
pdc__fseek(fp, 0, SEEK_END);
filelen = pdc__ftell(fp);
pdc__fseek(fp, 0, SEEK_SET);
if (incore && filelen)
{
content = (char *) pdc_malloc(pdc, (size_t) (filelen + 1), fn);
len = (pdc_off_t) pdc__fread(content, 1, (size_t) filelen, fp);
/* because pdc__ftell lies! */
filelen = len;
if (!filelen)
{
pdc_free(pdc, content);
filelen = 0;
content = NULL;
}
}
#endif
if (content) content[filelen] = 0;
*o_filelen = filelen;
return (void *) content;
}
示例5: fnt_cleanup_font_metric
static void
fnt_cleanup_font_metric(pdc_core *pdc, fnt_font_metric *metric)
{
if (metric->name != NULL)
{
pdc_free(pdc, metric->name);
metric->name = NULL;
}
if (metric->widths != NULL)
{
pdc_free(pdc, metric->widths);
metric->widths = NULL;
}
if (metric->ciw != NULL)
{
pdc_free(pdc, metric->ciw);
metric->ciw = NULL;
}
if (metric->glw != NULL)
{
pdc_free(pdc, metric->glw);
metric->glw = NULL;
}
}
示例6: pdc_delete_optvalue
static void
pdc_delete_optvalue(pdc_core *pdc, pdc_resopt *resopt)
{
if (resopt->val && !(resopt->flags & PDC_OPT_SAVEALL))
{
int j;
int ja = (resopt->flags & PDC_OPT_SAVE1ELEM) ? 1 : 0;
if (resopt->defopt->type == pdc_stringlist)
{
char **s = (char **) resopt->val;
for (j = ja; j < resopt->num; j++)
if (s[j] != NULL)
pdc_free(pdc, s[j]);
}
else if (resopt->defopt->type == pdc_polylinelist)
{
pdc_polyline *pl = (pdc_polyline *) resopt->val;
for (j = ja; j < resopt->num; j++)
if (pl[j].p != NULL)
pdc_free(pdc, pl[j].p);
}
pdc_free(pdc, resopt->val);
resopt->val = NULL;
}
if (resopt->origval && !(resopt->flags & PDC_OPT_SAVEORIG))
{
pdc_free(pdc, resopt->origval);
resopt->origval = NULL;
}
resopt->num = 0;
}
示例7: pdc_cleanup_optstringlist
void
pdc_cleanup_optstringlist(pdc_core *pdc, char **stringlist, int ns)
{
int j;
for (j = 0; j < ns; j++)
{
if (stringlist[j] != NULL)
pdc_free(pdc, stringlist[j]);
}
pdc_free(pdc, stringlist);
}
示例8: fnt_cleanup_fontimg
void
fnt_cleanup_fontimg(pdc_core *pdc, fnt_font *font)
{
if (font->img != NULL && font->imgname == NULL)
{
pdc_free(pdc, font->img);
font->img = NULL;
}
if (font->imgname != NULL)
{
pdc_free(pdc, font->imgname);
font->imgname = NULL;
}
}
示例9: pdc_convert_filename_ext
/*
* pdc_convert_filename_ext converts a file name as string of name type
* (see function pdc_convert_name) to a [EBCDIC-]UTF-8 string with or
* without a BOM. If the compiler doesn't allow Unicode filenames
* (see define PDC_UNICODE_FILENAME) the filename is Latin-1 encoded
* if possible or an exception will be thrown.
*
*/
const char *
pdc_convert_filename_ext(pdc_core *pdc, const char *filename, int len,
const char *paramname, pdc_encoding enc, int codepage,
int flags)
{
char *fname = NULL;
const char *outfilename = NULL;
int i = 0;
if (filename == NULL)
pdc_error(pdc, PDC_E_ILLARG_EMPTY, paramname, 0, 0, 0);
fname = pdc_convert_name_ext(pdc, filename, len, enc, codepage, flags);
if (fname == NULL || *fname == '\0')
pdc_error(pdc, PDC_E_ILLARG_EMPTY, paramname, 0, 0, 0);
if (pdc_is_utf8_bytecode(fname))
{
#if defined(PDC_UNICODE_FILENAME)
i = 3;
#else
fname = pdc_check_filename(pdc, fname);
#endif
}
outfilename = pdc_errprintf(pdc, "%s", &fname[i]);
pdc_free(pdc, fname);
return outfilename;
}
示例10: pdf__delete
void
pdf__delete(PDF *p)
{
/*
* Close the output stream, because it could be open
*/
pdc_close_output(p->out);
/*
* Clean up page-related stuff if necessary. Do not raise
* an error here since we may be called from the error handler.
*/
pdf_cleanup_document(p);
pdf_cleanup_stringlists(p);
pdf_cleanup_font_curroptions(p);
pdc_cleanup_output(p->out, pdc_false);
if (p->out)
pdc_free(p->pdc, p->out);
/* we never reach this point if (p->pdc == NULL).
*/
pdc_delete_core(p->pdc);
/* free the PDF structure and try to protect against duplicated calls */
p->magic = 0L; /* we don't reach this with the wrong magic */
(*p->freeproc)(p, (void *) p);
}
示例11: PDF_setdashpattern
PDFLIB_API void PDFLIB_CALL
PDF_setdashpattern(PDF *p, const char *optlist)
{
static const char fn[] = "PDF_setdashpattern";
pdc_resopt *results;
float *darray, phase;
int length;
if (!pdf_enter_api(p, fn, pdf_state_content,
"(p[%p], \"%s\")\n", (void *) p, optlist))
return;
/* parsing optlist */
results = pdc_parse_optionlist(p->pdc, optlist, pdf_dashoptions, NULL,
pdc_true);
length = pdc_get_optvalues(p->pdc, "dasharray", results,
NULL, (void **) &darray);
phase = (float) 0.0;
(void) pdc_get_optvalues(p->pdc, "dashphase", results, &phase, NULL);
pdc_cleanup_optionlist(p->pdc, results);
pdf__setdashpattern(p, darray, length, phase);
if (darray)
pdc_free(p->pdc, darray);
}
示例12: pdc_jbuf
pdc_jmpbuf *
pdc_jbuf(pdc_core *pdc)
{
static const char fn[] = "pdc_jbuf";
if (++pdc->pr->x_sp == pdc->pr->x_ssize)
{
pdc_xframe *aux;
#ifdef PDC_ALIGN16
char *cp = (char *) (*pdc->pr->allocproc)(pdc->pr->opaque,
16 + 2 * pdc->pr->x_ssize * sizeof (pdc_xframe), fn);
if (cp == (char *) 0)
{
aux = (pdc_xframe *) 0;
}
else
{
/* remember the pointer in order to free it only after the memcpy
* below, as pdc->pr->x_stack points into the memory allocated
* to pdc->pr->x_alias
*/
char *free_me_later = pdc->pr->x_alias;
pdc->pr->x_alias = cp;
aux = (pdc_xframe *)
(((unsigned long) cp + 16) & 0xFFFFFFFFFFFFFFF0);
memcpy(aux, pdc->pr->x_stack,
pdc->pr->x_ssize * sizeof (pdc_xframe));
pdc_free(pdc, free_me_later);
}
#else
aux = (pdc_xframe *) (*pdc->pr->reallocproc)(
pdc->pr->opaque, pdc->pr->x_stack,
2 * pdc->pr->x_ssize * sizeof (pdc_xframe), fn);
#endif
if (aux == (pdc_xframe *) 0)
{
--pdc->pr->x_sp;
pdc->pr->x_thrown = pdc_true;
pdc->pr->in_error = pdc_true;
pdc->pr->errnum = PDC_E_MEM_OUT;
pdc->pr->apiname[0] = 0;
sprintf(pdc->pr->errbuf,
"Out of memory in TRY function (nesting level: %d)",
pdc->pr->x_sp + 1);
longjmp(pdc->pr->x_stack[pdc->pr->x_sp].jbuf.jbuf, 1);
}
pdc->pr->x_stack = aux;
pdc->pr->x_ssize *= 2;
}
pdc->pr->x_thrown = pdc_false;
return &pdc->pr->x_stack[pdc->pr->x_sp].jbuf;
} /* pdc_jbuf */
示例13: pdc_get_opt_utf8strings
int
pdc_get_opt_utf8strings(pdc_core *pdc, const char *keyword, pdc_resopt *resopt,
int flags, char ***strings)
{
int ns = pdc_get_optvalues(keyword, resopt, NULL, strings);
if (ns)
{
if (pdc_is_lastopt_utf8(resopt))
{
int i = resopt[0].lastind;
pdc_resopt *ropt = &resopt[i];
char **s = (char **) ropt->val;
int j;
for (j = 0; j < ropt->num; j++)
{
char *sb = pdc_strdup_withbom(pdc, s[j]);
if (s[j] != NULL)
pdc_free(pdc, s[j]);
s[j] = sb;
}
}
pdc_save_lastopt(resopt, flags);
}
return ns;
}
示例14: pdf_cleanup_extgstates
void
pdf_cleanup_extgstates(PDF *p)
{
int i;
if (!p->extgstates)
return;
for (i = 0; i < p->extgstates_number; i++) {
if (p->extgstates[i].dash_array)
pdc_free(p->pdc, p->extgstates[i].dash_array);
}
pdc_free(p->pdc, p->extgstates);
p->extgstates = NULL;
}
示例15: pdf_insert_utilstring
int
pdf_insert_utilstring(PDF *p, const char *utilstring, pdc_bool kdup)
{
static const char fn[] = "pdf_insert_utilstring";
char **utilstrlist;
int i = 0;
if (p->utilstrlist_index == -1)
{
utilstrlist = (char **) pdc_calloc(p->pdc,
PDF_MAX_UTILSTRLISTS * sizeof (char *), fn);
p->utilstrlist_index =
pdf_insert_stringlist(p, utilstrlist, PDF_MAX_UTILSTRLISTS);
}
utilstrlist = p->stringlists[p->utilstrlist_index];
if (p->utilstring_number >= PDF_MAX_UTILSTRLISTS)
p->utilstring_number = 0;
i = p->utilstring_number;
if (utilstrlist[i] != NULL)
pdc_free(p->pdc, utilstrlist[i]);
if (kdup)
utilstrlist[i] = pdc_strdup_ext(p->pdc, utilstring, 0, fn);
else
utilstrlist[i] = (char *) utilstring;
p->utilstring_number++;
return i;
}