mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
rechecked the merged libzip, took also the indents from the original to
avoid confusion next time
This commit is contained in:
parent
a39bcfc5ee
commit
f4a44f18b8
6 changed files with 18 additions and 28 deletions
|
@ -317,21 +317,21 @@ zip_close(struct zip *za)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (za->zp) {
|
if (za->zp) {
|
||||||
fclose(za->zp);
|
fclose(za->zp);
|
||||||
za->zp = NULL;
|
za->zp = NULL;
|
||||||
reopen_on_error = 1;
|
reopen_on_error = 1;
|
||||||
}
|
}
|
||||||
if (_zip_rename(temp, za->zn) != 0) {
|
if (_zip_rename(temp, za->zn) != 0) {
|
||||||
_zip_error_set(&za->error, ZIP_ER_RENAME, errno);
|
_zip_error_set(&za->error, ZIP_ER_RENAME, errno);
|
||||||
remove(temp);
|
remove(temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
if (reopen_on_error) {
|
if (reopen_on_error) {
|
||||||
/* ignore errors, since we're already in an error case */
|
/* ignore errors, since we're already in an error case */
|
||||||
za->zp = fopen(za->zn, "rb");
|
za->zp = fopen(za->zn, "rb");
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
#ifndef PHP_WIN32
|
#ifndef PHP_WIN32
|
||||||
mask = umask(0);
|
mask = umask(0);
|
||||||
umask(mask);
|
umask(mask);
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
ZIP_EXTERN(int)
|
ZIP_EXTERN(int)
|
||||||
zip_delete(struct zip *za, zip_uint64_t idx)
|
zip_delete(struct zip *za, zip_uint64_t idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx >= za->nentry) {
|
if (idx >= za->nentry) {
|
||||||
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,7 +472,7 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
|
||||||
static time_t
|
static time_t
|
||||||
_zip_d2u_time(int dtime, int ddate)
|
_zip_d2u_time(int dtime, int ddate)
|
||||||
{
|
{
|
||||||
struct tm tm = {0};
|
struct tm tm;
|
||||||
|
|
||||||
memset(&tm, 0, sizeof(tm));
|
memset(&tm, 0, sizeof(tm));
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include "zipint.h"
|
#include "zipint.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ZIP_EXTERN(struct zip_file *)
|
ZIP_EXTERN(struct zip_file *)
|
||||||
|
|
|
@ -61,14 +61,5 @@ zip_fread(struct zip_file *zf, void *outbuf, zip_uint64_t toread)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX the following left from the previous PHP port, let's see how to use it now */
|
|
||||||
/*zf->zstr->next_out = (Bytef *)outbuf;
|
|
||||||
zf->zstr->avail_out = toread;
|
|
||||||
out_before = zf->zstr->total_out;*/
|
|
||||||
|
|
||||||
/* endless loop until something has been accomplished */
|
|
||||||
/*for (;;) {
|
|
||||||
ret = inflate(zf->zstr, Z_SYNC_FLUSH);*/
|
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ _zip_check_torrentzip(struct zip *za)
|
||||||
|
|
||||||
if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size,
|
if (_zip_filerange_crc(za->zp, za->cdir->offset, za->cdir->size,
|
||||||
&crc_got, NULL) < 0)
|
&crc_got, NULL) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (crc_got == crc_should)
|
if (crc_got == crc_should)
|
||||||
za->flags |= ZIP_AFL_TORRENT;
|
za->flags |= ZIP_AFL_TORRENT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue