1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 14:15:46 +01:00

patch to add binary mode on opening files (for Windows+Cygwin compatibility).

This commit is contained in:
dan
2002-09-15 20:37:41 +00:00
parent 3fc803c0d8
commit 92b012e800
20 changed files with 41 additions and 34 deletions

View File

@@ -109,7 +109,7 @@ RLoadJPEG(RContext *context, char *file_name, int index)
*/
struct my_error_mgr jerr;
file = fopen(file_name, "r");
file = fopen(file_name, "rb");
if (!file) {
RErrorCode = RERR_OPEN;
return NULL;

View File

@@ -37,6 +37,10 @@
#include "wraster.h"
/* Silly hack for Windows systems with cygwin */
#ifndef O_BINARY
# define O_BINARY 0
#endif
typedef struct RCachedImage {
RImage *image;
@@ -321,7 +325,7 @@ identFile(char *path)
assert(path!=NULL);
fd = open(path, O_RDONLY);
fd = open(path, O_RDONLY|O_BINARY);
if (fd < 0) {
RErrorCode = RERR_OPEN;
return IM_ERROR;

View File

@@ -245,7 +245,7 @@ RLoadXPM(RContext *context, char *file, int index)
int w, h, ccount, csize;
FILE *f;
f = fopen(file, "r");
f = fopen(file, "rb");
if (!f) {
RErrorCode = RERR_OPEN;
return NULL;
@@ -569,7 +569,7 @@ RSaveXPM(RImage *image, char *filename)
char transp[16];
char buf[128];
file = fopen(filename, "w+");
file = fopen(filename, "wb+");
if (!file) {
RErrorCode = RERR_OPEN;
return False;

View File

@@ -67,7 +67,7 @@ RLoadPNG(RContext *context, char *file, int index)
png_bytep *png_rows;
unsigned char *ptr;
f = fopen(file, "r");
f = fopen(file, "rb");
if (!f) {
RErrorCode = RERR_OPEN;
return NULL;

View File

@@ -127,7 +127,7 @@ RLoadPPM(RContext *context, char *file_name, int index)
#define GETL() if (!fgets(buffer, 255, file)) goto short_file
file = fopen(file_name, "r");
file = fopen(file_name, "rb");
if (!file) {
RErrorCode = RERR_OPEN;
return NULL;