You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-fonts/zh-kcfonts/files/kcfonts-1.05-code-fixups.patch

182 lines
4.5 KiB

Written by Robin H. Johnson <robbat2@gentoo.org>.
This patch is meant as additional to the FreeBSD patches aa-ad.
1. Cleans up the Makefile so that it is properly parallel.
2. Makefile now tracks errors correctly (piped errors are lost to Make).
3. Fixes bugs in the code that caused glibc's corruption detection to trigger.
4. Fixes code so it should mostly compile on gcc4.
diff -Nuar kcfonts-1.05.orig/Makefile kcfonts-1.05/Makefile
--- kcfonts-1.05.orig/Makefile 2006-01-11 16:33:36.976771750 -0800
+++ kcfonts-1.05/Makefile 2006-01-11 16:32:31.416674500 -0800
@@ -16,20 +16,25 @@
all: $(FONTS)
-kc24f.pcf.gz: kc24f
- ./kc24f | bdftopcf | gzip - > kc24f.pcf.gz
-kc15f.pcf.gz: kc15f
- ./kc15f | bdftopcf | gzip - > kc15f.pcf.gz
-kc8x15.pcf.gz: kca2et kc8x15
+.SECONDARY: $(FONTS:.pcf.gz=.pcf)
+
+%.pcf: %.bdf
+ bdftopcf $< -o $@
+%.pcf.gz: %.pcf
+ gzip -9 < $< > $@
+
+kc24f.bdf: kc24f
+ ./kc24f > kc24f.bdf
+kc15f.bdf: kc15f
+ ./kc15f >kc15f.bdf
+kc8x15.bdf: kca2et kc8x15
./kca2et kctext16.f00 ascfont.15 256 16 15
./kc8x15 > kc8x15.bdf
patch < kc8x15.diff
- bdftopcf kc8x15.bdf | gzip - > kc8x15.pcf.gz
-kc12x24.pcf.gz: kca2et kc12x24
+kc12x24.bdf: kca2et kc12x24
./kca2et kctext24.f00 ascfont.24 256 48 48
./kc12x24 > kc12x24.bdf
patch < kc12x24.diff
- bdftopcf kc12x24.bdf | gzip - > kc12x24.pcf.gz
kc24f: tran.o kc24f.o
$(CC) $(CFLAGS) tran.o kc24f.o -o $@
@@ -52,4 +57,4 @@
mkfontdir $(EFONTDIR)
clean:
- rm -f kc*.pcf.gz ascfont.* *.o *~ $(PROGS)
+ rm -f kc*.pcf.gz ascfont.* *.o *~ $(PROGS) *.pcf *.bdf
diff -Nuar kcfonts-1.05.orig/kc12x24.c kcfonts-1.05/kc12x24.c
--- kcfonts-1.05.orig/kc12x24.c 2006-01-11 16:33:36.980772000 -0800
+++ kcfonts-1.05/kc12x24.c 2006-01-11 16:34:33.300291750 -0800
@@ -6,6 +6,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
char bdfhead[]=
"STARTFONT 2.1\n"
diff -Nuar kcfonts-1.05.orig/kc15f.c kcfonts-1.05/kc15f.c
--- kcfonts-1.05.orig/kc15f.c 2006-01-11 16:33:36.980772000 -0800
+++ kcfonts-1.05/kc15f.c 2006-01-11 16:36:44.316479750 -0800
@@ -8,6 +8,8 @@
#include <stdio.h>
#include <sys/types.h>
+#include <stdlib.h>
+#include "tran.h"
char head[]=
"STARTFONT 2.1\n"
@@ -66,7 +68,7 @@
fprintf(stdout,"ENDCHAR\n");
}
-main()
+int main()
{
if ((fp=fopen("spcfont.15","r"))==NULL) {
@@ -111,5 +113,8 @@
fprintf(stdout,"ENDFONT\n");
- fclose(fp);
+ // fp points to f2, which is either closed or already invalid here.
+ // We don't care about leaking a single fd this late anyway
+ //fclose(fp);
+ return 0;
}
diff -Nuar kcfonts-1.05.orig/kc24f.c kcfonts-1.05/kc24f.c
--- kcfonts-1.05.orig/kc24f.c 2006-01-11 16:33:36.980772000 -0800
+++ kcfonts-1.05/kc24f.c 2006-01-11 16:37:14.438362250 -0800
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <sys/types.h>
+#include <stdlib.h>
+#include "tran.h"
char head[]=
"STARTFONT 2.1\n"
@@ -45,7 +47,7 @@
{
u_char tt[3],uu[3];
u_char bf[24][3];
-int v,i,j,zc;
+int v,i,zc;
if ((v=fread(bf,1,72,fp)) != 72) return;
@@ -66,7 +68,7 @@
fprintf(stdout,"ENDCHAR\n");
}
-main()
+int main()
{
if ((fp=fopen("spcfont.24","r"))==NULL) {
@@ -110,5 +112,8 @@
fprintf(stdout,"ENDFONT\n");
-fclose(fp);
+// fp points to f2, which is either closed or already invalid here.
+// We don't care about leaking a single fd this late anyway
+//fclose(fp);
+return 0;
}
diff -Nuar kcfonts-1.05.orig/kc8x15.c kcfonts-1.05/kc8x15.c
--- kcfonts-1.05.orig/kc8x15.c 2006-01-11 16:33:36.980772000 -0800
+++ kcfonts-1.05/kc8x15.c 2006-01-11 16:34:43.984959500 -0800
@@ -6,6 +6,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
char bdfhead[]=
"STARTFONT 2.1\n"
diff -Nuar kcfonts-1.05.orig/kca2et.c kcfonts-1.05/kca2et.c
--- kcfonts-1.05.orig/kca2et.c 1995-12-16 09:22:25.000000000 -0800
+++ kcfonts-1.05/kca2et.c 2006-01-11 16:35:33.604060500 -0800
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
int i;
unsigned char tmp[60];
@@ -29,5 +29,6 @@
fclose( fp );
fclose( fout );
+ return 0;
}
diff -Nuar kcfonts-1.05.orig/tran.c kcfonts-1.05/tran.c
--- kcfonts-1.05.orig/tran.c 1995-12-16 09:22:06.000000000 -0800
+++ kcfonts-1.05/tran.c 2006-01-11 16:18:10.186851000 -0800
@@ -4,6 +4,7 @@
*/
#include <sys/types.h>
+#include <stdio.h>
void ser_b5(u_char *ch, u_char *tt)
{
diff -Nuar kcfonts-1.05.orig/tran.h kcfonts-1.05/tran.h
--- kcfonts-1.05.orig/tran.h 1969-12-31 16:00:00.000000000 -0800
+++ kcfonts-1.05/tran.h 2006-01-11 16:36:26.099341250 -0800
@@ -0,0 +1,3 @@
+#include <sys/types.h>
+void ser_b5(u_char *ch, u_char *tt);
+void b5_ser(u_char *s, u_char *t);