From 2a72b3a8b7af57bcbb130261b0ed54fa901920fa Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 20 Jan 2022 12:32:45 +0100 Subject: [PATCH] fix reader/writer options according to docs --- ion.c | 55 +++++---------------- ion.stub.php | 1 - ion_arginfo.h | 96 ++++++++++++------------------------- ion_private.h | 4 +- tests/Reader/Options.phpt | 56 +++++----------------- tests/Serializer/PHP.phpt | 8 +--- tests/Unserializer/PHP.phpt | 14 ++---- tests/Writer/Options.phpt | 34 ++----------- 8 files changed, 67 insertions(+), 201 deletions(-) diff --git a/ion.c b/ion.c index f101f4c..d2675f0 100644 --- a/ion.c +++ b/ion.c @@ -597,12 +597,11 @@ static ZEND_METHOD(ion_Reader_Options, __construct) { php_ion_reader_options *opt = php_ion_obj(reader_options, Z_OBJ_P(ZEND_THIS)); zend_bool ret_sys_val = false, skip_validation = false; - zend_long ch_nl = 0xa, max_depth = 10, max_ann = 10, max_ann_buf = 512, - sym_thr = 0x4000, uval_thr = 0x4000, chunk_thr = 0x4000, alloc_pgsz = 0x10000; + zend_long max_depth = 10, max_ann = 10, ann_buf_siz = 0x4000, tmp_buf_siz = 0x4000; PTR_CHECK(opt); - ZEND_PARSE_PARAMETERS_START(0, 13) + ZEND_PARSE_PARAMETERS_START(0, 9) Z_PARAM_OPTIONAL // public readonly ?\ion\Catalog $catalog = null, Z_PARAM_OBJ_OF_CLASS_OR_NULL(opt->cat, ce_Catalog) @@ -612,22 +611,14 @@ static ZEND_METHOD(ion_Reader_Options, __construct) Z_PARAM_OBJ_OF_CLASS_OR_NULL(opt->cb, zend_ce_closure); // public readonly bool $returnSystemValues = false, Z_PARAM_BOOL(ret_sys_val) - // public readonly int $newLine = 0xa, - Z_PARAM_LONG(ch_nl) // public readonly int $maxContainerDepth = 10, Z_PARAM_LONG(max_depth) // public readonly int $maxAnnotations = 10, Z_PARAM_LONG(max_ann) - // public readonly int $maxAnnotationBuffered = 512, - Z_PARAM_LONG(max_ann_buf) - // public readonly int $symbolThreshold = 0x4000, - Z_PARAM_LONG(sym_thr) - // public readonly int $userValueThreshold = 0x4000, - Z_PARAM_LONG(uval_thr) - // public readonly int $chunkThreshold = 0x4000, - Z_PARAM_LONG(chunk_thr) - // public readonly int $allocationPageSize = 0x10000, - Z_PARAM_LONG(alloc_pgsz) + // public readonly int $annotationBufferSize = 0x4000, + Z_PARAM_LONG(ann_buf_siz) + // public readonly int $tempBufferSize = 0x4000, + Z_PARAM_LONG(tmp_buf_siz) // public readonly bool $skipCharacterValidation = false, Z_PARAM_BOOL(skip_validation) ZEND_PARSE_PARAMETERS_END(); @@ -655,22 +646,14 @@ static ZEND_METHOD(ion_Reader_Options, __construct) } zend_update_property_bool(opt->std.ce, &opt->std, ZEND_STRL("returnSystemValues"), opt->opt.return_system_values = ret_sys_val); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("newLine"), - opt->opt.new_line_char = (int) ch_nl); zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("maxContainerDepth"), opt->opt.max_container_depth = (SIZE) max_depth); zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("maxAnnotations"), opt->opt.max_annotation_count = (SIZE) max_ann); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("maxAnnotationBuffered"), - opt->opt.max_annotation_buffered = (SIZE) max_ann_buf); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("symbolThreshold"), - opt->opt.symbol_threshold = (SIZE) sym_thr); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("userValueThreshold"), - opt->opt.user_value_threshold = (SIZE) uval_thr); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("chunkThreshold"), - opt->opt.chunk_threshold = (SIZE) chunk_thr); - zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("allocationPageSize"), - opt->opt.allocation_page_size = (SIZE) alloc_pgsz); + zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("annotationBufferSize"), + opt->opt.max_annotation_buffered = (SIZE) ann_buf_siz); + zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("tempBufferSize"), + opt->opt.chunk_threshold = opt->opt.user_value_threshold = opt->opt.symbol_threshold = (SIZE) tmp_buf_siz); zend_update_property_long(opt->std.ce, &opt->std, ZEND_STRL("skipCharacterValidation"), opt->opt.skip_character_validation = (SIZE) skip_validation); } @@ -1223,9 +1206,9 @@ static ZEND_METHOD(ion_Writer_Options, __construct) PTR_CHECK(obj); zend_bool binary = false, compact_floats = false, escape = false, pretty = false, - tabs = true, small_cntr_inl = true, suppress_sys = false, flush = false; - zend_long indent = 2, max_depth = 10, max_ann = 10, temp = 0x4000, alloc = 0x10000; - ZEND_PARSE_PARAMETERS_START(0, 15) + tabs = true, flush = false; + zend_long indent = 2, max_depth = 10, max_ann = 10, temp = 0x4000; + ZEND_PARSE_PARAMETERS_START(0, 12) Z_PARAM_OPTIONAL //public readonly ?\ion\Catalog $catalog = null, Z_PARAM_OBJ_OF_CLASS_OR_NULL(obj->cat, ce_Catalog) @@ -1243,10 +1226,6 @@ static ZEND_METHOD(ion_Writer_Options, __construct) Z_PARAM_BOOL(tabs) //public readonly int $indentSize = 2, Z_PARAM_LONG(indent) - //public readonly bool $smallContainersInline = true, - Z_PARAM_BOOL(small_cntr_inl) - //public readonly bool $suppressSystemValues = false, - Z_PARAM_BOOL(suppress_sys) //public readonly bool $flushEveryValue = false, Z_PARAM_BOOL(flush) //public readonly int $maxContainerDepth = 10, @@ -1255,8 +1234,6 @@ static ZEND_METHOD(ion_Writer_Options, __construct) Z_PARAM_LONG(max_ann) //public readonly int $tempBufferSize = 0x4000, Z_PARAM_LONG(temp) - //public readonly int $allocationPageSize = 0x10000, - Z_PARAM_LONG(alloc) ZEND_PARSE_PARAMETERS_END(); if (obj->cat) { @@ -1283,10 +1260,6 @@ static ZEND_METHOD(ion_Writer_Options, __construct) obj->opt.indent_with_tabs = tabs); zend_update_property_long(obj->std.ce, &obj->std, ZEND_STRL("indentSize"), obj->opt.indent_size = (SIZE) indent); - zend_update_property_bool(obj->std.ce, &obj->std, ZEND_STRL("smallContainersInline"), - obj->opt.small_containers_in_line = small_cntr_inl); - zend_update_property_bool(obj->std.ce, &obj->std, ZEND_STRL("suppressSystemValues"), - obj->opt.supress_system_values = suppress_sys); zend_update_property_bool(obj->std.ce, &obj->std, ZEND_STRL("flushEveryValue"), obj->opt.flush_every_value = flush); zend_update_property_long(obj->std.ce, &obj->std, ZEND_STRL("maxContainerDepth"), @@ -1295,8 +1268,6 @@ static ZEND_METHOD(ion_Writer_Options, __construct) obj->opt.max_annotation_count = (SIZE) max_ann); zend_update_property_long(obj->std.ce, &obj->std, ZEND_STRL("tempBufferSize"), obj->opt.temp_buffer_size = (SIZE) temp); - zend_update_property_long(obj->std.ce, &obj->std, ZEND_STRL("allocationPageSize"), - obj->opt.allocation_page_size = (SIZE) alloc); } static ZEND_METHOD(ion_Writer_Writer, writeNull) { diff --git a/ion.stub.php b/ion.stub.php index 6fc9a4b..15b60d3 100644 --- a/ion.stub.php +++ b/ion.stub.php @@ -152,7 +152,6 @@ class Catalog implements \Countable { * Add a shared symbol table to the catalog. * * @param Symbol\Table $table The new table to add. - * @return void */ public function add(Symbol\Table $table) : void {} diff --git a/ion_arginfo.h b/ion_arginfo.h index d347a57..900715d 100644 --- a/ion_arginfo.h +++ b/ion_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fd212a098afd1b87f56162838ed409653a9c7a69 */ + * Stub hash: 6dcf67bb6d8b532d66b378544582f68e2508b7b2 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ion_serialize, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, data, IS_MIXED, 0) @@ -317,14 +317,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ion_Reader_Options___construct, 0, 0, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, decimalContext, ion\\Decimal\\Context, 1, "null") ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, onContextChange, Closure, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, returnSystemValues, _IS_BOOL, 0, "false") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, newLine, IS_LONG, 0, "0xa") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxContainerDepth, IS_LONG, 0, "10") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotations, IS_LONG, 0, "10") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotationBuffered, IS_LONG, 0, "512") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, symbolThreshold, IS_LONG, 0, "0x4000") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, userValueThreshold, IS_LONG, 0, "0x4000") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, chunkThreshold, IS_LONG, 0, "0x4000") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "0x10000") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, annotationBufferSize, IS_LONG, 0, "0x4000") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tempBufferSize, IS_LONG, 0, "0x4000") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, skipCharacterValidation, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -440,13 +436,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ion_Writer_Options___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prettyPrint, _IS_BOOL, 0, "false") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, indentTabs, _IS_BOOL, 0, "true") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, indentSize, IS_LONG, 0, "2") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, smallContainersInline, _IS_BOOL, 0, "true") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, suppressSystemValues, _IS_BOOL, 0, "false") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flushEveryValue, _IS_BOOL, 0, "false") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxContainerDepth, IS_LONG, 0, "10") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxAnnotations, IS_LONG, 0, "10") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tempBufferSize, IS_LONG, 0, "0x4000") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allocationPageSize, IS_LONG, 0, "0x10000") ZEND_END_ARG_INFO() #define arginfo_class_ion_Writer_Writer_writeNull arginfo_class_ion_Writer_writeNull @@ -657,6 +650,11 @@ static const zend_function_entry class_ion_Unserializer_methods[] = { }; +static const zend_function_entry class_ion_Exception_methods[] = { + ZEND_FE_END +}; + + static const zend_function_entry class_ion_Type_methods[] = { ZEND_FE_END }; @@ -1019,6 +1017,16 @@ static zend_class_entry *register_class_ion_Unserializer(void) return class_entry; } +static zend_class_entry *register_class_ion_Exception(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "ion", "Exception", class_ion_Exception_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + static zend_class_entry *register_class_ion_Type(void) { zend_class_entry *class_entry = zend_register_internal_enum("ion\\Type", IS_LONG, class_ion_Type_methods); @@ -1119,13 +1127,13 @@ static zend_class_entry *register_class_ion_Symbol(void) return class_entry; } -static zend_class_entry *register_class_ion_Catalog(zend_class_entry *class_entry_ion_Countable) +static zend_class_entry *register_class_ion_Catalog(zend_class_entry *class_entry_Countable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "ion", "Catalog", class_ion_Catalog_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); - zend_class_implements(class_entry, 1, class_entry_ion_Countable); + zend_class_implements(class_entry, 1, class_entry_Countable); zval property_symbolTables_default_value; ZVAL_EMPTY_ARRAY(&property_symbolTables_default_value); @@ -1639,12 +1647,6 @@ static zend_class_entry *register_class_ion_Reader_Options(void) zend_declare_typed_property(class_entry, property_returnSystemValues_name, &property_returnSystemValues_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL)); zend_string_release(property_returnSystemValues_name); - zval property_newLine_default_value; - ZVAL_UNDEF(&property_newLine_default_value); - zend_string *property_newLine_name = zend_string_init("newLine", sizeof("newLine") - 1, 1); - zend_declare_typed_property(class_entry, property_newLine_name, &property_newLine_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_newLine_name); - zval property_maxContainerDepth_default_value; ZVAL_UNDEF(&property_maxContainerDepth_default_value); zend_string *property_maxContainerDepth_name = zend_string_init("maxContainerDepth", sizeof("maxContainerDepth") - 1, 1); @@ -1657,35 +1659,17 @@ static zend_class_entry *register_class_ion_Reader_Options(void) zend_declare_typed_property(class_entry, property_maxAnnotations_name, &property_maxAnnotations_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(property_maxAnnotations_name); - zval property_maxAnnotationBuffered_default_value; - ZVAL_UNDEF(&property_maxAnnotationBuffered_default_value); - zend_string *property_maxAnnotationBuffered_name = zend_string_init("maxAnnotationBuffered", sizeof("maxAnnotationBuffered") - 1, 1); - zend_declare_typed_property(class_entry, property_maxAnnotationBuffered_name, &property_maxAnnotationBuffered_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_maxAnnotationBuffered_name); - - zval property_symbolThreshold_default_value; - ZVAL_UNDEF(&property_symbolThreshold_default_value); - zend_string *property_symbolThreshold_name = zend_string_init("symbolThreshold", sizeof("symbolThreshold") - 1, 1); - zend_declare_typed_property(class_entry, property_symbolThreshold_name, &property_symbolThreshold_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_symbolThreshold_name); - - zval property_userValueThreshold_default_value; - ZVAL_UNDEF(&property_userValueThreshold_default_value); - zend_string *property_userValueThreshold_name = zend_string_init("userValueThreshold", sizeof("userValueThreshold") - 1, 1); - zend_declare_typed_property(class_entry, property_userValueThreshold_name, &property_userValueThreshold_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_userValueThreshold_name); - - zval property_chunkThreshold_default_value; - ZVAL_UNDEF(&property_chunkThreshold_default_value); - zend_string *property_chunkThreshold_name = zend_string_init("chunkThreshold", sizeof("chunkThreshold") - 1, 1); - zend_declare_typed_property(class_entry, property_chunkThreshold_name, &property_chunkThreshold_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_chunkThreshold_name); - - zval property_allocationPageSize_default_value; - ZVAL_UNDEF(&property_allocationPageSize_default_value); - zend_string *property_allocationPageSize_name = zend_string_init("allocationPageSize", sizeof("allocationPageSize") - 1, 1); - zend_declare_typed_property(class_entry, property_allocationPageSize_name, &property_allocationPageSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_allocationPageSize_name); + zval property_annotationBufferSize_default_value; + ZVAL_UNDEF(&property_annotationBufferSize_default_value); + zend_string *property_annotationBufferSize_name = zend_string_init("annotationBufferSize", sizeof("annotationBufferSize") - 1, 1); + zend_declare_typed_property(class_entry, property_annotationBufferSize_name, &property_annotationBufferSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_string_release(property_annotationBufferSize_name); + + zval property_tempBufferSize_default_value; + ZVAL_UNDEF(&property_tempBufferSize_default_value); + zend_string *property_tempBufferSize_name = zend_string_init("tempBufferSize", sizeof("tempBufferSize") - 1, 1); + zend_declare_typed_property(class_entry, property_tempBufferSize_name, &property_tempBufferSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_string_release(property_tempBufferSize_name); zval property_skipCharacterValidation_default_value; ZVAL_UNDEF(&property_skipCharacterValidation_default_value); @@ -1816,18 +1800,6 @@ static zend_class_entry *register_class_ion_Writer_Options(void) zend_declare_typed_property(class_entry, property_indentSize_name, &property_indentSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(property_indentSize_name); - zval property_smallContainersInline_default_value; - ZVAL_UNDEF(&property_smallContainersInline_default_value); - zend_string *property_smallContainersInline_name = zend_string_init("smallContainersInline", sizeof("smallContainersInline") - 1, 1); - zend_declare_typed_property(class_entry, property_smallContainersInline_name, &property_smallContainersInline_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL)); - zend_string_release(property_smallContainersInline_name); - - zval property_suppressSystemValues_default_value; - ZVAL_UNDEF(&property_suppressSystemValues_default_value); - zend_string *property_suppressSystemValues_name = zend_string_init("suppressSystemValues", sizeof("suppressSystemValues") - 1, 1); - zend_declare_typed_property(class_entry, property_suppressSystemValues_name, &property_suppressSystemValues_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL)); - zend_string_release(property_suppressSystemValues_name); - zval property_flushEveryValue_default_value; ZVAL_UNDEF(&property_flushEveryValue_default_value); zend_string *property_flushEveryValue_name = zend_string_init("flushEveryValue", sizeof("flushEveryValue") - 1, 1); @@ -1852,12 +1824,6 @@ static zend_class_entry *register_class_ion_Writer_Options(void) zend_declare_typed_property(class_entry, property_tempBufferSize_name, &property_tempBufferSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(property_tempBufferSize_name); - zval property_allocationPageSize_default_value; - ZVAL_UNDEF(&property_allocationPageSize_default_value); - zend_string *property_allocationPageSize_name = zend_string_init("allocationPageSize", sizeof("allocationPageSize") - 1, 1); - zend_declare_typed_property(class_entry, property_allocationPageSize_name, &property_allocationPageSize_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_allocationPageSize_name); - return class_entry; } diff --git a/ion_private.h b/ion_private.h index 722efe6..50d9921 100644 --- a/ion_private.h +++ b/ion_private.h @@ -1251,7 +1251,7 @@ LOCAL void php_ion_reader_ctor(php_ion_reader *obj) PTR_CHECK(obj->stream.ptr); GC_ADDREF(obj->stream.ptr->res); - obj->stream.buf.length = opt && opt->opt.allocation_page_size ? opt->opt.allocation_page_size : 0x10000; + obj->stream.buf.length = opt && opt->opt.chunk_threshold ? opt->opt.chunk_threshold : 0x4000; obj->stream.buf.value = emalloc(obj->stream.buf.length); err = ion_reader_open_stream(&obj->reader, obj, php_ion_reader_stream_handler, opt ? &opt->opt : NULL); @@ -1353,7 +1353,7 @@ LOCAL void php_ion_writer_stream_init(php_ion_writer *obj, php_ion_writer_option PTR_CHECK(obj->stream.ptr); GC_ADDREF(obj->stream.ptr->res); - obj->stream.buf.length = opt ? opt->opt.allocation_page_size : 0x1000; + obj->stream.buf.length = opt ? opt->opt.temp_buffer_size : 0x1000; obj->stream.buf.value = emalloc(obj->stream.buf.length); } diff --git a/tests/Reader/Options.phpt b/tests/Reader/Options.phpt index 10968da..b3d9c36 100644 --- a/tests/Reader/Options.phpt +++ b/tests/Reader/Options.phpt @@ -20,7 +20,7 @@ var_dump($o, clone $o); DONE --EXPECTF-- TEST -object(ion\Reader\Options)#%d (13) { +object(ion\Reader\Options)#%d (9) { ["catalog"]=> NULL ["decimalContext"]=> @@ -29,26 +29,18 @@ object(ion\Reader\Options)#%d (13) { NULL ["returnSystemValues"]=> bool(false) - ["newLine"]=> - int(10) ["maxContainerDepth"]=> int(10) ["maxAnnotations"]=> int(10) - ["maxAnnotationBuffered"]=> - int(512) - ["symbolThreshold"]=> - int(16384) - ["userValueThreshold"]=> + ["annotationBufferSize"]=> int(16384) - ["chunkThreshold"]=> + ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) ["skipCharacterValidation"]=> bool(false) } -object(ion\Reader\Options)#%d (13) { +object(ion\Reader\Options)#%d (9) { ["catalog"]=> NULL ["decimalContext"]=> @@ -57,26 +49,18 @@ object(ion\Reader\Options)#%d (13) { NULL ["returnSystemValues"]=> bool(false) - ["newLine"]=> - int(10) ["maxContainerDepth"]=> int(10) ["maxAnnotations"]=> int(10) - ["maxAnnotationBuffered"]=> - int(512) - ["symbolThreshold"]=> - int(16384) - ["userValueThreshold"]=> + ["annotationBufferSize"]=> int(16384) - ["chunkThreshold"]=> + ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) ["skipCharacterValidation"]=> bool(false) } -object(ion\Reader\Options)#%d (13) { +object(ion\Reader\Options)#%d (9) { ["catalog"]=> object(ion\Catalog)#%d (1) { ["symbolTables":"ion\Catalog":private]=> @@ -106,26 +90,18 @@ object(ion\Reader\Options)#%d (13) { } ["returnSystemValues"]=> bool(true) - ["newLine"]=> - int(10) ["maxContainerDepth"]=> int(10) ["maxAnnotations"]=> int(10) - ["maxAnnotationBuffered"]=> - int(512) - ["symbolThreshold"]=> - int(16384) - ["userValueThreshold"]=> + ["annotationBufferSize"]=> int(16384) - ["chunkThreshold"]=> + ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) ["skipCharacterValidation"]=> bool(true) } -object(ion\Reader\Options)#%d (13) { +object(ion\Reader\Options)#%d (9) { ["catalog"]=> object(ion\Catalog)#%d (1) { ["symbolTables":"ion\Catalog":private]=> @@ -155,22 +131,14 @@ object(ion\Reader\Options)#%d (13) { } ["returnSystemValues"]=> bool(true) - ["newLine"]=> - int(10) ["maxContainerDepth"]=> int(10) ["maxAnnotations"]=> int(10) - ["maxAnnotationBuffered"]=> - int(512) - ["symbolThreshold"]=> - int(16384) - ["userValueThreshold"]=> + ["annotationBufferSize"]=> int(16384) - ["chunkThreshold"]=> + ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) ["skipCharacterValidation"]=> bool(true) } diff --git a/tests/Serializer/PHP.phpt b/tests/Serializer/PHP.phpt index 6fad20b..cfad862 100644 --- a/tests/Serializer/PHP.phpt +++ b/tests/Serializer/PHP.phpt @@ -21,7 +21,7 @@ DONE TEST object(ion\Serializer\PHP)#%d (4) { ["writerOptions"]=> - object(ion\Writer\Options)#%d (15) { + object(ion\Writer\Options)#%d (12) { ["catalog"]=> NULL ["decimalContext"]=> @@ -38,10 +38,6 @@ object(ion\Serializer\PHP)#%d (4) { bool(true) ["indentSize"]=> int(2) - ["smallContainersInline"]=> - bool(true) - ["suppressSystemValues"]=> - bool(false) ["flushEveryValue"]=> bool(false) ["maxContainerDepth"]=> @@ -50,8 +46,6 @@ object(ion\Serializer\PHP)#%d (4) { int(10) ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) } ["multiSequence"]=> bool(false) diff --git a/tests/Unserializer/PHP.phpt b/tests/Unserializer/PHP.phpt index 3783d1d..3d7f290 100644 --- a/tests/Unserializer/PHP.phpt +++ b/tests/Unserializer/PHP.phpt @@ -21,7 +21,7 @@ DONE TEST object(ion\Unserializer\PHP)#%d (4) { ["readerOptions"]=> - object(ion\Reader\Options)#%d (13) { + object(ion\Reader\Options)#%d (9) { ["catalog"]=> NULL ["decimalContext"]=> @@ -30,22 +30,14 @@ object(ion\Unserializer\PHP)#%d (4) { NULL ["returnSystemValues"]=> bool(false) - ["newLine"]=> - int(10) ["maxContainerDepth"]=> int(10) ["maxAnnotations"]=> int(10) - ["maxAnnotationBuffered"]=> - int(512) - ["symbolThreshold"]=> - int(16384) - ["userValueThreshold"]=> + ["annotationBufferSize"]=> int(16384) - ["chunkThreshold"]=> + ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) ["skipCharacterValidation"]=> bool(false) } diff --git a/tests/Writer/Options.phpt b/tests/Writer/Options.phpt index b673ac7..8f7e0cc 100644 --- a/tests/Writer/Options.phpt +++ b/tests/Writer/Options.phpt @@ -13,14 +13,14 @@ $o = new ion\Writer\Options( decimalContext: ion\Decimal\Context::Dec64(), outputBinary: true, maxContainerDepth: 20, - allocationPageSize: 0x20000 + tempBufferSize: 0x20000 ); var_dump($o, clone $o); ?> DONE --EXPECTF-- TEST -object(ion\Writer\Options)#%d (15) { +object(ion\Writer\Options)#%d (12) { ["catalog"]=> NULL ["decimalContext"]=> @@ -37,10 +37,6 @@ object(ion\Writer\Options)#%d (15) { bool(true) ["indentSize"]=> int(2) - ["smallContainersInline"]=> - bool(true) - ["suppressSystemValues"]=> - bool(false) ["flushEveryValue"]=> bool(false) ["maxContainerDepth"]=> @@ -49,10 +45,8 @@ object(ion\Writer\Options)#%d (15) { int(10) ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) } -object(ion\Writer\Options)#%d (15) { +object(ion\Writer\Options)#%d (12) { ["catalog"]=> NULL ["decimalContext"]=> @@ -69,10 +63,6 @@ object(ion\Writer\Options)#%d (15) { bool(true) ["indentSize"]=> int(2) - ["smallContainersInline"]=> - bool(true) - ["suppressSystemValues"]=> - bool(false) ["flushEveryValue"]=> bool(false) ["maxContainerDepth"]=> @@ -81,10 +71,8 @@ object(ion\Writer\Options)#%d (15) { int(10) ["tempBufferSize"]=> int(16384) - ["allocationPageSize"]=> - int(65536) } -object(ion\Writer\Options)#%d (15) { +object(ion\Writer\Options)#%d (12) { ["catalog"]=> object(ion\Catalog)#%d (1) { ["symbolTables":"ion\Catalog":private]=> @@ -116,10 +104,6 @@ object(ion\Writer\Options)#%d (15) { bool(true) ["indentSize"]=> int(2) - ["smallContainersInline"]=> - bool(true) - ["suppressSystemValues"]=> - bool(false) ["flushEveryValue"]=> bool(false) ["maxContainerDepth"]=> @@ -127,11 +111,9 @@ object(ion\Writer\Options)#%d (15) { ["maxAnnotations"]=> int(10) ["tempBufferSize"]=> - int(16384) - ["allocationPageSize"]=> int(131072) } -object(ion\Writer\Options)#%d (15) { +object(ion\Writer\Options)#%d (12) { ["catalog"]=> object(ion\Catalog)#%d (1) { ["symbolTables":"ion\Catalog":private]=> @@ -163,10 +145,6 @@ object(ion\Writer\Options)#%d (15) { bool(true) ["indentSize"]=> int(2) - ["smallContainersInline"]=> - bool(true) - ["suppressSystemValues"]=> - bool(false) ["flushEveryValue"]=> bool(false) ["maxContainerDepth"]=> @@ -174,8 +152,6 @@ object(ion\Writer\Options)#%d (15) { ["maxAnnotations"]=> int(10) ["tempBufferSize"]=> - int(16384) - ["allocationPageSize"]=> int(131072) } DONE -- 2.30.2