Lines Matching refs:inst
208 static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_…
209 static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst);
230 static php_conv_err_t php_conv_base64_encode_ctor(php_conv_base64_encode *inst, unsigned int line_l… in php_conv_base64_encode_ctor() argument
232 inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_encode_convert; in php_conv_base64_encode_ctor()
233 inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_encode_dtor; in php_conv_base64_encode_ctor()
234 inst->erem_len = 0; in php_conv_base64_encode_ctor()
235 inst->line_ccnt = line_len; in php_conv_base64_encode_ctor()
236 inst->line_len = line_len; in php_conv_base64_encode_ctor()
238 inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); in php_conv_base64_encode_ctor()
239 inst->lbchars_len = lbchars_len; in php_conv_base64_encode_ctor()
241 inst->lbchars = NULL; in php_conv_base64_encode_ctor()
243 inst->lbchars_dup = lbchars_dup; in php_conv_base64_encode_ctor()
244 inst->persistent = persistent; in php_conv_base64_encode_ctor()
248 static void php_conv_base64_encode_dtor(php_conv_base64_encode *inst) in php_conv_base64_encode_dtor() argument
250 assert(inst != NULL); in php_conv_base64_encode_dtor()
251 if (inst->lbchars_dup && inst->lbchars != NULL) { in php_conv_base64_encode_dtor()
252 pefree((void *)inst->lbchars, inst->persistent); in php_conv_base64_encode_dtor()
256 static php_conv_err_t php_conv_base64_encode_flush(php_conv_base64_encode *inst, const char **in_pp… in php_conv_base64_encode_flush() argument
265 line_ccnt = inst->line_ccnt; in php_conv_base64_encode_flush()
267 switch (inst->erem_len) { in php_conv_base64_encode_flush()
273 if (line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_base64_encode_flush()
274 if (ocnt < inst->lbchars_len) { in php_conv_base64_encode_flush()
277 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_base64_encode_flush()
278 pd += inst->lbchars_len; in php_conv_base64_encode_flush()
279 ocnt -= inst->lbchars_len; in php_conv_base64_encode_flush()
280 line_ccnt = inst->line_len; in php_conv_base64_encode_flush()
286 *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; in php_conv_base64_encode_flush()
287 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4)]; in php_conv_base64_encode_flush()
290 inst->erem_len = 0; in php_conv_base64_encode_flush()
296 if (line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_base64_encode_flush()
297 if (ocnt < inst->lbchars_len) { in php_conv_base64_encode_flush()
300 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_base64_encode_flush()
301 pd += inst->lbchars_len; in php_conv_base64_encode_flush()
302 ocnt -= inst->lbchars_len; in php_conv_base64_encode_flush()
303 line_ccnt = inst->line_len; in php_conv_base64_encode_flush()
309 *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; in php_conv_base64_encode_flush()
310 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)]; in php_conv_base64_encode_flush()
311 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2)]; in php_conv_base64_encode_flush()
313 inst->erem_len = 0; in php_conv_base64_encode_flush()
326 inst->line_ccnt = line_ccnt; in php_conv_base64_encode_flush()
330 static php_conv_err_t php_conv_base64_encode_convert(php_conv_base64_encode *inst, const char **in_… in php_conv_base64_encode_convert() argument
338 return php_conv_base64_encode_flush(inst, in_pp, in_left_p, out_pp, out_left_p); in php_conv_base64_encode_convert()
345 line_ccnt = inst->line_ccnt; in php_conv_base64_encode_convert()
348 switch (inst->erem_len) { in php_conv_base64_encode_convert()
351 if (line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_base64_encode_convert()
352 if (ocnt < inst->lbchars_len) { in php_conv_base64_encode_convert()
355 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_base64_encode_convert()
356 pd += inst->lbchars_len; in php_conv_base64_encode_convert()
357 ocnt -= inst->lbchars_len; in php_conv_base64_encode_convert()
358 line_ccnt = inst->line_len; in php_conv_base64_encode_convert()
364 *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; in php_conv_base64_encode_convert()
365 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (ps[0] >> 4)]; in php_conv_base64_encode_convert()
371 inst->erem_len = 0; in php_conv_base64_encode_convert()
378 if (inst->line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_base64_encode_convert()
379 if (ocnt < inst->lbchars_len) { in php_conv_base64_encode_convert()
382 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_base64_encode_convert()
383 pd += inst->lbchars_len; in php_conv_base64_encode_convert()
384 ocnt -= inst->lbchars_len; in php_conv_base64_encode_convert()
385 line_ccnt = inst->line_len; in php_conv_base64_encode_convert()
391 *(pd++) = b64_tbl_enc[(inst->erem[0] >> 2)]; in php_conv_base64_encode_convert()
392 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[0] << 4) | (inst->erem[1] >> 4)]; in php_conv_base64_encode_convert()
393 *(pd++) = b64_tbl_enc[(unsigned char)(inst->erem[1] << 2) | (ps[0] >> 6)]; in php_conv_base64_encode_convert()
398 inst->erem_len = 0; in php_conv_base64_encode_convert()
405 if (line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_base64_encode_convert()
406 if (ocnt < inst->lbchars_len) { in php_conv_base64_encode_convert()
410 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_base64_encode_convert()
411 pd += inst->lbchars_len; in php_conv_base64_encode_convert()
412 ocnt -= inst->lbchars_len; in php_conv_base64_encode_convert()
413 line_ccnt = inst->line_len; in php_conv_base64_encode_convert()
430 inst->erem[inst->erem_len++] = *(ps++); in php_conv_base64_encode_convert()
438 inst->line_ccnt = line_ccnt; in php_conv_base64_encode_convert()
455 static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_…
456 static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst);
477 static int php_conv_base64_decode_ctor(php_conv_base64_decode *inst) in php_conv_base64_decode_ctor() argument
479 inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_decode_convert; in php_conv_base64_decode_ctor()
480 inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_decode_dtor; in php_conv_base64_decode_ctor()
482 inst->urem = 0; in php_conv_base64_decode_ctor()
483 inst->urem_nbits = 0; in php_conv_base64_decode_ctor()
484 inst->ustat = 0; in php_conv_base64_decode_ctor()
485 inst->eos = 0; in php_conv_base64_decode_ctor()
489 static void php_conv_base64_decode_dtor(php_conv_base64_decode *inst) in php_conv_base64_decode_dtor() argument
495 static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *inst, const char **in_… in php_conv_base64_decode_convert() argument
508 if (inst->eos || inst->urem_nbits == 0) { in php_conv_base64_decode_convert()
521 urem = inst->urem; in php_conv_base64_decode_convert()
522 urem_nbits = inst->urem_nbits; in php_conv_base64_decode_convert()
523 ustat = inst->ustat; in php_conv_base64_decode_convert()
570 inst->eos = 1; in php_conv_base64_decode_convert()
593 inst->urem = urem; in php_conv_base64_decode_convert()
594 inst->urem_nbits = urem_nbits; in php_conv_base64_decode_convert()
595 inst->ustat = ustat; in php_conv_base64_decode_convert()
625 static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst);
626 static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_…
628 static void php_conv_qprint_encode_dtor(php_conv_qprint_encode *inst) in php_conv_qprint_encode_dtor() argument
630 assert(inst != NULL); in php_conv_qprint_encode_dtor()
631 if (inst->lbchars_dup && inst->lbchars != NULL) { in php_conv_qprint_encode_dtor()
632 pefree((void *)inst->lbchars, inst->persistent); in php_conv_qprint_encode_dtor()
648 static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *inst, const char **in_… in php_conv_qprint_encode_convert() argument
661 line_ccnt = inst->line_ccnt; in php_conv_qprint_encode_convert()
662 opts = inst->opts; in php_conv_qprint_encode_convert()
663 lb_ptr = inst->lb_ptr; in php_conv_qprint_encode_convert()
664 lb_cnt = inst->lb_cnt; in php_conv_qprint_encode_convert()
677 if (!(opts & PHP_CONV_QPRINT_OPT_BINARY) && inst->lbchars != NULL && inst->lbchars_len > 0) { in php_conv_qprint_encode_convert()
681 if (icnt > 0 && *ps == inst->lbchars[lb_cnt]) { in php_conv_qprint_encode_convert()
684 if (lb_cnt >= inst->lbchars_len) { in php_conv_qprint_encode_convert()
694 *(pd++) = inst->lbchars[i]; in php_conv_qprint_encode_convert()
697 line_ccnt = inst->line_len; in php_conv_qprint_encode_convert()
709 c = NEXT_CHAR(ps, icnt, lb_ptr, lb_cnt, inst->lbchars); in php_conv_qprint_encode_convert()
714 if (line_ccnt < 2 && inst->lbchars != NULL) { in php_conv_qprint_encode_convert()
715 if (ocnt < inst->lbchars_len + 1) { in php_conv_qprint_encode_convert()
724 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_qprint_encode_convert()
725 pd += inst->lbchars_len; in php_conv_qprint_encode_convert()
726 ocnt -= inst->lbchars_len; in php_conv_qprint_encode_convert()
727 line_ccnt = inst->line_len; in php_conv_qprint_encode_convert()
735 if (inst->lbchars != NULL) { in php_conv_qprint_encode_convert()
745 if (*ps2 == inst->lbchars[lb_cnt2]) { in php_conv_qprint_encode_convert()
747 if (lb_cnt2 >= inst->lbchars_len) { in php_conv_qprint_encode_convert()
771 …} else if ((!(opts & PHP_CONV_QPRINT_OPT_FORCE_ENCODE_FIRST) || line_ccnt < inst->line_len) && ((c… in php_conv_qprint_encode_convert()
772 if (line_ccnt < 2 && inst->lbchars != NULL) { in php_conv_qprint_encode_convert()
773 if (ocnt < inst->lbchars_len + 1) { in php_conv_qprint_encode_convert()
781 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_qprint_encode_convert()
782 pd += inst->lbchars_len; in php_conv_qprint_encode_convert()
783 ocnt -= inst->lbchars_len; in php_conv_qprint_encode_convert()
784 line_ccnt = inst->line_len; in php_conv_qprint_encode_convert()
795 if (line_ccnt < 4 && inst->lbchars != NULL) { in php_conv_qprint_encode_convert()
796 if (ocnt < inst->lbchars_len + 1) { in php_conv_qprint_encode_convert()
804 memcpy(pd, inst->lbchars, inst->lbchars_len); in php_conv_qprint_encode_convert()
805 pd += inst->lbchars_len; in php_conv_qprint_encode_convert()
806 ocnt -= inst->lbchars_len; in php_conv_qprint_encode_convert()
807 line_ccnt = inst->line_len; in php_conv_qprint_encode_convert()
829 inst->line_ccnt = line_ccnt; in php_conv_qprint_encode_convert()
830 inst->lb_ptr = lb_ptr; in php_conv_qprint_encode_convert()
831 inst->lb_cnt = lb_cnt; in php_conv_qprint_encode_convert()
837 static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst, unsigned int line_l… in php_conv_qprint_encode_ctor() argument
842 inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_encode_convert; in php_conv_qprint_encode_ctor()
843 inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_encode_dtor; in php_conv_qprint_encode_ctor()
844 inst->line_ccnt = line_len; in php_conv_qprint_encode_ctor()
845 inst->line_len = line_len; in php_conv_qprint_encode_ctor()
847 inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); in php_conv_qprint_encode_ctor()
848 inst->lbchars_len = lbchars_len; in php_conv_qprint_encode_ctor()
850 inst->lbchars = NULL; in php_conv_qprint_encode_ctor()
852 inst->lbchars_dup = lbchars_dup; in php_conv_qprint_encode_ctor()
853 inst->persistent = persistent; in php_conv_qprint_encode_ctor()
854 inst->opts = opts; in php_conv_qprint_encode_ctor()
855 inst->lb_cnt = inst->lb_ptr = 0; in php_conv_qprint_encode_ctor()
874 static void php_conv_qprint_decode_dtor(php_conv_qprint_decode *inst) in php_conv_qprint_decode_dtor() argument
876 assert(inst != NULL); in php_conv_qprint_decode_dtor()
877 if (inst->lbchars_dup && inst->lbchars != NULL) { in php_conv_qprint_decode_dtor()
878 pefree((void *)inst->lbchars, inst->persistent); in php_conv_qprint_decode_dtor()
882 static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *inst, const char **in_… in php_conv_qprint_decode_convert() argument
891 lb_ptr = inst->lb_ptr; in php_conv_qprint_decode_convert()
892 lb_cnt = inst->lb_cnt; in php_conv_qprint_decode_convert()
895 if (inst->scan_stat != 0) { in php_conv_qprint_decode_convert()
905 scan_stat = inst->scan_stat; in php_conv_qprint_decode_convert()
906 next_char = inst->next_char; in php_conv_qprint_decode_convert()
935 } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') { in php_conv_qprint_decode_convert()
941 } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') { in php_conv_qprint_decode_convert()
947 } else if (lb_cnt < inst->lbchars_len && in php_conv_qprint_decode_convert()
948 *ps == (unsigned char)inst->lbchars[lb_cnt]) { in php_conv_qprint_decode_convert()
987 if (lb_cnt < inst->lbchars_len && in php_conv_qprint_decode_convert()
988 *ps == (unsigned char)inst->lbchars[lb_cnt]) { in php_conv_qprint_decode_convert()
999 if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') { in php_conv_qprint_decode_convert()
1004 } else if (!inst->lbchars && lb_cnt > 0) { in php_conv_qprint_decode_convert()
1008 } else if (lb_cnt >= inst->lbchars_len) { in php_conv_qprint_decode_convert()
1013 if (*ps == (unsigned char)inst->lbchars[lb_cnt]) { in php_conv_qprint_decode_convert()
1030 *(pd++) = inst->lbchars[lb_ptr++]; in php_conv_qprint_decode_convert()
1044 inst->scan_stat = scan_stat; in php_conv_qprint_decode_convert()
1045 inst->lb_ptr = lb_ptr; in php_conv_qprint_decode_convert()
1046 inst->lb_cnt = lb_cnt; in php_conv_qprint_decode_convert()
1047 inst->next_char = next_char; in php_conv_qprint_decode_convert()
1051 static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars… in php_conv_qprint_decode_ctor() argument
1053 inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert; in php_conv_qprint_decode_ctor()
1054 inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_decode_dtor; in php_conv_qprint_decode_ctor()
1055 inst->scan_stat = 0; in php_conv_qprint_decode_ctor()
1056 inst->next_char = 0; in php_conv_qprint_decode_ctor()
1057 inst->lb_ptr = inst->lb_cnt = 0; in php_conv_qprint_decode_ctor()
1059 inst->lbchars = (lbchars_dup ? pestrdup(lbchars, persistent) : lbchars); in php_conv_qprint_decode_ctor()
1060 inst->lbchars_len = lbchars_len; in php_conv_qprint_decode_ctor()
1062 inst->lbchars = NULL; in php_conv_qprint_decode_ctor()
1063 inst->lbchars_len = 0; in php_conv_qprint_decode_ctor()
1065 inst->lbchars_dup = lbchars_dup; in php_conv_qprint_decode_ctor()
1066 inst->persistent = persistent; in php_conv_qprint_decode_ctor()
1295 static int php_convert_filter_ctor(php_convert_filter *inst, in php_convert_filter_ctor() argument
1299 inst->persistent = persistent; in php_convert_filter_ctor()
1300 inst->filtername = pestrdup(filtername, persistent); in php_convert_filter_ctor()
1301 inst->stub_len = 0; in php_convert_filter_ctor()
1303 if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == NULL) { in php_convert_filter_ctor()
1310 if (inst->cd != NULL) { in php_convert_filter_ctor()
1311 php_conv_dtor(inst->cd); in php_convert_filter_ctor()
1312 pefree(inst->cd, persistent); in php_convert_filter_ctor()
1314 if (inst->filtername != NULL) { in php_convert_filter_ctor()
1315 pefree(inst->filtername, persistent); in php_convert_filter_ctor()
1320 static void php_convert_filter_dtor(php_convert_filter *inst) in php_convert_filter_dtor() argument
1322 if (inst->cd != NULL) { in php_convert_filter_dtor()
1323 php_conv_dtor(inst->cd); in php_convert_filter_dtor()
1324 pefree(inst->cd, inst->persistent); in php_convert_filter_dtor()
1327 if (inst->filtername != NULL) { in php_convert_filter_dtor()
1328 pefree(inst->filtername, inst->persistent); in php_convert_filter_dtor()
1334 php_convert_filter *inst, in strfilter_convert_append_bucket() argument
1362 if (inst->stub_len > 0) { in strfilter_convert_append_bucket()
1363 pt = inst->stub; in strfilter_convert_append_bucket()
1364 tcnt = inst->stub_len; in strfilter_convert_append_bucket()
1367 err = php_conv_convert(inst->cd, &pt, &tcnt, &pd, &ocnt); in strfilter_convert_append_bucket()
1371 … php_error_docref(NULL, E_WARNING, "Stream filter (%s): invalid byte sequence", inst->filtername); in strfilter_convert_append_bucket()
1377 if (inst->stub_len >= sizeof(inst->stub)) { in strfilter_convert_append_bucket()
1378 … php_error_docref(NULL, E_WARNING, "Stream filter (%s): insufficient buffer", inst->filtername); in strfilter_convert_append_bucket()
1381 inst->stub[inst->stub_len++] = *(ps++); in strfilter_convert_append_bucket()
1383 pt = inst->stub; in strfilter_convert_append_bucket()
1384 tcnt = inst->stub_len; in strfilter_convert_append_bucket()
1393 …php_error_docref(NULL, E_WARNING, "Stream filter (%s): unexpected end of stream", inst->filtername… in strfilter_convert_append_bucket()
1423 php_error_docref(NULL, E_WARNING, "Stream filter (%s): unknown error", inst->filtername); in strfilter_convert_append_bucket()
1430 memmove(inst->stub, pt, tcnt); in strfilter_convert_append_bucket()
1431 inst->stub_len = tcnt; in strfilter_convert_append_bucket()
1435 err = ((ps == NULL ? php_conv_convert(inst->cd, NULL, NULL, &pd, &ocnt): in strfilter_convert_append_bucket()
1436 php_conv_convert(inst->cd, &ps, &icnt, &pd, &ocnt))); in strfilter_convert_append_bucket()
1439 … php_error_docref(NULL, E_WARNING, "Stream filter (%s): invalid byte sequence", inst->filtername); in strfilter_convert_append_bucket()
1444 if (icnt > sizeof(inst->stub)) { in strfilter_convert_append_bucket()
1445 … php_error_docref(NULL, E_WARNING, "Stream filter (%s): insufficient buffer", inst->filtername); in strfilter_convert_append_bucket()
1448 memcpy(inst->stub, ps, icnt); in strfilter_convert_append_bucket()
1449 inst->stub_len = icnt; in strfilter_convert_append_bucket()
1453 …php_error_docref(NULL, E_WARNING, "Stream filter (%s): unexpected octet values", inst->filtername); in strfilter_convert_append_bucket()
1485 php_error_docref(NULL, E_WARNING, "Stream filter (%s): unknown error", inst->filtername); in strfilter_convert_append_bucket()
1525 php_convert_filter *inst = (php_convert_filter *)Z_PTR(thisfilter->abstract); in strfilter_convert_filter() local
1532 if (strfilter_convert_append_bucket(inst, stream, thisfilter, in strfilter_convert_filter()
1542 if (strfilter_convert_append_bucket(inst, stream, thisfilter, in strfilter_convert_filter()
1578 php_convert_filter *inst; in strfilter_convert_create() local
1594 inst = pemalloc(sizeof(php_convert_filter), persistent); in strfilter_convert_create()
1606 if (php_convert_filter_ctor(inst, conv_mode, in strfilter_convert_create()
1612 retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, persistent); in strfilter_convert_create()
1615 pefree(inst, persistent); in strfilter_convert_create()