Skip to content

Commit 70bd1b5

Browse files
committedDec 6, 2020
Misc issues
1 parent c5c2647 commit 70bd1b5

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed
 

‎config.m4

+21-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@ if test "$PHP_LIBARCHIVE" != "no"; then
3434
-L$LIBARCHIVE_DIR/$PHP_LIBDIR
3535
])
3636

37+
cflags_null=""
38+
AC_DEFUN([CC_FLAG_CHECK],
39+
[
40+
ac_saved_cflags="$CFLAGS"
41+
CFLAGS="$1 -Werror"
42+
flag_to_add=m4_default([$2],[$1])
43+
AC_MSG_CHECKING([whether the C compiler supports $1])
44+
AC_COMPILE_IFELSE(
45+
[AC_LANG_PROGRAM([])],
46+
[AC_MSG_RESULT([yes])]
47+
[cflags_null="$cflags_null $flag_to_add"],
48+
[AC_MSG_RESULT([no])]
49+
)
50+
CFLAGS="$ac_saved_cflags"
51+
])
52+
CC_FLAG_CHECK([-Wnullability-completeness], [-Wno-nullability-completeness])
53+
54+
extra_cflags="$cflags_null -fvisibility=hidden"
55+
echo "EXTRA_CFLAGS := \$(EXTRA_CFLAGS) $extra_cflags" >> Makefile.fragments
56+
3757
PHP_SUBST(ARCHIVE_SHARED_LIBADD)
38-
PHP_NEW_EXTENSION(archive, libarchive.c stream.c, $ext_shared,,-fvisibility=hidden)
58+
PHP_NEW_EXTENSION(archive, libarchive.c stream.c, $ext_shared,,-Wall)
3959
fi

‎libarchive.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static void arch_it_dtor(zend_object_iterator *iter)
485485
arch_iterator *it = (arch_iterator *)iter;
486486

487487
arch_it_invalidate_current((zend_object_iterator *) it);
488-
arch_object *arch_obj = arch_object_from_zv(&it->parent.data);
489488
zval_ptr_dtor(&it->parent.data); // reduce refcount on archive
490489
it->finished = true;
491490
}
@@ -596,6 +595,8 @@ static PHP_MINIT_FUNCTION(libarchive)
596595
REGISTER_EXTRACT_CONST(HFS_COMPRESSION_FORCED);
597596
REGISTER_EXTRACT_CONST(SECURE_NOABSOLUTEPATHS);
598597
REGISTER_EXTRACT_CONST(CLEAR_NOCHANGE_FFLAGS);
598+
599+
return SUCCESS;
599600
}
600601

601602
/* {{{ libarchive_module_entry

‎stream.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static inline struct archive *nullable arch_from_stream(php_stream *stream)
3636
if (!arch) {
3737
php_error_docref(NULL, E_WARNING,
3838
"libarchive handle has been disposed of already");
39-
return NULL;
4039
}
40+
return arch;
4141
}
4242

4343
static stream_ret_t php_arch_ops_read(php_stream *stream, char *buf, size_t count)
@@ -117,4 +117,4 @@ php_stream *php_stream_arch_cur_entry_stream(zval *nonnull arch_zv)
117117
php_stream *stream = php_stream_alloc(
118118
&php_stream_arch_ops, arch_zv, NULL, "rb");
119119
return stream;
120-
}
120+
}

0 commit comments

Comments
 (0)