Minor static analysis bug fix.
authorSenthil Kumar G S <senthil.gs@samsung.com>
Fri, 6 Jan 2017 13:15:55 +0000 (18:45 +0530)
committerUze Choi <uzchoi@samsung.com>
Mon, 9 Jan 2017 08:19:17 +0000 (08:19 +0000)
Solves the self assignment problem (x = x)
which is reported by the static analysis tool(SVACE).

Change-Id: I5d50dda1bc531501c619df7f29bf0e94758f3137
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16199
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Abhishek Pandey <abhi.siso@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Harish Marappa <h.marappa@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-encapsulation/include/RCSResourceAttributes.h

index 3a1c4c9..0973af2 100644 (file)
@@ -161,11 +161,14 @@ namespace OIC
             }
             inline RCSByteString& operator=(const RCSByteString& rhs)
             {
-                if (!m_data.empty())
+                if(&rhs != this)
                 {
-                    m_data.clear();
+                    if (!m_data.empty())
+                    {
+                        m_data.clear();
+                    }
+                    m_data = DataType{rhs.getByteString()};
                 }
-                m_data = DataType{rhs.getByteString()};
                 return *this;
             }
         private: