From 84aef9a7dd33bab8d03200eac4bfef454bb93d84 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 11 Jan 2014 23:53:34 -0800 Subject: [PATCH] sig::Copy should use const for source arguments. --- sig/copy.cpp | 8 ++++---- sig/parse.hpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sig/copy.cpp b/sig/copy.cpp index b85640c..b2c20f5 100644 --- a/sig/copy.cpp +++ b/sig/copy.cpp @@ -34,7 +34,7 @@ namespace sig { -void Copy(CYPool &pool, Element &lhs, Element &rhs) { +void Copy(CYPool &pool, Element &lhs, const Element &rhs) { lhs.name = pool.strdup(rhs.name); if (rhs.type == NULL) lhs.type = NULL; @@ -45,7 +45,7 @@ void Copy(CYPool &pool, Element &lhs, Element &rhs) { lhs.offset = rhs.offset; } -void Copy(CYPool &pool, Signature &lhs, Signature &rhs) { +void Copy(CYPool &pool, Signature &lhs, const Signature &rhs) { size_t count(rhs.count); lhs.count = count; lhs.elements = new(pool) Element[count]; @@ -53,7 +53,7 @@ void Copy(CYPool &pool, Signature &lhs, Signature &rhs) { Copy(pool, lhs.elements[index], rhs.elements[index]); } -void Copy(CYPool &pool, Type &lhs, Type &rhs) { +void Copy(CYPool &pool, Type &lhs, const Type &rhs) { lhs.primitive = rhs.primitive; lhs.name = pool.strdup(rhs.name); lhs.flags = rhs.flags; @@ -62,7 +62,7 @@ void Copy(CYPool &pool, Type &lhs, Type &rhs) { Copy(pool, lhs.data.signature, rhs.data.signature); else { sig::Type *&lht(lhs.data.data.type); - sig::Type *&rht(rhs.data.data.type); + sig::Type *const &rht(rhs.data.data.type); if (rht == NULL) lht = NULL; diff --git a/sig/parse.hpp b/sig/parse.hpp index fb6db63..a770f20 100644 --- a/sig/parse.hpp +++ b/sig/parse.hpp @@ -33,9 +33,9 @@ void Parse(CYPool &pool, struct Signature *signature, const char *name, Callback const char *Unparse(CYPool &pool, struct Signature *signature); const char *Unparse(CYPool &pool, struct Type *type); -void Copy(CYPool &pool, Type &lhs, Type &rhs); -void Copy(CYPool &pool, Signature &lhs, Signature &rhs); -void Copy(CYPool &pool, Type &lhs, Type &rhs); +void Copy(CYPool &pool, Type &lhs, const Type &rhs); +void Copy(CYPool &pool, Signature &lhs, const Signature &rhs); +void Copy(CYPool &pool, Type &lhs, const Type &rhs); } -- 2.47.2