Skip to content

Commit 23f14d6

Browse files
committed
minor updates to make msgpack to work on octave
1 parent 04d6c04 commit 23f14d6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

jdatadecode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
if(iscell(data(j).(N_('_ArrayData_'))))
104104
data(j).(N_('_ArrayData_'))=cell2mat(cellfun(@(x) double(x(:)),data(j).(N_('_ArrayData_')),'uniformoutput',0)).';
105105
end
106-
ndata=cast(data(j).(N_('_ArrayData_')),data(j).(N_('_ArrayType_')));
106+
ndata=cast(data(j).(N_('_ArrayData_')),char(data(j).(N_('_ArrayType_'))));
107107
end
108108
iscpx=0;
109109
if(~isempty(strmatch(N_('_ArrayIsComplex_'),fn)))

loadmsgpack.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@
185185
end
186186

187187
function [str, idx] = parsestring(len, bytes, idx)
188-
str = native2unicode(bytes(idx:idx+len-1)', 'utf-8');
188+
if(~isoctavemesh)
189+
str = native2unicode(bytes(idx:idx+len-1)', 'utf-8');
190+
else
191+
str = bytes(idx:idx+len-1)';
192+
end
189193
idx = idx + len;
190194
end
191195

@@ -223,7 +227,7 @@
223227
out = struct();
224228
for n=1:len
225229
[key, idx] = parse(bytes, idx);
226-
[out.(valid_field(key)), idx] = parse(bytes, idx);
230+
[out.(valid_field(char(key))), idx] = parse(bytes, idx);
227231
end
228232
end
229233

nestbracket2dim.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
%
1111
% input:
1212
% str: a string-formatted JSON array using square-brackets for enclosing
13-
% elements and comma a separator between elements
13+
% elements and comma as separators between elements
1414
% brackets: (optional), a string of length 2, with the first character
1515
% being the opening token and the 2nd being the closing token.
1616
% if not given, brackets is set to '[]' to find matching square-brackets;

0 commit comments

Comments
 (0)