Fixing all the issues found by prevent
authorKarol Pawlowski <k.pawlowski@samsung.com>
Mon, 15 Apr 2013 14:26:43 +0000 (16:26 +0200)
committerGerrit Code Review <gerrit2@kim11>
Wed, 17 Apr 2013 02:42:19 +0000 (11:42 +0900)
[Issue#] LINUXWRT-234
[Problem] Too many prevent warnings
[Cause] N/A
[Solution] Remove them
[Verification] Build wrt-installer repository

Change-Id: Ic12a44d6a6888bcb9e73b400315968eb08ed4428

src/jobs/widget_install/task_encrypt_resource.cpp

index ee55ea5..bca5665 100644 (file)
@@ -193,11 +193,13 @@ Tizen::Base::ByteBuffer* EncryptChunkByTrustZone(
     ByteBuffer pBuf;
     pBuf.Construct(pBufSize);
     const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-    pBuf.SetArray(pByte, 0, pBufSize);
+    if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
+        LogDebug("Couldnot set pBuf");
+        return NULL;
+    }
     pBuf.Flip();
 
-    ByteBuffer* getBuffer = pInstance->_TrustZoneService::EncryptN(*appInfo, pBuf);
-    return getBuffer;
+    return pInstance->_TrustZoneService::EncryptN(*appInfo, pBuf);
 }
 
 Tizen::Base::ByteBuffer* TEST_dec(
@@ -213,12 +215,13 @@ Tizen::Base::ByteBuffer* TEST_dec(
     ByteBuffer pBuf;
     pBuf.Construct(pBufSize);
     const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-    pBuf.SetArray(pByte, 0, pBufSize);
+    if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
+        LogDebug("Couldnot set pBuf");
+        return NULL;
+    }
     pBuf.Flip();
 
-    ByteBuffer* getBufferTEST =
-        pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
-    return getBufferTEST;
+    return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
 }
 }
 
@@ -329,7 +332,12 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
             pkgid.c_str());
     ByteBuffer appInfo;
     appInfo.Construct(pkgid.length());
-    appInfo.SetArray(b_pkgid, 0, pkgid.length());
+
+    if (appInfo.SetArray(b_pkgid, 0, pkgid.length()) != E_SUCCESS) {
+        LogDebug("Couldnot set appInfo");
+        return;
+    }
+
     appInfo.Flip();
 
     do