summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-28 18:10:43 +0000
committerKarl Berry <karl@freefriends.org>2010-03-28 18:10:43 +0000
commit549a764cf19a1f244d773ab70965eadeef67d5a8 (patch)
treec90c4d213a075a429e17379467eac19282617252 /Build/source/texk
parent1cf5d119a011d9d22145848f7177f3124f7e776c (diff)
dynamically concatenate more error strings
git-svn-id: svn://tug.org/texlive/trunk@17591 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/dvipsk/ChangeLog11
-rw-r--r--Build/source/texk/dvipsk/bbox.c5
-rw-r--r--Build/source/texk/dvipsk/dvips.c5
-rw-r--r--Build/source/texk/dvipsk/header.c9
-rw-r--r--Build/source/texk/dvipsk/loadfont.c47
-rw-r--r--Build/source/texk/dvipsk/protos.h2
-rw-r--r--Build/source/texk/dvipsk/tfmload.c17
-rw-r--r--Build/source/texk/dvipsk/virtualfont.c1
-rw-r--r--Build/source/texk/dvipsk/writet1.c10
9 files changed, 65 insertions, 42 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 2ed06264265..a41e05239c1 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -1,3 +1,14 @@
+2010-03-28 Karl Berry <karl@tug.org>
+
+ * loadfont.c,
+ * tfmload.c,
+ * virtualfont.c,
+ * bbox.c,
+ * writet1.c,
+ * dvips.c,
+ * header.c: dynamically concatenate more error strings.
+ * protos.h (errbuf): increase.
+
2010-03-26 Karl Berry <karl@tug.org>
* virtualfont.c (badvf, virtualfont): use concat[n] instead of
diff --git a/Build/source/texk/dvipsk/bbox.c b/Build/source/texk/dvipsk/bbox.c
index 7eed278754a..64973259a75 100644
--- a/Build/source/texk/dvipsk/bbox.c
+++ b/Build/source/texk/dvipsk/bbox.c
@@ -118,8 +118,9 @@ bbtfmload(register fontdesctype *curfnt)
if (cd) chardat[i] = cd ;
}
if (font_level==1&&ncw!=0) {
- sprintf(errbuf, "Table size mismatch in %s", curfnt->name) ;
- error(errbuf) ;
+ char *msg = concat ("Table size mismatch in ", curfnt->name);
+ error(msg);
+ free(msg);
}
scaledsize = curfnt->scaledsize ;
scaled = (integer *) xmalloc((nh + nd)*sizeof(integer)) ;
diff --git a/Build/source/texk/dvipsk/dvips.c b/Build/source/texk/dvipsk/dvips.c
index 43fa09f3db0..95259ab05a3 100644
--- a/Build/source/texk/dvipsk/dvips.c
+++ b/Build/source/texk/dvipsk/dvips.c
@@ -388,8 +388,9 @@ check_checksum(unsigned c1, unsigned c2, const char *name)
&& !kpse_tex_hush ("checksum")
#endif
) {
- sprintf (errbuf, "Checksum mismatch in %s", name);
- error (errbuf);
+ char *msg = concat ("Checksum mismatch in %s", name);
+ error (msg);
+ free (msg);
}
}
diff --git a/Build/source/texk/dvipsk/header.c b/Build/source/texk/dvipsk/header.c
index 462578cac6e..e915418ea7a 100644
--- a/Build/source/texk/dvipsk/header.c
+++ b/Build/source/texk/dvipsk/header.c
@@ -67,8 +67,13 @@ checkhmem(const char *s, char *pre, char *post)
f = search(figpath, s, READBIN) ;
}
if (f==0) {
- (void)sprintf(errbuf, "! Couldn't find header file %s.\nNote that an absolute path or a relative path with .. are denied in -R2 mode.", s) ;
- error(errbuf) ;
+ char *msg = concat ("! Couldn't find header file: ", s);
+
+ if (secure == 2) {
+ msg = concat (msg,
+ "\nAbsolute and ../relative paths are denied in -R2 mode.");
+ }
+ error(msg) ;
} else {
int len, i, j ;
long mem = -1 ;
diff --git a/Build/source/texk/dvipsk/loadfont.c b/Build/source/texk/dvipsk/loadfont.c
index ebd3416378a..31e8e60a150 100644
--- a/Build/source/texk/dvipsk/loadfont.c
+++ b/Build/source/texk/dvipsk/loadfont.c
@@ -8,6 +8,7 @@
#endif
#ifdef KPATHSEA
#include <kpathsea/c-pathmx.h>
+#include <kpathsea/concatn.h>
#include <kpathsea/tex-glyph.h>
#include <kpathsea/tex-make.h>
#include <kpathsea/lib.h>
@@ -26,7 +27,7 @@
*/
#include "protos_add.h"
-char errbuf[512] ;
+char errbuf[1000];
int lastresortsizes[40] ;
/*
* Now we have some routines to get stuff from the PK file.
@@ -37,8 +38,8 @@ char name[MAXPATHLEN] ;
void
badpk(const char *s)
{
- (void)sprintf(errbuf,"! Bad PK file %s: %s",name,s) ;
- error(errbuf);
+ char *msg = concatn ("! Bad PK file ", name, ": ", s);
+ error(msg);
}
shalfword
@@ -133,21 +134,19 @@ pkopen(register fontdesctype *fd)
#ifdef KPATHSEA
char *this_name = concat (d, n);
- pkfile=pksearch(this_name, READBIN, fd->dpi, &name_ret, &dpi_ret);
+ pkfile = pksearch(this_name, READBIN, fd->dpi, &name_ret, &dpi_ret);
- if (!pkfile || !FILESTRCASEEQ (this_name, name_ret))
- {
- if (!pkfile)
- (void)sprintf(errbuf,
- "Font %s%s not found, characters will be left blank.",
- fd->area, n) ;
- else
- sprintf(errbuf, "Font %s%s not found, using %s instead.",
- fd->area, n, name_ret) ;
- dontmakefont = 1;
- error(errbuf) ;
- }
- else if (!kpse_bitmap_tolerance ((double) dpi_ret, (double) fd->dpi))
+ if (!pkfile || !FILESTRCASEEQ (this_name, name_ret)) {
+ char *msg = concatn ("Font ", fd->area, n, " not found; ");
+ /* wasting some memory */
+ if (!pkfile)
+ msg = concat (msg, "characters will be left blank.");
+ else
+ msg = concat3 (msg, "using ", name_ret);
+ dontmakefont = 1;
+ error (msg);
+
+ } else if (!kpse_bitmap_tolerance ((double) dpi_ret, (double) fd->dpi))
{
fd->loadeddpi = dpi_ret ;
fd->alreadyscaled = 0 ;
@@ -358,16 +357,18 @@ loadfont(register fontdesctype *curfnt)
for(i=pkbyte(); i>0; i--)
(void)pkbyte() ;
k = (integer)(alpha * (real)pkquad()) ;
- if (k > curfnt->designsize + fsizetol ||
- k < curfnt->designsize - fsizetol) {
- (void)sprintf(errbuf,"Design size mismatch in font %s", curfnt->name) ;
- error(errbuf) ;
+ if (k > curfnt->designsize + fsizetol
+ || k < curfnt->designsize - fsizetol) {
+ char *msg = concat ("Design size mismatch in font ", curfnt->name);
+ error (msg);
+ free (msg);
}
k = pkquad() ;
if (k && curfnt->checksum)
if (k!=curfnt->checksum) {
- (void)sprintf(errbuf,"Checksum mismatch in font %s", curfnt->name) ;
- error(errbuf) ;
+ char *msg = concat ("Checksum mismatch in font ", curfnt->name);
+ error (msg);
+ free (msg);
}
k = pkquad() ; /* assume that hppp is correct in the PK file */
k = pkquad() ; /* assume that vppp is correct in the PK file */
diff --git a/Build/source/texk/dvipsk/protos.h b/Build/source/texk/dvipsk/protos.h
index 49fa7951ae1..531c305d8f1 100644
--- a/Build/source/texk/dvipsk/protos.h
+++ b/Build/source/texk/dvipsk/protos.h
@@ -519,7 +519,7 @@ extern Boolean noprocset ;
#endif
/* global variables from loadfont.c */
-extern char errbuf[512] ;
+extern char errbuf[1000] ;
extern int lastresortsizes[40] ;
extern FILE *pkfile ;
diff --git a/Build/source/texk/dvipsk/tfmload.c b/Build/source/texk/dvipsk/tfmload.c
index 04326c5fab6..6bd2febb089 100644
--- a/Build/source/texk/dvipsk/tfmload.c
+++ b/Build/source/texk/dvipsk/tfmload.c
@@ -4,6 +4,7 @@
#include "dvips.h" /* The copyright notice in that file is included too! */
#ifdef KPATHSEA
#include <kpathsea/c-pathmx.h>
+#include <kpathsea/concatn.h>
#endif
/*
* The external declarations:
@@ -20,8 +21,8 @@ static char name[50] ;
void
badtfm(const char *s)
{
- (void)sprintf(errbuf,"! Bad TFM file %s: %s",name,s) ;
- error(errbuf);
+ char *msg = concatn ("! Bad TFM file ", name, ": ", s);
+ error(msg);
}
/*
@@ -153,10 +154,10 @@ tfmload(register fontdesctype *curfnt)
li = tfm32() ;
check_checksum (li, curfnt->checksum, curfnt->name);
li = (integer)(alpha * (real)tfm32()) ;
- if (li > curfnt->designsize + fsizetol ||
- li < curfnt->designsize - fsizetol) {
- (void)sprintf(errbuf,"Design size mismatch in %s", name) ;
- error(errbuf) ;
+ if (li > curfnt->designsize + fsizetol
+ || li < curfnt->designsize - fsizetol) {
+ char *msg = concat ("Design size mismatch in font ", curfnt->name);
+ error(msg);
}
pretend_no_chars=ec+1 ;
if (pretend_no_chars<256) pretend_no_chars=256 ;
@@ -194,8 +195,8 @@ tfmload(register fontdesctype *curfnt)
}
}
if (font_level==1&&ncw!=0) {
- sprintf(errbuf, "Table size mismatch in %s", curfnt->name) ;
- error(errbuf) ;
+ char *msg = ("Table size mismatch in ", curfnt->name);
+ error(errbuf);
}
scaledsize = curfnt->scaledsize ;
scaled = (integer *) xmalloc(nw*sizeof(integer)) ;
diff --git a/Build/source/texk/dvipsk/virtualfont.c b/Build/source/texk/dvipsk/virtualfont.c
index 42a9506824b..08dedb450c5 100644
--- a/Build/source/texk/dvipsk/virtualfont.c
+++ b/Build/source/texk/dvipsk/virtualfont.c
@@ -198,6 +198,7 @@ virtualfont(register fontdesctype *curfnt)
if (k > curfnt->designsize + 2 || k < curfnt->designsize - 2) {
char *msg = concat("Design size mismatch in font ", name);
error(msg);
+ free(msg);
}
/*
* Now we look for font definitions.
diff --git a/Build/source/texk/dvipsk/writet1.c b/Build/source/texk/dvipsk/writet1.c
index ef05d94e702..a54d975c96c 100644
--- a/Build/source/texk/dvipsk/writet1.c
+++ b/Build/source/texk/dvipsk/writet1.c
@@ -789,7 +789,8 @@ static void t1_builtin_enc(void)
}
}
-static void t1_check_end(void)
+static void
+t1_check_end(void)
{
if (t1_eof())
return;
@@ -798,11 +799,12 @@ static void t1_check_end(void)
t1_putline();
}
-static boolean t1_open_fontfile(const char *open_name_prefix)
+static boolean
+t1_open_fontfile(const char *open_name_prefix)
{
if (!t1_open()) {
- (void)sprintf(errbuf, "! Couldn't find font file %s", cur_file_name);
- error(errbuf);
+ char *msg = concat ("! Couldn't find font file ", cur_file_name);
+ error(msg);
}
t1_init_params(open_name_prefix);
return true;