Skip to content

Commit

Permalink
minor updates to make msgpack to work on octave
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Oct 15, 2019
1 parent 04d6c04 commit 23f14d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jdatadecode.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
if(iscell(data(j).(N_('_ArrayData_'))))
data(j).(N_('_ArrayData_'))=cell2mat(cellfun(@(x) double(x(:)),data(j).(N_('_ArrayData_')),'uniformoutput',0)).';
end
ndata=cast(data(j).(N_('_ArrayData_')),data(j).(N_('_ArrayType_')));
ndata=cast(data(j).(N_('_ArrayData_')),char(data(j).(N_('_ArrayType_'))));
end
iscpx=0;
if(~isempty(strmatch(N_('_ArrayIsComplex_'),fn)))
Expand Down
8 changes: 6 additions & 2 deletions loadmsgpack.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@
end

function [str, idx] = parsestring(len, bytes, idx)
str = native2unicode(bytes(idx:idx+len-1)', 'utf-8');
if(~isoctavemesh)
str = native2unicode(bytes(idx:idx+len-1)', 'utf-8');
else
str = bytes(idx:idx+len-1)';
end
idx = idx + len;
end

Expand Down Expand Up @@ -223,7 +227,7 @@
out = struct();
for n=1:len
[key, idx] = parse(bytes, idx);
[out.(valid_field(key)), idx] = parse(bytes, idx);
[out.(valid_field(char(key))), idx] = parse(bytes, idx);
end
end

Expand Down
2 changes: 1 addition & 1 deletion nestbracket2dim.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
%
% input:
% str: a string-formatted JSON array using square-brackets for enclosing
% elements and comma a separator between elements
% elements and comma as separators between elements
% brackets: (optional), a string of length 2, with the first character
% being the opening token and the 2nd being the closing token.
% if not given, brackets is set to '[]' to find matching square-brackets;
Expand Down

0 comments on commit 23f14d6

Please sign in to comment.