diff options
-rw-r--r-- | base/fapiufst.c | 2 | ||||
-rw-r--r-- | base/gsicc_manage.c | 6 | ||||
-rw-r--r-- | base/lib.mak | 2 | ||||
-rw-r--r-- | base/sfxcommon.c | 9 | ||||
-rw-r--r-- | base/strmio.h | 3 | ||||
-rw-r--r-- | devices/vector/gdevpdfu.c | 4 | ||||
-rw-r--r-- | pcl/pl/pllfont.c | 6 | ||||
-rw-r--r-- | psi/zfile.c | 3 |
8 files changed, 23 insertions, 12 deletions
diff --git a/base/fapiufst.c b/base/fapiufst.c index 647b44f19..6c566f713 100644 --- a/base/fapiufst.c +++ b/base/fapiufst.c | |||
@@ -970,7 +970,7 @@ ufst_make_font_data(fapi_ufst_server * r, const char *font_file_path, | |||
970 | d->font_type = FC_FCO_TYPE; | 970 | d->font_type = FC_FCO_TYPE; |
971 | } | 971 | } |
972 | else { | 972 | else { |
973 | stream *f = sfopen(font_file_path, "rb", r->mem); | 973 | stream *f = sfopen(font_file_path, "r", r->mem); |
974 | 974 | ||
975 | if (f == NULL) { | 975 | if (f == NULL) { |
976 | ufst_emprintf1(r->mem, | 976 | ufst_emprintf1(r->mem, |
diff --git a/base/gsicc_manage.c b/base/gsicc_manage.c index 065984e0e..f43177a6a 100644 --- a/base/gsicc_manage.c +++ b/base/gsicc_manage.c | |||
@@ -1055,7 +1055,7 @@ gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc, | |||
1055 | strcat(buffer, pname); | 1055 | strcat(buffer, pname); |
1056 | /* Just to make sure we were null terminated */ | 1056 | /* Just to make sure we were null terminated */ |
1057 | buffer[namelen + dirlen] = '\0'; | 1057 | buffer[namelen + dirlen] = '\0'; |
1058 | str = sfopen(buffer, "rb", mem_gc); | 1058 | str = sfopen(buffer, "r", mem_gc); |
1059 | gs_free_object(mem_gc, buffer, "gsicc_open_search"); | 1059 | gs_free_object(mem_gc, buffer, "gsicc_open_search"); |
1060 | if (str != NULL) { | 1060 | if (str != NULL) { |
1061 | *strp = str; | 1061 | *strp = str; |
@@ -1064,7 +1064,7 @@ gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc, | |||
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | /* First just try it like it is */ | 1066 | /* First just try it like it is */ |
1067 | str = sfopen(pname, "rb", mem_gc); | 1067 | str = sfopen(pname, "r", mem_gc); |
1068 | if (str != NULL) { | 1068 | if (str != NULL) { |
1069 | *strp = str; | 1069 | *strp = str; |
1070 | return 0; | 1070 | return 0; |
@@ -1080,7 +1080,7 @@ gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc, | |||
1080 | strcat(buffer, pname); | 1080 | strcat(buffer, pname); |
1081 | /* Just to make sure we were null terminated */ | 1081 | /* Just to make sure we were null terminated */ |
1082 | buffer[namelen + strlen(DEFAULT_DIR_ICC)] = '\0'; | 1082 | buffer[namelen + strlen(DEFAULT_DIR_ICC)] = '\0'; |
1083 | str = sfopen(buffer, "rb", mem_gc); | 1083 | str = sfopen(buffer, "r", mem_gc); |
1084 | gs_free_object(mem_gc, buffer, "gsicc_open_search"); | 1084 | gs_free_object(mem_gc, buffer, "gsicc_open_search"); |
1085 | if (str == NULL) { | 1085 | if (str == NULL) { |
1086 | gs_warn1("Could not find %s ",pname); | 1086 | gs_warn1("Could not find %s ",pname); |
diff --git a/base/lib.mak b/base/lib.mak index 54d354b33..8fabc177d 100644 --- a/base/lib.mak +++ b/base/lib.mak | |||
@@ -1442,7 +1442,7 @@ $(GLD)sfile.dev : $(LIB_MAK) $(ECHOGS_XE) $(sfile_) $(MAKEDIRS) | |||
1442 | 1442 | ||
1443 | $(GLOBJ)sfxcommon.$(OBJ) : $(GLSRC)sfxcommon.c $(AK) $(stdio__h)\ | 1443 | $(GLOBJ)sfxcommon.$(OBJ) : $(GLSRC)sfxcommon.c $(AK) $(stdio__h)\ |
1444 | $(memory__h) $(unistd__h) $(gsmemory_h) $(gp_h) $(stream_h)\ | 1444 | $(memory__h) $(unistd__h) $(gsmemory_h) $(gp_h) $(stream_h)\ |
1445 | $(gserrors_h) $(MAKEDIRS) | 1445 | $(gserrors_h) $(assert__h) $(MAKEDIRS) |
1446 | $(GLCC) $(GLO_)sfxcommon.$(OBJ) $(C_) $(GLSRC)sfxcommon.c | 1446 | $(GLCC) $(GLO_)sfxcommon.$(OBJ) $(C_) $(GLSRC)sfxcommon.c |
1447 | 1447 | ||
1448 | $(GLOBJ)sfxstdio.$(OBJ) : $(GLSRC)sfxstdio.c $(AK) $(stdio__h)\ | 1448 | $(GLOBJ)sfxstdio.$(OBJ) : $(GLSRC)sfxstdio.c $(AK) $(stdio__h)\ |
diff --git a/base/sfxcommon.c b/base/sfxcommon.c index cec104df8..5177a62b6 100644 --- a/base/sfxcommon.c +++ b/base/sfxcommon.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "gp.h" | 23 | #include "gp.h" |
24 | #include "gserrors.h" | 24 | #include "gserrors.h" |
25 | #include "stream.h" | 25 | #include "stream.h" |
26 | #include "assert_.h" | ||
26 | 27 | ||
27 | #define DEFAULT_BUFFER_SIZE 2048 | 28 | #define DEFAULT_BUFFER_SIZE 2048 |
28 | const uint file_default_buffer_size = DEFAULT_BUFFER_SIZE; | 29 | const uint file_default_buffer_size = DEFAULT_BUFFER_SIZE; |
@@ -66,6 +67,14 @@ file_open_stream(const char *fname, uint len, const char *file_access, | |||
66 | FILE *file; | 67 | FILE *file; |
67 | char fmode[4]; /* r/w/a, [+], [b], null */ | 68 | char fmode[4]; /* r/w/a, [+], [b], null */ |
68 | 69 | ||
70 | #ifdef DEBUG | ||
71 | if (strlen(gp_fmode_binary_suffix) > 0) { | ||
72 | if (strchr(file_access, gp_fmode_binary_suffix[0]) != NULL) | ||
73 | dmprintf(mem, "\nWarning: spurious 'b' character in file access mode\n"); | ||
74 | assert(strchr(file_access, gp_fmode_binary_suffix[0]) == NULL); | ||
75 | } | ||
76 | #endif | ||
77 | |||
69 | if (!iodev) | 78 | if (!iodev) |
70 | iodev = iodev_default(mem); | 79 | iodev = iodev_default(mem); |
71 | code = file_prepare_stream(fname, len, file_access, buffer_size, ps, fmode, mem); | 80 | code = file_prepare_stream(fname, len, file_access, buffer_size, ps, fmode, mem); |
diff --git a/base/strmio.h b/base/strmio.h index 9e0c77be9..78431c0fa 100644 --- a/base/strmio.h +++ b/base/strmio.h | |||
@@ -35,6 +35,9 @@ typedef struct gs_memory_s gs_memory_t; | |||
35 | * If iodev_default is the '%os' device, then the file will be on the host | 35 | * If iodev_default is the '%os' device, then the file will be on the host |
36 | * file system transparently to the caller. The "%os%" prefix can be used | 36 | * file system transparently to the caller. The "%os%" prefix can be used |
37 | * to explicilty access the host file system. | 37 | * to explicilty access the host file system. |
38 | * | ||
39 | * NOTE: sfopen() always opens files in "binary" mode on systems where that | ||
40 | * is applicable - so callers should not do so themselves. | ||
38 | */ | 41 | */ |
39 | stream * sfopen(const char *path, const char *mode, gs_memory_t *mem); | 42 | stream * sfopen(const char *path, const char *mode, gs_memory_t *mem); |
40 | 43 | ||
diff --git a/devices/vector/gdevpdfu.c b/devices/vector/gdevpdfu.c index a577d08be..1767a26c5 100644 --- a/devices/vector/gdevpdfu.c +++ b/devices/vector/gdevpdfu.c | |||
@@ -168,7 +168,7 @@ copy_ps_file_stripping_all(stream *s, const char *fname, bool HaveTrueTypes) | |||
168 | int n, l = 0, m = sizeof(buf) - 1, outl = 0; | 168 | int n, l = 0, m = sizeof(buf) - 1, outl = 0; |
169 | bool skipping = false; | 169 | bool skipping = false; |
170 | 170 | ||
171 | f = sfopen(fname, "rb", s->memory); | 171 | f = sfopen(fname, "r", s->memory); |
172 | if (f == NULL) | 172 | if (f == NULL) |
173 | return_error(gs_error_undefinedfilename); | 173 | return_error(gs_error_undefinedfilename); |
174 | n = sfread(buf, 1, m, f); | 174 | n = sfread(buf, 1, m, f); |
@@ -244,7 +244,7 @@ copy_ps_file_strip_comments(stream *s, const char *fname, bool HaveTrueTypes) | |||
244 | int n, l = 0, m = sizeof(buf) - 1, outl = 0; | 244 | int n, l = 0, m = sizeof(buf) - 1, outl = 0; |
245 | bool skipping = false; | 245 | bool skipping = false; |
246 | 246 | ||
247 | f = sfopen(fname, "rb", s->memory); | 247 | f = sfopen(fname, "r", s->memory); |
248 | if (f == NULL) | 248 | if (f == NULL) |
249 | return_error(gs_error_undefinedfilename); | 249 | return_error(gs_error_undefinedfilename); |
250 | n = sfread(buf, 1, m, f); | 250 | n = sfread(buf, 1, m, f); |
diff --git a/pcl/pl/pllfont.c b/pcl/pl/pllfont.c index 6076fabd9..f63f21e8b 100644 --- a/pcl/pl/pllfont.c +++ b/pcl/pl/pllfont.c | |||
@@ -683,7 +683,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t * mem, | |||
683 | /* null terminate the string */ | 683 | /* null terminate the string */ |
684 | tmp_path_copy[code] = '\0'; | 684 | tmp_path_copy[code] = '\0'; |
685 | 685 | ||
686 | in = sfopen(tmp_path_copy, "rb", mem); | 686 | in = sfopen(tmp_path_copy, "r", mem); |
687 | if (in == NULL) { /* shouldn't happen */ | 687 | if (in == NULL) { /* shouldn't happen */ |
688 | dmprintf1(mem, "cannot open file %s\n", tmp_path_copy); | 688 | dmprintf1(mem, "cannot open file %s\n", tmp_path_copy); |
689 | continue; | 689 | continue; |
@@ -719,7 +719,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t * mem, | |||
719 | tmp_path_copy); | 719 | tmp_path_copy); |
720 | } | 720 | } |
721 | /* reopen the file */ | 721 | /* reopen the file */ |
722 | in = sfopen(tmp_path_copy, "rb", mem); | 722 | in = sfopen(tmp_path_copy, "r", mem); |
723 | if (in == NULL) | 723 | if (in == NULL) |
724 | return gs_throw1(0, | 724 | return gs_throw1(0, |
725 | "An unrecoverable failure occurred while reading the resident font %s\n", | 725 | "An unrecoverable failure occurred while reading the resident font %s\n", |
@@ -763,7 +763,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t * mem, | |||
763 | dmprintf2(mem, | 763 | dmprintf2(mem, |
764 | "TrueType font %s in file %s not found in table\n", | 764 | "TrueType font %s in file %s not found in table\n", |
765 | buffer, tmp_path_copy); | 765 | buffer, tmp_path_copy); |
766 | in = sfopen(tmp_path_copy, "rb", mem); | 766 | in = sfopen(tmp_path_copy, "r", mem); |
767 | code = | 767 | code = |
768 | get_name_from_tt_file(in, mem, buffer, WINDOWSNAME); | 768 | get_name_from_tt_file(in, mem, buffer, WINDOWSNAME); |
769 | sfclose(in); | 769 | sfclose(in); |
diff --git a/psi/zfile.c b/psi/zfile.c index 121e403e8..320ecd500 100644 --- a/psi/zfile.c +++ b/psi/zfile.c | |||
@@ -1034,7 +1034,7 @@ lib_file_open(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx | |||
1034 | bool starting_arg_file = (i_ctx_p == NULL) ? true : i_ctx_p->starting_arg_file; | 1034 | bool starting_arg_file = (i_ctx_p == NULL) ? true : i_ctx_p->starting_arg_file; |
1035 | bool search_with_no_combine = false; | 1035 | bool search_with_no_combine = false; |
1036 | bool search_with_combine = false; | 1036 | bool search_with_combine = false; |
1037 | char fmode[4] = { 'r', 0, 0, 0 }; /* room for binary suffix */ | 1037 | char fmode[2] = { 'r', 0}; |
1038 | gx_io_device *iodev = iodev_default(mem); | 1038 | gx_io_device *iodev = iodev_default(mem); |
1039 | gs_main_instance *minst = get_minst_from_memory(mem); | 1039 | gs_main_instance *minst = get_minst_from_memory(mem); |
1040 | int code; | 1040 | int code; |
@@ -1043,7 +1043,6 @@ lib_file_open(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx | |||
1043 | if (iodev == 0) | 1043 | if (iodev == 0) |
1044 | iodev = (gx_io_device *)gx_io_device_table[0]; | 1044 | iodev = (gx_io_device *)gx_io_device_table[0]; |
1045 | 1045 | ||
1046 | strcat(fmode, gp_fmode_binary_suffix); | ||
1047 | if (gp_file_name_is_absolute(fname, flen)) { | 1046 | if (gp_file_name_is_absolute(fname, flen)) { |
1048 | search_with_no_combine = true; | 1047 | search_with_no_combine = true; |
1049 | search_with_combine = false; | 1048 | search_with_combine = false; |