mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
- merge from pecl: Force binary mode on windows
This commit is contained in:
parent
52a965d136
commit
c7d417e50e
@ -56,8 +56,6 @@ static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *);
|
|||||||
static int _zip_changed(struct zip *, int *);
|
static int _zip_changed(struct zip *, int *);
|
||||||
static char *_zip_create_temp_output(struct zip *, FILE **);
|
static char *_zip_create_temp_output(struct zip *, FILE **);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
zip_close(struct zip *za)
|
zip_close(struct zip *za)
|
||||||
{
|
{
|
||||||
@ -550,6 +548,9 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
|
|||||||
free(temp);
|
free(temp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
_setmode(_fileno(tfp), _O_BINARY );
|
||||||
|
#endif
|
||||||
|
|
||||||
*outp = tfp;
|
*outp = tfp;
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -100,7 +100,6 @@ zip_open(const char *fn, int flags, int *zep)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL,
|
/* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL,
|
||||||
just like open() */
|
just like open() */
|
||||||
if ((fp=fopen(fn, "rb")) == NULL) {
|
if ((fp=fopen(fn, "rb")) == NULL) {
|
||||||
@ -108,6 +107,10 @@ zip_open(const char *fn, int flags, int *zep)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
_setmode(_fileno(fp), _O_BINARY );
|
||||||
|
#endif
|
||||||
|
|
||||||
clearerr(fp);
|
clearerr(fp);
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
len = ftell(fp);
|
len = ftell(fp);
|
||||||
|
@ -62,6 +62,10 @@ zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
_setmode(_fileno(fp), _O_BINARY );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((zs=zip_source_filep(za, fp, start, len)) == NULL) {
|
if ((zs=zip_source_filep(za, fp, start, len)) == NULL) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user