Skip to content

Commit

Permalink
Cleaned up some security warnings (#700)
Browse files Browse the repository at this point in the history
Signed-off-by: The MathWorks, Inc. <alchrist@mathworks.com>
  • Loading branch information
achristoforides committed Jul 8, 2022
1 parent ebd854d commit e9b190f
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion framework/include/cppmicroservices/Any.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ class US_Framework_EXPORT Any
* \param rhs The Any which should be moved into this Any.
* \return A reference to this Any.
*/
Any& operator=(Any&& rhs)
Any& operator=(Any&& rhs) noexcept
{
_content = std::move(rhs._content);
return *this;
Expand Down
8 changes: 4 additions & 4 deletions framework/include/cppmicroservices/Bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ class US_Framework_EXPORT Bundle
STOP_TRANSIENT = 0x00000001
};

Bundle(const Bundle&); // = default
Bundle(Bundle&&); // = default
Bundle& operator=(const Bundle&); // = default
Bundle& operator=(Bundle&&); // = default
Bundle(const Bundle&); // = default
Bundle(Bundle&&) noexcept; // = default
Bundle& operator=(const Bundle&); // = default
Bundle& operator=(Bundle&&) noexcept; // = default

/**
* Constructs an invalid %Bundle object.
Expand Down
8 changes: 4 additions & 4 deletions framework/include/cppmicroservices/Framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class US_Framework_EXPORT Framework : public Bundle
*/
explicit Framework(Bundle b);

Framework(const Framework& fw); // = default
Framework(Framework&& fw); // = default
Framework& operator=(const Framework& fw); // = default
Framework& operator=(Framework&& fw); // = default
Framework(const Framework& fw); // = default
Framework(Framework&& fw) noexcept; // = default
Framework& operator=(const Framework& fw); // = default
Framework& operator=(Framework&& fw) noexcept; // = default

/**
* Initialize this Framework. After calling this method, this Framework
Expand Down
4 changes: 2 additions & 2 deletions framework/include/cppmicroservices/ListenerToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class US_Framework_EXPORT ListenerToken

ListenerToken& operator=(const ListenerToken&) = delete;

ListenerToken(ListenerToken&& other);
ListenerToken(ListenerToken&& other) noexcept;

ListenerToken& operator=(ListenerToken&& other);
ListenerToken& operator=(ListenerToken&& other) noexcept;

/**
* Tests this %ListenerToken object for validity.
Expand Down
8 changes: 4 additions & 4 deletions framework/include/cppmicroservices/ServiceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class US_Framework_EXPORT ServiceObjectsBase
ServiceObjectsBase(const ServiceObjectsBase& other) = delete;
ServiceObjectsBase& operator=(const ServiceObjectsBase& other) = delete;

ServiceObjectsBase(ServiceObjectsBase&& other);
ServiceObjectsBase& operator=(ServiceObjectsBase&& other);
ServiceObjectsBase(ServiceObjectsBase&& other) noexcept;
ServiceObjectsBase& operator=(ServiceObjectsBase&& other) noexcept;

protected:
ServiceObjectsBase(const std::shared_ptr<BundleContextPrivate>& context,
Expand Down Expand Up @@ -177,8 +177,8 @@ class US_Framework_EXPORT ServiceObjects<void> : private ServiceObjectsBase
ServiceObjects(const ServiceObjects& other) = delete;
ServiceObjects& operator=(const ServiceObjects& other) = delete;

ServiceObjects(ServiceObjects&& other);
ServiceObjects& operator=(ServiceObjects&& other);
ServiceObjects(ServiceObjects&& other) noexcept;
ServiceObjects& operator=(ServiceObjects&& other) noexcept;

/**
* Returns a service object as a InterfaceMap instance for the referenced service.
Expand Down
4 changes: 2 additions & 2 deletions framework/include/cppmicroservices/ServiceRegistrationBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class US_Framework_EXPORT ServiceRegistrationBase
public:
ServiceRegistrationBase(const ServiceRegistrationBase& reg);

ServiceRegistrationBase(ServiceRegistrationBase&& reg);
ServiceRegistrationBase(ServiceRegistrationBase&& reg) noexcept;

/**
* A boolean conversion operator converting this ServiceRegistrationBase object
Expand Down Expand Up @@ -178,7 +178,7 @@ class US_Framework_EXPORT ServiceRegistrationBase

ServiceRegistrationBase& operator=(
const ServiceRegistrationBase& registration);
ServiceRegistrationBase& operator=(ServiceRegistrationBase&& registration);
ServiceRegistrationBase& operator=(ServiceRegistrationBase&& registration) noexcept;

private:
friend class ServiceRegistry;
Expand Down
2 changes: 1 addition & 1 deletion framework/include/cppmicroservices/detail/Threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MutexLockingStrategy

#ifdef US_ENABLE_THREADING_SUPPORT

UniqueLock(UniqueLock&& o)
UniqueLock(UniqueLock&& o) noexcept
: m_Lock(std::move(o.m_Lock))
{}

Expand Down
4 changes: 2 additions & 2 deletions framework/src/bundle/Bundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ namespace cppmicroservices {

Bundle::Bundle(const Bundle&) = default;

Bundle::Bundle(Bundle&& b)
Bundle::Bundle(Bundle&& b) noexcept
: d(std::move(b.d))
, c(std::move(b.c))
{}

Bundle& Bundle::operator=(const Bundle&) = default;

Bundle& Bundle::operator=(Bundle&& b)
Bundle& Bundle::operator=(Bundle&& b) noexcept
{
this->d = std::move(b.d);
this->c = std::move(b.c);
Expand Down
4 changes: 2 additions & 2 deletions framework/src/service/ListenerToken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ ListenerToken::ListenerToken(ListenerTokenId _tokenId)
: tokenId(_tokenId)
{}

ListenerToken::ListenerToken(ListenerToken&& other)
ListenerToken::ListenerToken(ListenerToken&& other) noexcept
: tokenId(std::move(other.tokenId))
{
other.tokenId = ListenerTokenId(0);
}

ListenerToken& ListenerToken::operator=(ListenerToken&& other)
ListenerToken& ListenerToken::operator=(ListenerToken&& other) noexcept
{
tokenId = std::move(other.tokenId);
other.tokenId = ListenerTokenId(0);
Expand Down
8 changes: 4 additions & 4 deletions framework/src/service/ServiceObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,23 @@ ServiceReferenceBase ServiceObjectsBase::GetReference() const
return d->m_reference;
}

ServiceObjectsBase::ServiceObjectsBase(ServiceObjectsBase&& other)
ServiceObjectsBase::ServiceObjectsBase(ServiceObjectsBase&& other) noexcept
: d(std::move(other.d))
{}

ServiceObjectsBase::~ServiceObjectsBase() = default;

ServiceObjectsBase& ServiceObjectsBase::operator=(ServiceObjectsBase&& other)
ServiceObjectsBase& ServiceObjectsBase::operator=(ServiceObjectsBase&& other) noexcept
{
d = std::move(other.d);
return *this;
}

ServiceObjects<void>::ServiceObjects(ServiceObjects&& other)
ServiceObjects<void>::ServiceObjects(ServiceObjects&& other) noexcept
: ServiceObjectsBase(std::move(other))
{}

ServiceObjects<void>& ServiceObjects<void>::operator=(ServiceObjects&& other)
ServiceObjects<void>& ServiceObjects<void>::operator=(ServiceObjects&& other) noexcept
{
ServiceObjectsBase::operator=(std::move(other));
return *this;
Expand Down
4 changes: 2 additions & 2 deletions framework/src/service/ServiceRegistrationBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ServiceRegistrationBase::ServiceRegistrationBase(
++d->ref;
}

ServiceRegistrationBase::ServiceRegistrationBase(ServiceRegistrationBase&& reg)
ServiceRegistrationBase::ServiceRegistrationBase(ServiceRegistrationBase&& reg) noexcept
: d(nullptr)
{
std::swap(d, reg.d);
Expand Down Expand Up @@ -353,7 +353,7 @@ ServiceRegistrationBase& ServiceRegistrationBase::operator=(
}

ServiceRegistrationBase& ServiceRegistrationBase::operator=(
ServiceRegistrationBase&& registration)
ServiceRegistrationBase&& registration) noexcept
{
if (d && !--d->ref)
delete d;
Expand Down
4 changes: 2 additions & 2 deletions framework/src/util/Framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ FrameworkPrivate* pimpl(const std::shared_ptr<BundlePrivate>& p)

Framework::Framework(const Framework&) = default;

Framework::Framework(Framework&& fw)
Framework::Framework(Framework&& fw) noexcept
: Bundle(std::move(fw))
{}

Framework& Framework::operator=(const Framework&) = default;

Framework& Framework::operator=(Framework&& fw)
Framework& Framework::operator=(Framework&& fw) noexcept
{
Bundle::operator=(std::move(fw));
return *this;
Expand Down
4 changes: 2 additions & 2 deletions framework/src/util/Properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ Properties::Properties(const AnyMap& p)
}
}

Properties::Properties(Properties&& o)
Properties::Properties(Properties&& o) noexcept
: keys(std::move(o.keys))
, values(std::move(o.values))
{}

Properties& Properties::operator=(Properties&& o)
Properties& Properties::operator=(Properties&& o) noexcept
{
keys = std::move(o.keys);
values = std::move(o.values);
Expand Down
6 changes: 3 additions & 3 deletions framework/src/util/Properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class Properties : public detail::MultiThreaded<>
public:
explicit Properties(const AnyMap& props);

Properties(Properties&& o);
Properties& operator=(Properties&& o);
Properties(Properties&& o) noexcept;
Properties& operator=(Properties&& o) noexcept;

Any Value_unlocked(const std::string& key) const;
Any Value_unlocked(int index) const;
Expand All @@ -66,7 +66,7 @@ class PropertiesHandle
, l(lock ? props.Lock() : Properties::UniqueLock())
{}

PropertiesHandle(PropertiesHandle&& o)
PropertiesHandle(PropertiesHandle&& o) noexcept
: props(o.props)
, l(std::move(o.l))
{}
Expand Down

0 comments on commit e9b190f

Please sign in to comment.