summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-10-23 16:07:04 +0200
committerJose <jose@zeroc.com>2019-10-23 16:16:46 +0200
commit4fe35208f8a06db7e22d3d810d50ca40f2d9d3dd (patch)
treefd3d0343628e40e7c83e9f0f30663dc6ff80c856
parentMissing return in MATLAB encaps decoder (diff)
downloadice-4fe35208f8a06db7e22d3d810d50ca40f2d9d3dd.tar.bz2
ice-4fe35208f8a06db7e22d3d810d50ca40f2d9d3dd.tar.xz
ice-4fe35208f8a06db7e22d3d810d50ca40f2d9d3dd.zip
Fix MATLAB linter warnings
-rw-r--r--matlab/lib/+Ice/Communicator.m6
-rw-r--r--matlab/lib/+Ice/Exception.m2
-rw-r--r--matlab/lib/+Ice/InputStream.m33
-rw-r--r--matlab/lib/+Ice/InterfaceByValue.m2
-rw-r--r--matlab/lib/+Ice/LocalException.m2
-rw-r--r--matlab/lib/+Ice/ObjectPrx.m12
-rw-r--r--matlab/lib/+Ice/OutputStream.m2
-rw-r--r--matlab/lib/+Ice/UnknownSlicedValue.m4
-rw-r--r--matlab/lib/+Ice/UserException.m4
-rw-r--r--matlab/lib/+Ice/Value.m10
-rw-r--r--matlab/lib/+Ice/identityToString.m2
-rw-r--r--matlab/lib/+Ice/stringToEncodingVersion.m2
-rw-r--r--matlab/lib/+Ice/stringToProtocolVersion.m2
-rw-r--r--matlab/lib/+IceInternal/ClassResolver.m4
-rw-r--r--matlab/lib/+IceInternal/EncapsDecoder.m7
-rw-r--r--matlab/lib/+IceInternal/EncapsDecoder10.m6
-rw-r--r--matlab/lib/+IceInternal/EncapsDecoder11.m6
-rw-r--r--matlab/lib/+IceInternal/EncapsEncoder.m6
-rw-r--r--matlab/lib/+IceInternal/EncapsEncoder10.m4
19 files changed, 49 insertions, 67 deletions
diff --git a/matlab/lib/+Ice/Communicator.m b/matlab/lib/+Ice/Communicator.m
index ddf553cf032..07ce6865211 100644
--- a/matlab/lib/+Ice/Communicator.m
+++ b/matlab/lib/+Ice/Communicator.m
@@ -100,7 +100,7 @@ classdef Communicator < IceInternal.WrapperObject
r = Ice.ObjectPrx(obj, obj.encoding, impl);
end
end
- function r = proxyToString(obj, proxy)
+ function r = proxyToString(~, proxy)
% proxyToString Convert a proxy into a string.
%
% Parameters:
@@ -303,7 +303,7 @@ classdef Communicator < IceInternal.WrapperObject
obj.iceCall('flushBatchRequests', mode);
end
- function f = flushBatchRequestsAsync(obj, mode)
+ function r = flushBatchRequestsAsync(obj, mode)
% flushBatchRequestsAsync Flush any pending batch requests for this
% communicator. This means all batch requests invoked on fixed
% proxies for all connections associated with the communicator.
@@ -324,7 +324,7 @@ classdef Communicator < IceInternal.WrapperObject
end
function r = getClassResolver(obj)
if isempty(obj.classResolver) % Lazy initialization.
- obj.classResolver = IceInternal.ClassResolver(obj.getProperties());
+ obj.classResolver = IceInternal.ClassResolver();
end
r = obj.classResolver;
end
diff --git a/matlab/lib/+Ice/Exception.m b/matlab/lib/+Ice/Exception.m
index f2c4d83240a..28eb49ed51b 100644
--- a/matlab/lib/+Ice/Exception.m
+++ b/matlab/lib/+Ice/Exception.m
@@ -10,7 +10,7 @@ classdef (Abstract) Exception < MException
end
methods
function obj = Exception(id, msg)
- obj = obj@MException(id, msg)
+ obj = obj@MException(id, msg);
end
end
end
diff --git a/matlab/lib/+Ice/InputStream.m b/matlab/lib/+Ice/InputStream.m
index 1079781d7e6..57b1462730c 100644
--- a/matlab/lib/+Ice/InputStream.m
+++ b/matlab/lib/+Ice/InputStream.m
@@ -282,7 +282,7 @@ classdef InputStream < handle
end
function r = readStringSeq(obj)
sz = obj.readAndCheckSeqSize(1);
- r = {};
+ r = cell(1, sz);
for i = 1:sz
r{i} = obj.readString();
end
@@ -463,20 +463,6 @@ classdef InputStream < handle
obj.pos = obj.pos + sz - 4;
end
- function r = readEncapsulation(obj)
- start = obj.pos;
- sz = obj.readInt();
- if sz < 6
- throw(Ice.EncapsulationException());
- end
-
- if obj.pos - 4 + sz > obj.size + 1
- throw(Ice.UnmarshalOutOfBoundsException());
- end
-
- data = obj.buf.buf(start + 1:start + sz); % Include the size & encoding version
- obj.pos = obj.pos + sz - 4;
- end
function r = getEncoding(obj)
if isempty(obj.encapsStack)
r = obj.encoding;
@@ -509,7 +495,7 @@ classdef InputStream < handle
r = typecast(uint8(obj.buf.buf(obj.pos:obj.pos + 3)), 'int32');
obj.pos = obj.pos + 4;
if r < 0
- throw new UnmarshalOutOfBoundsException();
+ throw(Ice.UnmarshalOutOfBoundsException());
end
else
r = int32(b);
@@ -585,27 +571,27 @@ classdef InputStream < handle
return;
end
- facet = obj.readStringSeq();
- mode = obj.readByte();
- secure = obj.readBool();
+ obj.readStringSeq();
+ obj.readByte();
+ obj.readBool();
%
% The versions are only included in encoding >= 1.1.
%
if ~obj.encoding_1_0
- protocolVersion = Ice.ProtocolVersion.ice_read(obj);
- encodingVersion = Ice.EncodingVersion.ice_read(obj);
+ Ice.ProtocolVersion.ice_read(obj);
+ Ice.EncodingVersion.ice_read(obj);
end
numEndpoints = obj.readSize();
if numEndpoints > 0
for i = 1:numEndpoints
- type = obj.readShort();
+ obj.readShort();
obj.skipEncapsulation();
end
else
- adapterId = obj.readString();
+ obj.readString();
end
%
@@ -730,7 +716,6 @@ classdef InputStream < handle
end
if tag > readTag
- offset = 0;
if tag < 30
offset = 1;
elseif tag < 255
diff --git a/matlab/lib/+Ice/InterfaceByValue.m b/matlab/lib/+Ice/InterfaceByValue.m
index 9582e130606..0d6c25bae33 100644
--- a/matlab/lib/+Ice/InterfaceByValue.m
+++ b/matlab/lib/+Ice/InterfaceByValue.m
@@ -20,7 +20,7 @@ classdef InterfaceByValue < Ice.Value
os.startSlice(obj.id, -1, true);
os.endSlice();
end
- function iceReadImpl(obj, is)
+ function iceReadImpl(~, is)
is.startSlice();
is.endSlice();
end
diff --git a/matlab/lib/+Ice/LocalException.m b/matlab/lib/+Ice/LocalException.m
index 8e89902b166..69fdad84ccb 100644
--- a/matlab/lib/+Ice/LocalException.m
+++ b/matlab/lib/+Ice/LocalException.m
@@ -7,7 +7,7 @@ classdef (Abstract) LocalException < Ice.Exception
methods
function obj = LocalException(id, msg)
- obj = obj@Ice.Exception(id, msg)
+ obj = obj@Ice.Exception(id, msg);
end
end
end
diff --git a/matlab/lib/+Ice/ObjectPrx.m b/matlab/lib/+Ice/ObjectPrx.m
index d686c46a91e..84039fb579e 100644
--- a/matlab/lib/+Ice/ObjectPrx.m
+++ b/matlab/lib/+Ice/ObjectPrx.m
@@ -408,10 +408,10 @@ classdef ObjectPrx < IceInternal.WrapperObject
obj.instantiate_();
num = obj.iceCallWithResult('ice_getNumEndpoints');
- r = {};
+ r = cell(1, num);
for i = 1:num
impl = libpointer('voidPtr');
- e = obj.iceCallWithResult('ice_getEndpoint', i - 1, impl); % C-style index
+ obj.iceCallWithResult('ice_getEndpoint', i - 1, impl); % C-style index
assert(~isNull(impl));
r{i} = Ice.Endpoint(impl);
end
@@ -998,7 +998,7 @@ classdef ObjectPrx < IceInternal.WrapperObject
os.startEncapsulation(format);
end
- function iceEndWriteParams(obj, os)
+ function iceEndWriteParams(~, os)
os.endEncapsulation();
end
@@ -1149,7 +1149,7 @@ classdef ObjectPrx < IceInternal.WrapperObject
end
end
- function iceThrowUserException(obj, is, varargin) % Varargs are user exception type names
+ function iceThrowUserException(~, is, varargin) % Varargs are user exception type names
try
is.startEncapsulation();
is.throwException();
@@ -1176,7 +1176,7 @@ classdef ObjectPrx < IceInternal.WrapperObject
end
function r = checkedCast(p, varargin)
- if length(varargin) == 0
+ if isempty(varargin)
r = p;
else
r = Ice.ObjectPrx.iceCheckedCast(p, Ice.ObjectPrx.ice_staticId(), 'Ice.ObjectPrx', varargin{:});
@@ -1184,7 +1184,7 @@ classdef ObjectPrx < IceInternal.WrapperObject
end
function r = uncheckedCast(p, varargin)
- if length(varargin) == 0
+ if isempty(varargin)
r = p;
elseif length(varargin) == 1
if ~isempty(p)
diff --git a/matlab/lib/+Ice/OutputStream.m b/matlab/lib/+Ice/OutputStream.m
index 4306d49a7d9..2ae929279eb 100644
--- a/matlab/lib/+Ice/OutputStream.m
+++ b/matlab/lib/+Ice/OutputStream.m
@@ -351,8 +351,6 @@ classdef OutputStream < handle
% encapsulation encoding version if there's a current write
% encapsulation, otherwise, use the stream encoding version.
%
-
- encoding = [];
if ~isempty(obj.encapsStack)
encoding = obj.encapsStack.encoding;
if isempty(format)
diff --git a/matlab/lib/+Ice/UnknownSlicedValue.m b/matlab/lib/+Ice/UnknownSlicedValue.m
index f270e93a1b9..6841f3c1124 100644
--- a/matlab/lib/+Ice/UnknownSlicedValue.m
+++ b/matlab/lib/+Ice/UnknownSlicedValue.m
@@ -35,9 +35,9 @@ classdef UnknownSlicedValue < Ice.Value
end
end
methods(Access=protected)
- function iceWriteImpl(obj, os)
+ function iceWriteImpl(~, ~)
end
- function obj = iceReadImpl(obj, is)
+ function obj = iceReadImpl(obj, ~)
end
end
properties(Access=private)
diff --git a/matlab/lib/+Ice/UserException.m b/matlab/lib/+Ice/UserException.m
index bfa19295f09..c31b321900b 100644
--- a/matlab/lib/+Ice/UserException.m
+++ b/matlab/lib/+Ice/UserException.m
@@ -11,7 +11,7 @@ classdef (Abstract) UserException < Ice.Exception
methods
function obj = UserException(id, msg)
- obj = obj@Ice.Exception(id, msg)
+ obj = obj@Ice.Exception(id, msg);
end
% ice_getSlicedData - Obtain the SlicedData object that contains the
% marshaled state of any slices for unknown exception types.
@@ -19,7 +19,7 @@ classdef (Abstract) UserException < Ice.Exception
% Returns (Ice.SlicedData) - The marshaled state of any slices for
% unknown exception types.
- function r = ice_getSlicedData(obj)
+ function r = ice_getSlicedData(~)
r = [];
end
end
diff --git a/matlab/lib/+Ice/Value.m b/matlab/lib/+Ice/Value.m
index 68d595387e8..238b7637383 100644
--- a/matlab/lib/+Ice/Value.m
+++ b/matlab/lib/+Ice/Value.m
@@ -30,18 +30,18 @@ classdef (Abstract) Value < matlab.mixin.Copyable
assert(index > 0); % Check for rollover
obj.iceInternal_ = index;
end
- function ice_preMarshal(obj)
+ function ice_preMarshal(~)
% ice_preMarshal - The Ice run time invokes this method prior to
% marshaling an object's data members. This allows a subclass
% to override this method in order to validate its data members.
end
- function ice_postUnmarshal(obj)
+ function ice_postUnmarshal(~)
% ice_postUnmarshal - The Ice run time invokes this method after
% unmarshaling an object's data members. This allows a subclass
% to override this method in order to perform additional
% initialization.
end
- function r = ice_getSlicedData(obj)
+ function r = ice_getSlicedData(~)
% ice_getSlicedData - Returns the sliced data if the value has a
% preserve-slice base class and has been sliced during
% unmarshaling of the value; an empty array is returned otherwise.
@@ -71,14 +71,14 @@ classdef (Abstract) Value < matlab.mixin.Copyable
obj.iceReadImpl(is);
is.endValue(false);
end
- function r = iceDelayPostUnmarshal(obj)
+ function r = iceDelayPostUnmarshal(~)
%
% Overridden by subclasses that need to do some post-processing after the initial round of
% unmarshaling is complete.
%
r = false;
end
- function icePostUnmarshal(obj)
+ function icePostUnmarshal(~)
%
% Overridden by subclasses that need to do some post-processing after the initial round of
% unmarshaling is complete.
diff --git a/matlab/lib/+Ice/identityToString.m b/matlab/lib/+Ice/identityToString.m
index 94f3f7e325c..dc15b595157 100644
--- a/matlab/lib/+Ice/identityToString.m
+++ b/matlab/lib/+Ice/identityToString.m
@@ -12,7 +12,7 @@ function r = identityToString(id, varargin)
if length(varargin) == 1
mode = varargin{1};
- elseif length(varargin) == 0
+ elseif isempty(varargin)
mode = Ice.ToStringMode.Unicode;
elseif length(varargin) > 2
throw(MException('Ice:ArgumentException', 'too many arguments'));
diff --git a/matlab/lib/+Ice/stringToEncodingVersion.m b/matlab/lib/+Ice/stringToEncodingVersion.m
index 9a47c2470fe..0402ddb310d 100644
--- a/matlab/lib/+Ice/stringToEncodingVersion.m
+++ b/matlab/lib/+Ice/stringToEncodingVersion.m
@@ -12,5 +12,5 @@ function r = stringToEncodingVersion(s)
if isempty(tokens)
throw(MException('Ice:ArgumentException', 'expecting a version in X.Y format'));
end
- r = Ice.EncodingVersion(str2num(tokens{1}{1}), str2num(tokens{1}{2}));
+ r = Ice.EncodingVersion(str2double(tokens{1}{1}), str2double(tokens{1}{2}));
end
diff --git a/matlab/lib/+Ice/stringToProtocolVersion.m b/matlab/lib/+Ice/stringToProtocolVersion.m
index 888863b4d2d..ebfd40ea350 100644
--- a/matlab/lib/+Ice/stringToProtocolVersion.m
+++ b/matlab/lib/+Ice/stringToProtocolVersion.m
@@ -12,5 +12,5 @@ function r = stringToProtocolVersion(s)
if isempty(tokens)
throw(MException('Ice:ArgumentException', 'expecting a version in X.Y format'));
end
- r = Ice.ProtocolVersion(str2num(tokens{1}{1}), str2num(tokens{1}{2}));
+ r = Ice.ProtocolVersion(str2double(tokens{1}{1}), str2double(tokens{1}{2}));
end
diff --git a/matlab/lib/+IceInternal/ClassResolver.m b/matlab/lib/+IceInternal/ClassResolver.m
index 1a123b02942..8094df7f1d4 100644
--- a/matlab/lib/+IceInternal/ClassResolver.m
+++ b/matlab/lib/+IceInternal/ClassResolver.m
@@ -4,7 +4,7 @@
classdef ClassResolver < handle
methods
- function obj = ClassResolver(props)
+ function obj = ClassResolver()
obj.typeToConstructorMap = containers.Map('KeyType', 'char', 'ValueType', 'any');
end
function r = resolve(obj, typeId)
@@ -21,7 +21,7 @@ classdef ClassResolver < handle
%
r = obj.typeToConstructorMap(typeId);
return;
- catch ex
+ catch
%
% The map raises an exception if a key doesn't exist.
%
diff --git a/matlab/lib/+IceInternal/EncapsDecoder.m b/matlab/lib/+IceInternal/EncapsDecoder.m
index d61dfd537d4..9b3701db44d 100644
--- a/matlab/lib/+IceInternal/EncapsDecoder.m
+++ b/matlab/lib/+IceInternal/EncapsDecoder.m
@@ -20,11 +20,11 @@ classdef (Abstract) EncapsDecoder < handle
obj.delayedPostUnmarshal = {};
end
- function r = readOptional(obj, readTag, expectedFormat)
+ function r = readOptional(~, ~, ~)
r = false;
end
- function readPendingValues(obj)
+ function readPendingValues(~)
end
function finish(obj)
@@ -143,7 +143,6 @@ classdef (Abstract) EncapsDecoder < handle
% the callback will be called when the instance is
% unmarshaled.
%
- pl = [];
if obj.patchMap.isKey(index)
pl = obj.patchMap(index);
else
@@ -181,7 +180,7 @@ classdef (Abstract) EncapsDecoder < handle
% Patch all instances now that the instance is unmarshaled.
%
l = obj.patchMap(index);
- assert(length(l.list) > 0);
+ assert(~isempty(l.list));
%
% Patch all pointers that refer to the instance.
diff --git a/matlab/lib/+IceInternal/EncapsDecoder10.m b/matlab/lib/+IceInternal/EncapsDecoder10.m
index 1935555f060..94ba16bde2a 100644
--- a/matlab/lib/+IceInternal/EncapsDecoder10.m
+++ b/matlab/lib/+IceInternal/EncapsDecoder10.m
@@ -131,7 +131,7 @@ classdef EncapsDecoder10 < IceInternal.EncapsDecoder
obj.skipFirstSlice = true;
end
- function r = endInstance(obj, preserve)
+ function r = endInstance(obj, ~)
%
% Read the Ice::Value slice.
%
@@ -179,7 +179,7 @@ classdef EncapsDecoder10 < IceInternal.EncapsDecoder
r = obj.typeId;
end
- function endSlice(obj)
+ function endSlice(~)
% Nothing to do
end
@@ -189,7 +189,7 @@ classdef EncapsDecoder10 < IceInternal.EncapsDecoder
obj.is.skip(obj.sliceSize - 4);
end
- function r = readOptional(obj, readTag, expectedFormat)
+ function r = readOptional(~, ~, ~)
r = false;
end
end
diff --git a/matlab/lib/+IceInternal/EncapsDecoder11.m b/matlab/lib/+IceInternal/EncapsDecoder11.m
index 7cdd0e30897..d12bf566d13 100644
--- a/matlab/lib/+IceInternal/EncapsDecoder11.m
+++ b/matlab/lib/+IceInternal/EncapsDecoder11.m
@@ -204,7 +204,7 @@ classdef EncapsDecoder11 < IceInternal.EncapsDecoder
% that not all instance references were read if they are from
% unknown optional data members.
%
- if length(indirectionTable) == 0
+ if isempty(indirectionTable)
throw(Ice.MarshalException('', '', 'empty indirection table'));
end
if isempty(obj.current.indirectPatchList) && ...
@@ -484,14 +484,14 @@ classdef EncapsDecoder11 < IceInternal.EncapsDecoder
r = Ice.SlicedData(obj.current.slices); % Makes a shallow copy
end
- function r = resolveCompactId(obj, id)
+ function r = resolveCompactId(~, id)
type = '';
if isempty(type)
prop = sprintf('IceCompactId.TypeId_%d.typeId', id);
try
type = eval(prop);
- catch ex
+ catch
end
end
diff --git a/matlab/lib/+IceInternal/EncapsEncoder.m b/matlab/lib/+IceInternal/EncapsEncoder.m
index 6b9792ad70c..55a05a620a1 100644
--- a/matlab/lib/+IceInternal/EncapsEncoder.m
+++ b/matlab/lib/+IceInternal/EncapsEncoder.m
@@ -11,11 +11,11 @@ classdef (Abstract) EncapsEncoder < handle
obj.typeIdIndex = 0;
end
- function r = writeOptional(obj, tag, format)
+ function r = writeOptional(~, ~, ~)
r = false;
end
- function writePendingValues(obj)
+ function writePendingValues(~)
%
% Overridden for the 1.0 encoding, not necessary for subsequent encodings.
%
@@ -35,7 +35,7 @@ classdef (Abstract) EncapsEncoder < handle
%
try
r = obj.typeIdMap(typeId);
- catch ex
+ catch
obj.typeIdIndex = obj.typeIdIndex + 1;
obj.typeIdMap(typeId) = obj.typeIdIndex;
r = -1;
diff --git a/matlab/lib/+IceInternal/EncapsEncoder10.m b/matlab/lib/+IceInternal/EncapsEncoder10.m
index b09159226b7..72cfa5eb7d1 100644
--- a/matlab/lib/+IceInternal/EncapsEncoder10.m
+++ b/matlab/lib/+IceInternal/EncapsEncoder10.m
@@ -23,7 +23,7 @@ classdef EncapsEncoder10 < IceInternal.EncapsEncoder
end
end
- function startInstance(obj, sliceType, slicedData)
+ function startInstance(obj, sliceType, ~)
obj.sliceType = sliceType;
end
@@ -39,7 +39,7 @@ classdef EncapsEncoder10 < IceInternal.EncapsEncoder
obj.sliceType = IceInternal.SliceType.NoSlice;
end
- function startSlice(obj, typeId, compactId, last)
+ function startSlice(obj, typeId, ~, ~)
%
% For instance slices, encode a boolean to indicate how the type ID
% is encoded and the type ID either as a string or index. For