Skip to content

Commit 193d8d6

Browse files
committed
:octocat:
1 parent b9f6e71 commit 193d8d6

File tree

3 files changed

+36
-82
lines changed

3 files changed

+36
-82
lines changed

config.m4

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
1-
dnl +----------------------------------------------------------------------+
2-
dnl | PHP Version 5 |
3-
dnl +----------------------------------------------------------------------+
4-
dnl | Copyright (c) 1997-2015 The PHP Group |
5-
dnl +----------------------------------------------------------------------+
6-
dnl | This source file is subject to version 3.01 of the PHP license, |
7-
dnl | that is bundled with this package in the file LICENSE, and is |
8-
dnl | available through the world-wide-web at the following url: |
9-
dnl | http://www.php.net/license/3_01.txt |
10-
dnl | If you did not receive a copy of the PHP license and are unable to |
11-
dnl | obtain it through the world-wide-web, please send a note to |
12-
dnl | [email protected] so we can mail you a copy immediately. |
13-
dnl +----------------------------------------------------------------------+
14-
dnl | Authors: Payden Sutherland <[email protected]> |
15-
dnl | Dan Ungureanu <[email protected]> |
16-
dnl | authors of the `zlib` extension (for guidance) |
17-
dnl +----------------------------------------------------------------------+
1+
dnl config.m4 for extension xz
182

19-
PHP_ARG_WITH(xz, for xz support,
20-
[ --with-xz Include xz support])
3+
PHP_ARG_WITH([xz],
4+
[for xz support],
5+
[AS_HELP_STRING([--with-xz],
6+
[Include xz support])])
217

228
if test "$PHP_XZ" != "no"; then
239

php_xz.h

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
1-
/*
2-
+----------------------------------------------------------------------+
3-
| PHP Version 5 |
4-
+----------------------------------------------------------------------+
5-
| Copyright (c) 1997-2015 The PHP Group |
6-
+----------------------------------------------------------------------+
7-
| This source file is subject to version 3.01 of the PHP license, |
8-
| that is bundled with this package in the file LICENSE, and is |
9-
| available through the world-wide-web at the following url: |
10-
| http://www.php.net/license/3_01.txt |
11-
| If you did not receive a copy of the PHP license and are unable to |
12-
| obtain it through the world-wide-web, please send a note to |
13-
| [email protected] so we can mail you a copy immediately. |
14-
+----------------------------------------------------------------------+
15-
| Authors: Payden Sutherland <[email protected]> |
16-
| Dan Ungureanu <[email protected]> |
17-
| authors of the `zlib` extension (for guidance) |
18-
+----------------------------------------------------------------------+
19-
*/
1+
/* xz extension for PHP */
202

213
#ifndef PHP_XZ_H
22-
#define PHP_XZ_H
4+
# define PHP_XZ_H
235

246
extern zend_module_entry xz_module_entry;
257
extern php_stream_wrapper php_stream_xz_wrapper;
268

27-
#define phpext_xz_ptr &xz_module_entry
9+
# define phpext_xz_ptr &xz_module_entry
10+
11+
# define PHP_XZ_VERSION "0.1.0"
2812

2913
/* The default size of the buffer used for compression and decompression. */
3014
#define XZ_BUFFER_SIZE 4096
@@ -37,6 +21,10 @@ extern php_stream_wrapper php_stream_xz_wrapper;
3721
# define PHP_XZ_API
3822
#endif
3923

