From 2b6def26f41457eba8f2056432cd1af68a5b58b0 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 20 Apr 2004 17:50:41 +0000 Subject: Infrastructure changes for character set support. ustrtoa, ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and also have a variety of subtly distinct forms. Also, when a \cfg directive is seen in the input file, the precise octet strings for each parameter are kept in their original form as well as being translated into Unicode, so that when they represent filenames they can be used verbatim. [originally from svn r4097] --- bk_pdf.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'bk_pdf.c') diff --git a/bk_pdf.c b/bk_pdf.c index f6babe5..e9904e7 100644 --- a/bk_pdf.c +++ b/bk_pdf.c @@ -10,30 +10,7 @@ paragraph *pdf_config_filename(char *filename) { - paragraph *p; - wchar_t *ufilename, *up; - int len; - - p = mknew(paragraph); - memset(p, 0, sizeof(*p)); - p->type = para_Config; - p->next = NULL; - p->fpos.filename = ""; - p->fpos.line = p->fpos.col = -1; - - ufilename = ufroma_dup(filename); - len = ustrlen(ufilename) + 2 + lenof(L"pdf-filename"); - p->keyword = mknewa(wchar_t, len); - up = p->keyword; - ustrcpy(up, L"pdf-filename"); - up = uadv(up); - ustrcpy(up, ufilename); - up = uadv(up); - *up = L'\0'; - assert(up - p->keyword < len); - sfree(ufilename); - - return p; + return cmdline_cfg_simple("pdf-filename", filename, NULL); } typedef struct object_Tag object; @@ -88,7 +65,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords, if (p->type == para_Config && p->parent) { if (!ustricmp(p->keyword, L"pdf-filename")) { sfree(filename); - filename = utoa_dup(uadv(p->keyword)); + filename = dupstr(adv(p->origkeyword)); } } } @@ -742,7 +719,7 @@ static int pdf_versionid(FILE *fp, word *words) switch (type) { case word_Normal: - text = utoa_dup(words->text); + text = utoa_dup(words->text, CS_ASCII); break; case word_WhiteSpace: text = dupstr(" "); -- cgit v1.1