mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Changed how strings are passed between Matlab and Clib
This commit is contained in:
parent
e5a77854c2
commit
ba4d10fde9
@ -824,11 +824,13 @@ classdef ThermoPhase < handle
|
||||
%
|
||||
buflen = calllib(ct, 'thermo_getEosType', tp.tpID, 0, '');
|
||||
if buflen > 0
|
||||
aa = char(zeros(1, buflen));
|
||||
[~, aa] = calllib(ct, 'thermo_getEosType', ...
|
||||
tp.tpID, buflen, aa);
|
||||
aa = char([zeros(1, buflen, 'int8')]);
|
||||
ptr = libpointer('cstring', aa);
|
||||
[~, bb] = calllib(ct, 'thermo_getEosType', ...
|
||||
tp.tpID, buflen, ptr);
|
||||
e = bb;
|
||||
clear aa bb ptr;
|
||||
end
|
||||
e = aa;
|
||||
end
|
||||
|
||||
function v = isIdealGas(tp)
|
||||
@ -1343,9 +1345,6 @@ classdef ThermoPhase < handle
|
||||
% :param temperature:
|
||||
% Temperature. Units: K
|
||||
%
|
||||
if temperature <= 0
|
||||
error('The temperature must be positive');
|
||||
end
|
||||
calllib(ct, 'thermo_setTemperature', tp.tpID, temperature);
|
||||
end
|
||||
|
||||
|
@ -4,9 +4,11 @@ function e = geterr()
|
||||
checklib;
|
||||
try
|
||||
buflen = calllib(ct, 'ct_getCanteraError', 0, '');
|
||||
aa = char(zeros(1, buflen));
|
||||
[~, aa] = calllib(ct, 'ct_getCanteraError', buflen, aa);
|
||||
e = aa;
|
||||
aa = char([zeros(1, buflen, 'int8')]);
|
||||
ptr = libpointer('cstring', aa);
|
||||
[~, bb] = calllib(ct, 'ct_getCanteraError', buflen, ptr);
|
||||
e = bb;
|
||||
clear aa bb ptr
|
||||
catch ME
|
||||
e = getReport(ME);
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user