24+
# if defined(ZTS) && defined(COMPILE_DL_XZ)
25+
ZEND_TSRMLS_CACHE_EXTERN()
26+
# endif
27+
4028
#ifdef ZTS
4129
# include "TSRM.h"
4230
#endif
@@ -60,7 +48,7 @@ php_stream *php_stream_xzopen(php_stream_wrapper *wrapper, const char *path,
6048
# define XZ_G(v) (xz_globals.v)
6149
#endif
6250

63-
#endif
51+
#endif /* PHP_XZ_H */
6452

6553
/*
6654
* Local variables:
@@ -69,4 +57,4 @@ php_stream *php_stream_xzopen(php_stream_wrapper *wrapper, const char *path,
6957
* End:
7058
* vim600: sw=4 ts=4 fdm=marker
7159
* vim<600: sw=4 ts=4
72-
*/
60+
*/

xz.c

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
1-
/*
2-
+----------------------------------------------------------------------+
3-
| PHP Version 5 |
4-
+----------------------------------------------------------------------+
5-
| Copyright (c) 1997-2015 The PHP Group |
6-
+----------------------------------------------------------------------+
7-
| This source file is subject to version 3.01 of the PHP license, |
8-
| that is bundled with this package in the file LICENSE, and is |
9-
| available through the world-wide-web at the following url: |
10-
| http://www.php.net/license/3_01.txt |
11-
| If you did not receive a copy of the PHP license and are unable to |
12-
| obtain it through the world-wide-web, please send a note to |
13-
| [email protected] so we can mail you a copy immediately. |
14-
+----------------------------------------------------------------------+
15-
| Authors: Payden Sutherland <[email protected]> |
16-
| Dan Ungureanu <[email protected]> |
17-
| authors of the `zlib` extension (for guidance) |
18-
+----------------------------------------------------------------------+
19-
*/
20-
21-
#include <lzma.h>
1+
/* xz extension for PHP */
2+
3+
//#include <lzma.h>
4+
#include "./xz-5.2.4/src/liblzma/api/lzma.h"
225

236
#ifdef HAVE_CONFIG_H
24-
# include "config.h"
7+
# include "config.h"
258
#endif
269

2710
#include "php.h"
2811
#include "php_ini.h"
29-
3012
#include "ext/standard/file.h"
3113
#include "ext/standard/info.h"
32-
3314
#include "utils.h"
34-
3515
#include "php_xz.h"
3616

17+
/* For compatibility with older PHP versions */
18+
#ifndef ZEND_PARSE_PARAMETERS_NONE
19+
#define ZEND_PARSE_PARAMETERS_NONE() \
20+
ZEND_PARSE_PARAMETERS_START(0, 0) \
21+
ZEND_PARSE_PARAMETERS_END()
22+
#endif
23+
3724
/* {{{ arginfo */
3825
ZEND_BEGIN_ARG_INFO(arginfo_xzread, 0)
3926
ZEND_ARG_INFO(0, fp)
@@ -63,46 +50,39 @@ ZEND_BEGIN_ARG_INFO(arginfo_xzdecode, 0)
6350
ZEND_END_ARG_INFO()
6451
/* }}} */
6552

66-
/* {{{ xz_functions[]
67-
Table containing functions exported by this module. */
68-
const zend_function_entry xz_functions[] = {
53+
/* {{{ xz_functions[] */
54+
static const zend_function_entry xz_functions[] = {
6955
PHP_FE(xzdecode, NULL)
7056
PHP_FE(xzopen, NULL)
7157
PHP_FE(xzencode, NULL)
7258
PHP_FALIAS(xzread, fread, arginfo_xzread)
7359
PHP_FALIAS(xzwrite, fwrite, arginfo_xzwrite)
7460
PHP_FALIAS(xzclose, fclose, arginfo_xzclose)
7561
PHP_FALIAS(xzpassthru, fpassthru, arginfo_xzpassthru)
76-
#ifndef PHP_FE_END
77-
{ NULL, NULL, NULL, 0, 0 }
78-
#else
7962
PHP_FE_END
80-
#endif
8163
};
8264
/* }}} */
8365

84-
/* {{{ xz_module_entry
85-
Table describing module. */
66+
/* {{{ xz_module_entry */
8667
zend_module_entry xz_module_entry = {
87-
#if ZEND_MODULE_API_NO >= 20010901
8868
STANDARD_MODULE_HEADER,
89-
#endif
9069
"xz",
9170
xz_functions,
9271
PHP_MINIT(xz),
9372
PHP_MSHUTDOWN(xz),
9473
NULL, /* PHP_RINIT */
9574
NULL, /* PHP_RSHUTDOWN */
9675
PHP_MINFO(xz),
97-
#if ZEND_MODULE_API_NO >= 20010901
98-
"0.1.1",
99-
#endif
76+
PHP_XZ_VERSION,
10077
STANDARD_MODULE_PROPERTIES
10178
};
10279
/* }}} */
10380

10481
#ifdef COMPILE_DL_XZ
105-
ZEND_GET_MODULE(xz)
82+
# ifdef ZTS
83+
ZEND_TSRMLS_CACHE_DEFINE()
84+
# endif
85+
ZEND_GET_MODULE(xz)
10686
#endif
10787

10888
/* {{{ INI entries. */

0 commit comments

Comments
 (0)