2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / pr34688.c
blob60e0f3c9f1556a99690cf973bc31717ba2cf3189
1 typedef __SIZE_TYPE__ size_t;
2 typedef struct {
4 HashTable;
5 typedef struct _zval_struct zval;
6 typedef struct _zend_guard {
7 HashTable *ht;
9 zvalue_value;
10 struct _zval_struct {
11 zvalue_value value;
13 php_output_globals;
14 typedef struct _php_stream php_stream;
15 typedef struct _php_stream_filter php_stream_filter;
16 typedef struct _php_stream_bucket_brigade php_stream_bucket_brigade;
17 typedef enum {
18 PSFS_ERR_FATAL, PSFS_FEED_ME, PSFS_PASS_ON, }
19 php_stream_filter_status_t;
20 typedef struct _php_stream_filter_ops {
21 php_stream_filter_status_t (*filter)( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags );
22 void (*dtor)(php_stream_filter *thisfilter );
23 const char *label;
25 php_stream_filter_ops;
26 struct _php_stream_filter {
28 typedef struct _php_stream_filter_factory {
29 php_stream_filter *(*create_filter)(const char *filtername, zval *filterparams, int persistent );
31 php_stream_filter_factory;
32 typedef enum _php_conv_err_t {
33 PHP_CONV_ERR_SUCCESS = 0, PHP_CONV_ERR_UNKNOWN, PHP_CONV_ERR_TOO_BIG, PHP_CONV_ERR_INVALID_SEQ, PHP_CONV_ERR_UNEXPECTED_EOS, PHP_CONV_ERR_EXISTS, PHP_CONV_ERR_MORE, PHP_CONV_ERR_ALLOC, PHP_CONV_ERR_NOT_FOUND }
34 php_conv_err_t;
35 typedef struct _php_conv php_conv;
36 typedef php_conv_err_t (*php_conv_convert_func)(php_conv *, const char **, size_t *, char **, size_t *);
37 struct _php_conv {
38 php_conv_convert_func convert_op;
40 php_conv_base64_decode;
41 typedef struct _php_conv_qprint_decode {
42 php_conv _super;
43 const char *lbchars;
45 php_conv_qprint_decode;
46 static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_pp, size_t *in_left_p, char **out_pp, size_t *out_left_p) {
47 size_t icnt, ocnt;
48 unsigned char *ps, *pd;
49 unsigned int scan_stat;
50 unsigned int lb_ptr, lb_cnt;
51 for (;
53 ) {
54 switch (scan_stat) {
55 case 0: {
56 if (*ps == '=') {
57 scan_stat = 1;
59 else {
60 if (ocnt < 1) {
61 goto out;
63 *(pd++) = *ps;
64 ocnt--;
67 break;
68 case 1: {
69 if (*ps == ' ' || *ps == '\t') {
71 else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') {
72 lb_cnt++;
73 scan_stat = 5;
74 break;
76 else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') {
77 scan_stat = 0;
78 break;
81 case 2: {
82 if (icnt <= 0) {
83 goto out;
86 case 3: {
88 case 4: {
89 ps++, icnt--;
93 out: *in_pp = (const char *)ps;
95 static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent) {
96 inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert;
98 typedef struct _php_convert_filter {
99 php_conv *cd;
101 php_convert_filter;
102 static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent) {
103 php_conv *retval = ((void *)0);
104 switch (conv_mode) {
105 case 4: {
106 char *lbchars = ((void *)0);
107 size_t lbchars_len;
108 if (lbchars != ((void *)0)) {
109 if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) {
115 static int php_convert_filter_ctor(php_convert_filter *inst, int conv_mode, HashTable *conv_opts, const char *filtername, int persistent) {
116 if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == ((void *)0)) {
119 static php_stream_filter_status_t strfilter_convert_filter( php_stream *stream, php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, size_t *bytes_consumed, int flags ) {
121 static void strfilter_convert_dtor(php_stream_filter *thisfilter ) {
123 static php_stream_filter_ops strfilter_convert_ops = {
124 strfilter_convert_filter, strfilter_convert_dtor, "convert.*" };
125 static php_stream_filter *strfilter_convert_create(const char *filtername, zval *filterparams, int persistent ) {
126 php_convert_filter *inst;
127 int conv_mode = 0;
128 if (php_convert_filter_ctor(inst, conv_mode, (filterparams != ((void *)0) ? (*filterparams).value.ht : ((void *)0)), filtername, persistent) != 0) {
131 static php_stream_filter_factory strfilter_convert_factory = {
132 strfilter_convert_create };
133 static const struct {
134 php_stream_filter_ops *ops;
135 php_stream_filter_factory *factory;
137 standard_filters[] = {
139 &strfilter_convert_ops, &strfilter_convert_factory }
141 int zm_startup_standard_filters(int type, int module_number ) {
142 int i;
143 for (i = 0;
144 standard_filters[i].ops;
145 i++) {