summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-03-01 16:45:55 -0300
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-12-19 16:29:47 -0800
commit99bad52b592f4f11887bf9033590b61880c3c976 (patch)
tree62cf7d4b18e8b4b515af43ec84dfffc01efce5ce
parent95760fbe45a700ea4cc118daa536604393721a59 (diff)
Disable some fun stdio wrapping.
The code is still there but no magic with macros is attempted anymore to handle files. This should really be changed to just use stdio, and properly adapt functions like T1Decript, T1eexec, etc.
-rw-r--r--src/Type1/scanfont.c2
-rw-r--r--src/Type1/t1stdio.h42
-rw-r--r--src/Type1/token.c4
-rw-r--r--src/Type1/util.c2
-rw-r--r--src/Type1/util.h6
5 files changed, 21 insertions, 35 deletions
diff --git a/src/Type1/scanfont.c b/src/Type1/scanfont.c
index 054ab14..da5b3c8 100644
--- a/src/Type1/scanfont.c
+++ b/src/Type1/scanfont.c
@@ -1371,7 +1371,7 @@ scan_font(psfont *FontP)
char filename[128];
char filetype[3];
- FILE *fileP;
+ F_FILE *fileP;
char *nameP;
int namelen;
int V;
diff --git a/src/Type1/t1stdio.h b/src/Type1/t1stdio.h
index aa281c0..746e9e7 100644
--- a/src/Type1/t1stdio.h
+++ b/src/Type1/t1stdio.h
@@ -30,10 +30,11 @@
/* $XFree86: xc/lib/font/Type1/t1stdio.h,v 1.9 2001/01/17 19:43:24 dawes Exp $ */
/* T1IO FILE structure and related stuff */
-#ifdef XFree86LOADER
-#undef FILE
-#endif
-#define FILE F_FILE
+#include <stdio.h>
+
+#ifndef _T1STDIO_H_
+#define _T1STDIO_H_
+
typedef unsigned char F_char;
typedef struct F_FILE {
@@ -53,11 +54,6 @@ typedef struct F_FILE {
#define FIOEOF (0x80)
#define FIOERROR (0x40)
-#ifndef NULL
-#include <stddef.h>
-#endif
-
-#define EOF (-1) /* end of file */
#define F_BUFSIZ (512)
#define _XT1getc(f) \
@@ -69,26 +65,14 @@ typedef struct F_FILE {
#define T1Feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0))
-extern FILE *T1Open ( char *fn, char *mode );
-extern int T1Getc ( FILE *f );
-extern int T1Ungetc ( int c, FILE *f );
-extern int T1Read ( char *buffP, int size, int n, FILE *f );
-extern int T1Close ( FILE *f );
-extern FILE *T1eexec ( FILE *f );
+extern F_FILE *T1Open ( char *fn, char *mode );
+extern int T1Getc ( F_FILE *f );
+extern int T1Ungetc ( int c, F_FILE *f );
+extern int T1Read ( char *buffP, int size, int n, F_FILE *f );
+extern int T1Close ( F_FILE *f );
+extern F_FILE *T1eexec ( F_FILE *f );
extern void resetDecrypt ( void );
-#undef fclose
-#undef fopen
-#undef ungetc
-#undef fgetc
-#undef fread
-#undef feof
-#undef ferror
-#define fclose(f) T1Close(f)
-#define fopen(name,mode) T1Open(name,mode)
-#define ungetc(c,f) T1Ungetc(c,f)
-#define fgetc(f) T1Getc(f)
+#define T1Ferror(f) (((f)->flags & FIOERROR)?(f)->error:0)
-#define fread(bufP,size,n,f) T1Read(bufP,size,n,f)
-#define feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0))
-#define ferror(f) (((f)->flags & FIOERROR)?(f)->error:0)
+#endif /* _T1STDIO_H_ */
diff --git a/src/Type1/token.c b/src/Type1/token.c
index 71a968b..4556950 100644
--- a/src/Type1/token.c
+++ b/src/Type1/token.c
@@ -60,8 +60,8 @@ psvalue tokenValue; /* Token value */
* Private variables
* -------------------------------------------------------------------
*/
-
-static FILE *inputFileP; /* Current input file */
+
+static F_FILE *inputFileP; /* Current input file */
/* Token */
diff --git a/src/Type1/util.c b/src/Type1/util.c
index e98f6ba..fc2c501 100644
--- a/src/Type1/util.c
+++ b/src/Type1/util.c
@@ -177,7 +177,7 @@ objFormatName(psobj *objP, int length, char *valueP)
* Format a File object
*/
void
-objFormatFile(psobj *objP, FILE *valueP)
+objFormatFile(psobj *objP, F_FILE *valueP)
{
if (objP != NULL) {
objP->type = OBJ_FILE;
diff --git a/src/Type1/util.h b/src/Type1/util.h
index 25ba572..ad6d148 100644
--- a/src/Type1/util.h
+++ b/src/Type1/util.h
@@ -31,6 +31,8 @@
#ifndef UTIL_H
#define UTIL_H
+
+#include "t1stdio.h"
#ifndef boolean
typedef int boolean;
@@ -109,7 +111,7 @@ typedef union ps_value {
struct ps_obj *arrayP; /* when type is OBJ_ARRAY */
unsigned char *stringP; /* when type is OBJ_STRING */
char *nameP; /* when type is OBJ_NAME */
- FILE *fileP; /* when type is OBJ_FILE */
+ F_FILE *fileP; /* when type is OBJ_FILE */
} psvalue;
/***================================================================***/
@@ -184,7 +186,7 @@ extern void objFormatEncoding ( psobj *objP, int length, psobj *valueP );
extern void objFormatArray ( psobj *objP, int length, psobj *valueP );
extern void objFormatString ( psobj *objP, int length, char *valueP );
extern void objFormatName ( psobj *objP, int length, char *valueP );
-extern void objFormatFile ( psobj *objP, FILE *valueP );
+extern void objFormatFile ( psobj *objP, F_FILE *valueP );
extern void T1InitStdProps(void);
#endif