- merge from pecl: Force binary mode on windows

This commit is contained in:
Pierre Joye 2007-02-24 18:59:37 +00:00
parent 52a965d136
commit c7d417e50e
3 changed files with 11 additions and 3 deletions

View File

@ -56,8 +56,6 @@ static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *);
static int _zip_changed(struct zip *, int *);
static char *_zip_create_temp_output(struct zip *, FILE **);
int
zip_close(struct zip *za)
{
@ -550,6 +548,9 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
free(temp);
return NULL;
}
#ifdef PHP_WIN32
_setmode(_fileno(tfp), _O_BINARY );
#endif
*outp = tfp;
return temp;

View File

@ -100,7 +100,6 @@ zip_open(const char *fn, int flags, int *zep)
return NULL;
}
/* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL,
just like open() */
if ((fp=fopen(fn, "rb")) == NULL) {
@ -108,6 +107,10 @@ zip_open(const char *fn, int flags, int *zep)
return NULL;
}
#ifdef PHP_WIN32
_setmode(_fileno(fp), _O_BINARY );
#endif
clearerr(fp);
fseek(fp, 0, SEEK_END);
len = ftell(fp);

View File

@ -62,6 +62,10 @@ zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
return NULL;
}
#ifdef PHP_WIN32
_setmode(_fileno(fp), _O_BINARY );
#endif
if ((zs=zip_source_filep(za, fp, start, len)) == NULL) {
fclose(fp);
return NULL;