[evince] [dvi] Add 'b' to fopen mode for w32 compatibility



commit 203a9fad044c6d090788ce716ce45c9ad7ba9399
Author: Hib Eris <hib hiberis nl>
Date:   Mon Jan 25 14:41:09 2010 +0100

    [dvi] Add 'b' to fopen mode for w32 compatibility

 backend/dvi/mdvi-lib/dviread.c |    4 ++--
 backend/dvi/mdvi-lib/font.c    |    2 +-
 backend/dvi/mdvi-lib/fontmap.c |   14 +++++++-------
 backend/dvi/mdvi-lib/tfmfile.c |    6 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/backend/dvi/mdvi-lib/dviread.c b/backend/dvi/mdvi-lib/dviread.c
index 285524e..6b37704 100644
--- a/backend/dvi/mdvi-lib/dviread.c
+++ b/backend/dvi/mdvi-lib/dviread.c
@@ -684,7 +684,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil
 		perror(file);
 		return NULL;
 	}
-	p = fopen(filename, "r");
+	p = fopen(filename, "rb");
 	if(p == NULL) {
 		perror(file);
 		mdvi_free(filename);
@@ -1008,7 +1008,7 @@ int	mdvi_dopage(DviContext *dvi, int pageno)
 again:	
 	if(dvi->in == NULL) {
 		/* try reopening the file */
-		dvi->in = fopen(dvi->filename, "r");
+		dvi->in = fopen(dvi->filename, "rb");
 		if(dvi->in == NULL) {
 			mdvi_warning(_("%s: could not reopen file (%s)\n"),
 				     dvi->filename,
diff --git a/backend/dvi/mdvi-lib/font.c b/backend/dvi/mdvi-lib/font.c
index 065b586..0b3d04b 100644
--- a/backend/dvi/mdvi-lib/font.c
+++ b/backend/dvi/mdvi-lib/font.c
@@ -36,7 +36,7 @@ int	font_reopen(DviFont *font)
 {
 	if(font->in)
 		fseek(font->in, (long)0, SEEK_SET);
-	else if((font->in = fopen(font->filename, "r")) == NULL) {
+	else if((font->in = fopen(font->filename, "rb")) == NULL) {
 		DEBUG((DBG_FILES, "reopen(%s) -> Error\n", font->filename));
 		return -1;
 	}
diff --git a/backend/dvi/mdvi-lib/fontmap.c b/backend/dvi/mdvi-lib/fontmap.c
index e186bd4..d95ce25 100644
--- a/backend/dvi/mdvi-lib/fontmap.c
+++ b/backend/dvi/mdvi-lib/fontmap.c
@@ -119,7 +119,7 @@ static int read_encoding(DviEncoding *enc)
 	
 	ASSERT(enc->private == NULL);
 
-	in = fopen(enc->filename, "r");
+	in = fopen(enc->filename, "rb");
 	if(in == NULL) {
 		DEBUG((DBG_FMAP, "%s: could not read `%s' (%s)\n",
 			enc->name, enc->filename, strerror(errno)));
@@ -267,7 +267,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace)
 	if(filename == NULL)
 		filename = mdvi_strdup(basefile);
 
-	in = fopen(filename, "r");
+	in = fopen(filename, "rb");
 	if(in == NULL) {
 		mdvi_free(filename);
 		return NULL;
@@ -478,9 +478,9 @@ DviFontMapEnt	*mdvi_load_fontmap(const char *file)
 	if(ptr == NULL)
 		ptr = kpse_find_file(file, kpse_dvips_config_format, 0);
 	if(ptr == NULL)
-		in = fopen(file, "r");			
+		in = fopen(file, "rb");
 	else {
-		in = fopen(ptr, "r");
+		in = fopen(ptr, "rb");
 		mdvi_free(ptr);
 	}
 	if(in == NULL)
@@ -728,9 +728,9 @@ static int	mdvi_init_fontmaps(void)
 	/* let's ask kpathsea for the file first */
 	file = kpse_find_file(config, kpse_program_text_format, 0);
 	if(file == NULL)
-		in = fopen(config, "r");
+		in = fopen(config, "rb");
 	else {
-		in = fopen(file, "r");
+		in = fopen(file, "rb");
 		mdvi_free(file);
 	}
 	if(in == NULL)
@@ -906,7 +906,7 @@ int	mdvi_ps_read_fontmap(const char *name)
 		fullname = kpse_path_search(pslibdir, name, 1);
 	else
 		fullname = (char *)name;
-	in = fopen(fullname, "r");
+	in = fopen(fullname, "rb");
 	if(in == NULL) {
 		if(fullname != name)
 			mdvi_free(fullname);
diff --git a/backend/dvi/mdvi-lib/tfmfile.c b/backend/dvi/mdvi-lib/tfmfile.c
index cab4f19..b8235bf 100644
--- a/backend/dvi/mdvi-lib/tfmfile.c
+++ b/backend/dvi/mdvi-lib/tfmfile.c
@@ -81,7 +81,7 @@ int	afm_load_file(const char *filename, TFMInfo *info)
 	CharMetricInfo *cm;
 	FILE	*in;
 	
-	in = fopen(filename, "r");
+	in = fopen(filename, "rb");
 	if(in == NULL)
 		return -1;
 	status = afm_parse_file(in, &fi, P_GM);
@@ -162,7 +162,7 @@ int	tfm_load_file(const char *filename, TFMInfo *info)
 	Int32	*depths;
 	Uint32	checksum;
 
-	in = fopen(filename, "r");
+	in = fopen(filename, "rb");
 	if(in == NULL)
 		return -1;
 	tfm = NULL;
@@ -445,7 +445,7 @@ static int	ofm_load_file(const char *filename, TFMInfo *info)
 	int	olevel;
 	int	nwords;
 
-	in = fopen(filename, "r");
+	in = fopen(filename, "rb");
 	if(in == NULL)
 		return -1;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]