summaryrefslogtreecommitdiff
path: root/textproc/groff/patches/patch-ba
blob: 5e986260c18fbd144712fd9632228cb27173888a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$NetBSD: patch-ba,v 1.1 2004/08/02 16:14:24 wiz Exp $

--- src/utils/hpftodit/hpftodit.cpp.orig	2004-04-07 18:25:21.000000000 +0200
+++ src/utils/hpftodit/hpftodit.cpp
@@ -548,7 +548,8 @@ output_font_name(File &f)
       *p++ = f.get_byte();
   }
   else			// value contains the string
-    sprintf(font_name, "%.*s", count, (char*)(tag_info(font_name_tag).value));
+    sprintf(font_name, "%.*s",
+	    count, (char*)&(tag_info(font_name_tag).value));
 
   // remove any trailing space
   p = font_name + count - 1;
@@ -717,13 +718,17 @@ read_and_output_pcltypeface(File &f)
 {
   printf("pcltypeface ");
   require_tag(typeface_tag);
-  f.seek(tag_info(typeface_tag).value);
-  for (uint32 i = 0; i < tag_info(typeface_tag).count; i++) {
-    unsigned char c = f.get_byte();
-    if (c == '\0')
-      break;
-    putchar(c);
+  if (tag_info(typeface_tag).count > 4) {
+    f.seek(tag_info(typeface_tag).value);
+    for (uint32 i = 0; i < tag_info(typeface_tag).count; i++) {
+      unsigned char c = f.get_byte();
+      if (c == '\0')
+	break;
+      putchar(c);
+    }
   }
+  else
+    printf("%.4s", (char *)&(tag_info(typeface_tag).value));
   printf("\n");
 }
 
@@ -1168,7 +1173,7 @@ dump_ascii(File &f, tag_type t)
       printf("%c", f.get_byte());
   }
   else
-    printf("%.4s", (char*)(tag_info(t).value));
+    printf("%.4s", (char*)&(tag_info(t).value));
   putchar('"');
 }