@@ -63,6 +63,8 @@ extern zend_module_entry rar_module_entry;
6363#include "TSRM.h"
6464#endif
6565
66+ #include "php_compat.h"
67+
6668/* causes linking errors (multiple definitions) in functions
6769 that were requested inlining but were not inlined by the compiler */
6870/* #include "unrar/rar.hpp */
@@ -87,63 +89,6 @@ enum FILE_SYSTEM_REDIRECT {
8789/* maximum comment size if 64KB */
8890#define RAR_MAX_COMMENT_SIZE 65536
8991
90- /* PHP 7+ abstraction */
91- #if PHP_MAJOR_VERSION >= 7
92- typedef zend_object * rar_obj_ref ;
93-
94- #define rar_zval_add_ref (ppzv ) zval_add_ref(*ppzv)
95-
96- #define ZVAL_ALLOC_DUP (dst , src ) \
97- do { \
98- dst = (zval*) emalloc(sizeof(zval)); \
99- ZVAL_DUP(dst, src); \
100- } while (0)
101-
102- #define RAR_RETURN_STRINGL (s , l , duplicate ) \
103- do { \
104- RETVAL_STRINGL(s, l); \
105- if (duplicate == 0) { \
106- efree(s); \
107- } \
108- return; \
109- } while (0)
110-
111- #define RAR_ZVAL_STRING (z , s , duplicate ) \
112- do { \
113- ZVAL_STRING(z, s); \
114- if (duplicate == 0) { \
115- efree(s); \
116- } \
117- } while (0)
118-
119- typedef size_t zpp_s_size_t ;
120-
121- #define MAKE_STD_ZVAL (zv_p ) \
122- do { \
123- (zv_p) = emalloc(sizeof(zval)); \
124- ZVAL_NULL(zv_p); \
125- } while (0)
126- #define INIT_ZVAL (zv ) ZVAL_UNDEF(&zv)
127-
128- #define ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL
129-
130- #else /* PHP 5.x */
131- typedef zend_object_handle rar_obj_ref ;
132-
133- #define rar_zval_add_ref zval_add_ref
134- #define ZVAL_ALLOC_DUP (dst , src ) \
135- do { \
136- zval *z_src = src; \
137- dst = z_src; \
138- zval_add_ref(&dst); \
139- SEPARATE_ZVAL(&dst); \
140- } while (0)
141- #define RAR_ZVAL_STRING ZVAL_STRING
142- #define RAR_RETURN_STRINGL (s , l , duplicate ) RETURN_STRINGL(s, l, duplicate)
143- typedef int zpp_s_size_t ;
144- #define zend_hash_str_del zend_hash_del
145- #endif
146-
14792typedef struct _rar_cb_user_data {
14893 char * password ; /* can be NULL */
14994 zval * callable ; /* can be NULL */
@@ -333,8 +278,9 @@ void _rar_close_file_resource(rar_file_t *rar);
333278/* Fetches the rar_file_t part of the RarArchive object in order to use the
334279 * operations above and (discouraged) to have direct access to the fields
335280 * RarEntry::extract/getStream access extract_open_dat and cb_userdata */
336- int _rar_get_file_resource (zval * zval_file , rar_file_t * * rar_file TSRMLS_DC );
337- int _rar_get_file_resource_ex (zval * zval_file , rar_file_t * * rar_file , int silent TSRMLS_DC );
281+ int _rar_get_file_resource_zv (zval * zv_file , rar_file_t * * rar_file TSRMLS_DC );
282+ int _rar_get_file_resource_zv_ex (zval * zv_file , rar_file_t * * rar_file , int silent TSRMLS_DC );
283+ int _rar_get_file_resource_ex (rar_obj_ref objref_file , rar_file_t * * rar_file , int silent TSRMLS_DC );
338284void minit_rararch (TSRMLS_D );
339285
340286PHP_FUNCTION (rar_open );
0 commit comments