Move encrypted/decrypted rows instead of copying 90/48090/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 14 Sep 2015 08:02:08 +0000 (10:02 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 14 Sep 2015 08:04:53 +0000 (10:04 +0200)
[Problem] Rows are copied in CryptoLogic::decryptRow/encryptRow.
[Solution] Copying replaced with std::move

[Verification] Run tests

Change-Id: I362638d8981bbe8e511b417596f4cb67ae6f058e

src/manager/service/crypto-logic.cpp

index b51e6c4..b851f92 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <iostream>
 #include <fstream>
+#include <utility>
+
 #include <stdio.h>
 #include <string.h>
 
@@ -167,7 +169,7 @@ void CryptoLogic::encryptRow(const Password &password, DB::Row &row)
         crow.encryptionScheme |= ENCR_BASE64;
         encBase64(crow.iv);
 
-        row = crow;
+        row = std::move(crow);
     } catch(const CKM::Base64Encoder::Exception::Base &e) {
         ThrowErr(Exc::InternalError, e.GetMessage());
     } catch(const CKM::Base64Decoder::Exception::Base &e) {
@@ -222,7 +224,7 @@ void CryptoLogic::decryptRow(const Password &password, DB::Row &row)
             crow.data.resize(crow.dataSize);
         }
 
-        row = crow;
+        row = std::move(crow);
     } catch(const CKM::Base64Encoder::Exception::Base &e) {
         ThrowErr(Exc::InternalError, e.GetMessage());
     } catch(const CKM::Base64Decoder::Exception::Base &e) {