Skip to content

Commit 0098f3e

Browse files
committed
phar: De-indent code
1 parent 0805953 commit 0098f3e

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

ext/phar/zip.c

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -270,46 +270,44 @@ zend_result phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, ch
270270
return FAILURE;
271271
}
272272

273-
{
274-
memcpy((void *)&locator, (void *) p, sizeof(locator));
275-
if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
276-
/* split archives not handled */
277-
php_stream_close(fp);
278-
if (error) {
279-
spprintf(error, 4096, "phar error: split archives spanning multiple zips cannot be processed in zip-based phar \"%s\"", fname);
280-
}
281-
return FAILURE;
273+
memcpy((void *)&locator, (void *) p, sizeof(locator));
274+
if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) {
275+
/* split archives not handled */
276+
php_stream_close(fp);
277+
if (error) {
278+
spprintf(error, 4096, "phar error: split archives spanning multiple zips cannot be processed in zip-based phar \"%s\"", fname);
282279
}
280+
return FAILURE;
281+
}
283282

284-
if (PHAR_GET_16(locator.counthere) != PHAR_GET_16(locator.count)) {
285-
if (error) {
286-
spprintf(error, 4096, "phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar \"%s\"", fname);
287-
}
288-
php_stream_close(fp);
289-
return FAILURE;
283+
if (PHAR_GET_16(locator.counthere) != PHAR_GET_16(locator.count)) {
284+
if (error) {
285+
spprintf(error, 4096, "phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar \"%s\"", fname);
290286
}
287+
php_stream_close(fp);
288+
return FAILURE;
289+
}
291290

292-
mydata = pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist));
293-
mydata->is_persistent = PHAR_G(persist);
291+
mydata = pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist));
292+
mydata->is_persistent = PHAR_G(persist);
294293

295-
/* read in archive comment, if any */
296-
if (PHAR_GET_16(locator.comment_len)) {
294+
/* read in archive comment, if any */
295+
if (PHAR_GET_16(locator.comment_len)) {
297296

298-
metadata = p + sizeof(locator);
297+
metadata = p + sizeof(locator);
299298

300-
if (PHAR_GET_16(locator.comment_len) != size - (metadata - buf)) {
301-
if (error) {
302-
spprintf(error, 4096, "phar error: corrupt zip archive, zip file comment truncated in zip-based phar \"%s\"", fname);
303-
}
304-
php_stream_close(fp);
305-
pefree(mydata, mydata->is_persistent);
306-
return FAILURE;
299+
if (PHAR_GET_16(locator.comment_len) != size - (metadata - buf)) {
300+
if (error) {
301+
spprintf(error, 4096, "phar error: corrupt zip archive, zip file comment truncated in zip-based phar \"%s\"", fname);
307302
}
308-
309-
phar_parse_metadata_lazy(metadata, &mydata->metadata_tracker, PHAR_GET_16(locator.comment_len), mydata->is_persistent);
310-
} else {
311-
ZVAL_UNDEF(&mydata->metadata_tracker.val);
303+
php_stream_close(fp);
304+
pefree(mydata, mydata->is_persistent);
305+
return FAILURE;
312306
}
307+
308+
phar_parse_metadata_lazy(metadata, &mydata->metadata_tracker, PHAR_GET_16(locator.comment_len), mydata->is_persistent);
309+
} else {
310+
ZVAL_UNDEF(&mydata->metadata_tracker.val);
313311
}
314312

315313
mydata->fname = pestrndup(fname, fname_len, mydata->is_persistent);

0 commit comments

Comments
 (0)