Fix attribute duplication 50/143050/1
authorSomin Kim <somin926.kim@samsung.com>
Tue, 8 Aug 2017 08:44:03 +0000 (17:44 +0900)
committerSomin Kim <somin926.kim@samsung.com>
Tue, 8 Aug 2017 08:44:03 +0000 (17:44 +0900)
Change-Id: Id1651f3d2b5e09922d5328621a5585de191d10e0
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
src/shared/Attribute.cpp
src/shared/Attribute.h

index 2f10e82969a347b7df59076fa9113c25332061f1..958a37ad50fdcae1f6f6ac5384705f02dc32f40a 100644 (file)
@@ -54,18 +54,18 @@ Attribute* Attribute::build(const std::string& name, Json::Value& jsonNode)
        return NULL;
 }
 
-Attribute* Attribute::build(const Attribute& other)
+Attribute* Attribute::build(Attribute& other)
 {
        Attribute::Type type = other.getType();
 
        if (type == Attribute::Type::INTEGER) {
-               Attribute* dup = new IntegerAttribute(other.getName());
-               *dup = other;
+               IntegerAttribute* dup = new IntegerAttribute(other.getName());
+               *dup = static_cast<IntegerAttribute&>(other);
                return dup;
 
        } else if (type == Attribute::Type::STRING) {
-               Attribute* dup = new StringAttribute(other.getName());
-               *dup = other;
+               StringAttribute* dup = new StringAttribute(other.getName());
+               *dup = static_cast<StringAttribute&>(other);
                return dup;
        }
 
index 4f4942ba641c54d2043e29af0f335193d602227c..9217ea912a9b19f970918ea217009c1dabab4795 100644 (file)
@@ -45,7 +45,7 @@ namespace ctx {
                virtual bool operator<=(const std::string& antecedent) = 0;
 
                static Attribute* build(const std::string& name, Json::Value& jsonNode);
-               static Attribute* build(const Attribute& other);
+               static Attribute* build(Attribute& other);
 
        protected:
                Attribute(const std::string& name);