Skip to content

Commit

Permalink
change default compressarraysize to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 28, 2019
1 parent 3322f6f commit c166aa7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 0 additions & 4 deletions loadubjson.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
% the "name" tag is treated as a string. To load
% these UBJSON data, you need to manually set this
% flag to 1.
% opt.Compression 'zlib' or 'gzip': specify array compression
% method; currently only support 'gzip' or 'zlib'.
% opt.CompressArraySize [0|int]: only compress arrays with a total
% element count larger than this number.
%
% output:
% dat: a cell array, where {...} blocks are converted into cell arrays,
Expand Down
4 changes: 2 additions & 2 deletions savejson.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
% opt.Compact [0|1]: 1- out compact JSON format (remove all newlines and tabs)
% opt.Compression 'zlib' or 'gzip': specify array compression
% method; currently only support 'gzip' or 'zlib'.
% opt.CompressArraySize [0|int]: only compress arrays with a total
% opt.CompressArraySize [100|int]: only compress arrays with a total
% element count larger than this number.
% opt can be replaced by a list of ('param',value) pairs. The param
% string is equivallent to a field in opt and is case sensitive.
Expand Down Expand Up @@ -389,7 +389,7 @@
sep=ws.sep;

dozip=jsonopt('Compression','',varargin{:});
zipsize=jsonopt('CompressArraySize',0,varargin{:});
zipsize=jsonopt('CompressArraySize',100,varargin{:});

if(length(size(item))>2 || issparse(item) || ~isreal(item) || ...
(isempty(item) && any(size(item))) ||jsonopt('ArrayToStruct',0,varargin{:}) || (~isempty(dozip) && numel(item)>zipsize))
Expand Down
6 changes: 5 additions & 1 deletion saveubjson.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
% wrapped inside a function call as 'foo(...);'
% opt.UnpackHex [1|0]: conver the 0x[hex code] output by loadjson
% back to the string form
% opt.Compression 'zlib' or 'gzip': specify array compression
% method; currently only support 'gzip' or 'zlib'.
% opt.CompressArraySize [100|int]: only compress arrays with a total
% element count larger than this number.
%
% opt can be replaced by a list of ('param',value) pairs. The param
% string is equivallent to a field in opt and is case sensitive.
Expand Down Expand Up @@ -294,7 +298,7 @@
end

dozip=jsonopt('Compression','',varargin{:});
zipsize=jsonopt('CompressArraySize',0,varargin{:});
zipsize=jsonopt('CompressArraySize',100,varargin{:});

if(length(size(item))>2 || issparse(item) || ~isreal(item) || ...
(isempty(item) && any(size(item))) ||jsonopt('ArrayToStruct',0,varargin{:}) || (~isempty(dozip) && numel(item)>zipsize))
Expand Down

0 comments on commit c166aa7

Please sign in to comment.