From: Oleksandr Kaspruk Date: Thu, 18 Apr 2013 11:57:22 +0000 (+0900) Subject: SysTry -> SysSecureTry X-Git-Tag: accepted/tizen_2.1/20130425.033135~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fnative%2Fvision.git;a=commitdiff_plain;h=42db0e9840a9d6d4dbadd09b3da8cb416721db9a SysTry -> SysSecureTry Change-Id: I8c5d0ac1f47273cc933cd0e1115e294c348b2b4f Signed-off-by: Oleksandr Kaspruk --- diff --git a/src/FUixVisionImageFeatureInfo.cpp b/src/FUixVisionImageFeatureInfo.cpp index 4468b2c..53924ac 100644 --- a/src/FUixVisionImageFeatureInfo.cpp +++ b/src/FUixVisionImageFeatureInfo.cpp @@ -55,7 +55,7 @@ ImageFeatureInfo::GetDescription() const } std::unique_ptr pName(new (std::nothrow) char[length + 1]); - SysTryReturn(NID_UIX, pName != null, Tizen::Base::String(""), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)) + SysSecureTryReturn(NID_UIX, pName != null, Tizen::Base::String(""), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)) //set data to char pointer, with allocated memory __pImageFeatureInfoImpl->GetDescription(pName.get(), length + 1); @@ -80,19 +80,19 @@ Tizen::Base::ByteBuffer* ImageFeatureInfo::GetThumbnailN(void) const { int bufWidth = __pImageFeatureInfoImpl->GetThumbnailWidth(); - SysTryReturn(NID_UIX, bufWidth > 0, null, E_FAILURE, "[%s] Failed to get thumbnail width.", GetErrorMessage(E_FAILURE)); + SysSecureTryReturn(NID_UIX, bufWidth > 0, null, E_FAILURE, "[%s] Failed to get thumbnail width.", GetErrorMessage(E_FAILURE)); int bufHeight = __pImageFeatureInfoImpl->GetThumbnailHeight(); - SysTryReturn(NID_UIX, bufHeight > 0, null, E_FAILURE, "[%s] Failed to get thumbnail height.", GetErrorMessage(E_FAILURE)); + SysSecureTryReturn(NID_UIX, bufHeight > 0, null, E_FAILURE, "[%s] Failed to get thumbnail height.", GetErrorMessage(E_FAILURE)); std::unique_ptr pOutBuffer(new (std::nothrow) Tizen::Base::ByteBuffer()); - SysTryReturn(NID_UIX, pOutBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pOutBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); result res = pOutBuffer->Construct(bufWidth * bufHeight); - SysTryReturn(NID_UIX, res == E_SUCCESS, null, res, "[%s] Failed to construct ByteBuffer.", GetErrorMessage(res)); + SysSecureTryReturn(NID_UIX, res == E_SUCCESS, null, res, "[%s] Failed to construct ByteBuffer.", GetErrorMessage(res)); bool success = __pImageFeatureInfoImpl->GetThumbnail((char*)pOutBuffer->GetPointer(), bufWidth, bufHeight, false); - SysTryReturn(NID_UIX, success == true, null, E_FAILURE, "[%s] Failed to get thumbnail.", GetErrorMessage(E_FAILURE)); + SysSecureTryReturn(NID_UIX, success == true, null, E_FAILURE, "[%s] Failed to get thumbnail.", GetErrorMessage(E_FAILURE)); return pOutBuffer.release(); } diff --git a/src/FUixVisionImageFeatureManager.cpp b/src/FUixVisionImageFeatureManager.cpp index e71bafb..7b8eea4 100644 --- a/src/FUixVisionImageFeatureManager.cpp +++ b/src/FUixVisionImageFeatureManager.cpp @@ -46,7 +46,7 @@ ImageFeatureManager::Construct(void) "Calling Construct() twice or more on a same instance is not allowed for this class."); std::unique_ptr<_ImageFeatureManagerImpl> pImageFeatureManagerImpl (new (std::nothrow) _ImageFeatureManagerImpl()); - SysTryReturn(NID_UIX, pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pImageFeatureManagerImpl = pImageFeatureManagerImpl.release(); __pImageFeatureManagerImpl->InitDB(); @@ -58,7 +58,7 @@ ImageFeatureManager::DeleteFeature(int featureIndex) { SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, featureIndex >= 0, E_FAILURE, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, featureIndex >= 0, E_FAILURE, E_INVALID_ARG, "index should be greater than 0. [E_INVALID_ARG]"); return __pImageFeatureManagerImpl->DeleteFeature(featureIndex) ? E_SUCCESS : E_FAILURE; @@ -75,7 +75,7 @@ result ImageFeatureManager::DeleteAllFeatures(void) { SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturnResult(NID_UIX, __pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + SysSecureTryReturnResult(NID_UIX, __pImageFeatureManagerImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); __pImageFeatureManagerImpl->ReleaseDB(); __pImageFeatureManagerImpl->InitDB(); return E_SUCCESS; @@ -87,12 +87,12 @@ ImageFeatureManager::AddFeature(const Tizen::Base::ByteBuffer& imageBuffer, int SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, width > 0 && height > 0, -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, width > 0 && height > 0, -1, E_INVALID_ARG, "Width and height must me more than 0. [E_INVALID_ARG]"); const unsigned char* image = (unsigned char*) imageBuffer.GetPointer(); - SysTryReturn(NID_UIX, image != null, -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, image != null, -1, E_INVALID_ARG, "image pointer must not be null. [E_INVALID_ARG]"); return (int) __pImageFeatureManagerImpl->AddFeature(image, width, height, descr); @@ -103,18 +103,18 @@ ImageFeatureManager::AddFeature(const Tizen::Base::String& imagePath) { SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, !imagePath.IsEmpty(), -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, !imagePath.IsEmpty(), -1, E_INVALID_ARG, "image path must not be empty. [E_INVALID_ARG]"); - SysTryReturn(NID_UIX, Tizen::Io::File::IsFileExist(imagePath), -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, Tizen::Io::File::IsFileExist(imagePath), -1, E_INVALID_ARG, "image path must exist. [E_INVALID_ARG]"); Tizen::Io::FileAttributes _fileAtt; - SysTryReturn(NID_UIX, Tizen::Io::File::GetAttributes(imagePath, _fileAtt) == E_SUCCESS, -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, Tizen::Io::File::GetAttributes(imagePath, _fileAtt) == E_SUCCESS, -1, E_INVALID_ARG, "image file must have attributes. [E_INVALID_ARG]"); - SysTryReturn(NID_UIX, !_fileAtt.IsDirectory(), -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, !_fileAtt.IsDirectory(), -1, E_INVALID_ARG, "image file must exist. [E_INVALID_ARG]"); return (int) __pImageFeatureManagerImpl->AddFeature(imagePath); @@ -133,18 +133,18 @@ ImageFeatureManager::Load(const Tizen::Base::String& featureSetFilePath) { SysAssertf(__pImageFeatureManagerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturnResult(NID_UIX, !featureSetFilePath.IsEmpty(), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, !featureSetFilePath.IsEmpty(), E_INVALID_ARG, "feature set path must not be empty. [E_INVALID_ARG]"); - SysTryReturnResult(NID_UIX, Tizen::Io::File::IsFileExist(featureSetFilePath), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, Tizen::Io::File::IsFileExist(featureSetFilePath), E_INVALID_ARG, "feature set path must exist. [E_INVALID_ARG]"); Tizen::Io::FileAttributes _fileAtt; - SysTryReturnResult(NID_UIX, Tizen::Io::File::GetAttributes(featureSetFilePath, _fileAtt) == E_SUCCESS, E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, Tizen::Io::File::GetAttributes(featureSetFilePath, _fileAtt) == E_SUCCESS, E_INVALID_ARG, "feature set file must have attributes. [E_INVALID_ARG]"); - SysTryReturnResult(NID_UIX, !_fileAtt.IsDirectory(), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, !_fileAtt.IsDirectory(), E_INVALID_ARG, "feature set file must exist. [E_INVALID_ARG]"); return __pImageFeatureManagerImpl->OpenDB(featureSetFilePath) ? E_SUCCESS : E_FAILURE; @@ -154,7 +154,7 @@ Tizen::Base::Collection::IListT* ImageFeatureManager::GetSupportedImageFileFormatsListN(void) { std::unique_ptr > pFormatList(new (std::nothrow) Tizen::Base::Collection::ArrayListT); - SysTryReturn(NID_UIX, pFormatList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pFormatList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pFormatList->Add(Tizen::Media::IMG_FORMAT_BMP); pFormatList->Add(Tizen::Media::IMG_FORMAT_JPG); diff --git a/src/FUixVisionImageRecognizer.cpp b/src/FUixVisionImageRecognizer.cpp index e2785cf..070d5f9 100644 --- a/src/FUixVisionImageRecognizer.cpp +++ b/src/FUixVisionImageRecognizer.cpp @@ -45,7 +45,7 @@ ImageRecognizer::Construct(void) "Calling Construct() twice or more on a same instance is not allowed for this class."); std::unique_ptr<_ImageRecognizerImpl> pImageRecognizerImpl (new (std::nothrow) _ImageRecognizerImpl); - SysTryReturn(NID_UIX, pImageRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pImageRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pImageRecognizerImpl = pImageRecognizerImpl.release(); return E_SUCCESS; @@ -63,7 +63,7 @@ ImageRecognizer::SetImageSize(int width, int height) { SysAssertf(__pImageRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturnResult(NID_UIX, width > 0 && height > 0, E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, width > 0 && height > 0, E_INVALID_ARG, "Width and height must me more than 0. [E_INVALID_ARG]"); return __pImageRecognizerImpl->SetImageSize(width, height) ? E_SUCCESS : E_FAILURE; @@ -97,7 +97,7 @@ ImageRecognizer::ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer) { SysAssertf(__pImageRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, imageBuffer.GetPointer(), -1, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, imageBuffer.GetPointer(), -1, E_INVALID_ARG, "imageBuffer must not be null. [E_INVALID_ARG]"); return __pImageRecognizerImpl->ProcessImage((unsigned char*) imageBuffer.GetPointer()) != -1 ? E_SUCCESS : E_FAILURE; diff --git a/src/FUixVisionQrCodeGenerator.cpp b/src/FUixVisionQrCodeGenerator.cpp index 2e84796..8562aaa 100644 --- a/src/FUixVisionQrCodeGenerator.cpp +++ b/src/FUixVisionQrCodeGenerator.cpp @@ -44,7 +44,7 @@ QrCodeGenerator::Construct(void) "Calling Construct() twice or more on a same instance is not allowed for this class."); std::unique_ptr<_QrCodeGeneratorImpl> pQrCodeGeneratorImpl(new (std::nothrow) _QrCodeGeneratorImpl()); - SysTryReturn(NID_UIX, pQrCodeGeneratorImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pQrCodeGeneratorImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pQrCodeGeneratorImpl = pQrCodeGeneratorImpl.release(); return E_SUCCESS; @@ -55,7 +55,7 @@ QrCodeGenerator::EncodeToBufferN(const Tizen::Base::String& message, QrCodeMode { SysAssertf(__pQrCodeGeneratorImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturnResult(NID_UIX, !message.IsEmpty(), null, + SysSecureTryReturnResult(NID_UIX, !message.IsEmpty(), null, "message must not be empty. [E_INVALID_ARG]"); Tizen::Text::Utf8Encoding utf8; @@ -63,7 +63,7 @@ QrCodeGenerator::EncodeToBufferN(const Tizen::Base::String& message, QrCodeMode __pQrCodeGeneratorImpl->GetSize(width, height); std::unique_ptr pBuffer(new (std::nothrow) Tizen::Base::ByteBuffer()); - SysTryReturn(NID_UIX, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pBuffer->Construct(width * height); @@ -83,10 +83,10 @@ QrCodeGenerator::EncodeToFile(const Tizen::Base::String& message, QrCodeMode mod { SysAssertf(__pQrCodeGeneratorImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturnResult(NID_UIX, !message.IsEmpty(), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, !message.IsEmpty(), E_INVALID_ARG, "message must not be empty. [E_INVALID_ARG]"); - SysTryReturnResult(NID_UIX, !imageFilePath.IsEmpty(), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, !imageFilePath.IsEmpty(), E_INVALID_ARG, "image path must not be empty. [E_INVALID_ARG]"); Tizen::Text::Utf8Encoding utf8; @@ -103,7 +103,7 @@ QrCodeGenerator::GetSupportedImageFileFormatsListN(void) { std::unique_ptr > pFormatList( new (std::nothrow) Tizen::Base::Collection::ArrayListT); - SysTryReturn(NID_UIX, pFormatList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pFormatList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pFormatList->Add(Tizen::Media::IMG_FORMAT_BMP); diff --git a/src/FUixVisionQrCodeRecognizer.cpp b/src/FUixVisionQrCodeRecognizer.cpp index 1278ccb..d979a99 100644 --- a/src/FUixVisionQrCodeRecognizer.cpp +++ b/src/FUixVisionQrCodeRecognizer.cpp @@ -43,7 +43,7 @@ QrCodeRecognizer::Construct(void) "Calling Construct() twice or more on a same instance is not allowed for this class."); std::unique_ptr<_QrCodeRecognizerImpl> pQrCodeRecognizerImpl(new (std::nothrow) _QrCodeRecognizerImpl()); - SysTryReturn(NID_UIX, pQrCodeRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + SysSecureTryReturn(NID_UIX, pQrCodeRecognizerImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pQrCodeRecognizerImpl = pQrCodeRecognizerImpl.release(); return __pQrCodeRecognizerImpl->Init() ? E_SUCCESS : E_FAILURE; @@ -54,7 +54,7 @@ QrCodeRecognizer::SetImageSize(int width, int height) { SysAssertf(__pQrCodeRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, width > 0 && height > 0, false, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, width > 0 && height > 0, false, E_INVALID_ARG, "width and height must be greater then 0. [E_INVALID_ARG]"); return __pQrCodeRecognizerImpl->SetFrameSize(width, height) ? E_SUCCESS : E_FAILURE; @@ -95,7 +95,7 @@ QrCodeRecognizer::ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer) { SysAssertf(__pQrCodeRecognizerImpl != null, "Not yet constructed! Consruct() should be called before use."); - SysTryReturn(NID_UIX, imageBuffer.GetPointer(), false, E_INVALID_ARG, + SysSecureTryReturn(NID_UIX, imageBuffer.GetPointer(), false, E_INVALID_ARG, "image buffer must not be null. [E_INVALID_ARG]"); return __pQrCodeRecognizerImpl->ProcessFrame((unsigned char*) imageBuffer.GetPointer()) ? E_SUCCESS : E_FAILURE; diff --git a/src/FUixVision_ImageFeatureManagerImpl.cpp b/src/FUixVision_ImageFeatureManagerImpl.cpp index 43953a3..856ffad 100644 --- a/src/FUixVision_ImageFeatureManagerImpl.cpp +++ b/src/FUixVision_ImageFeatureManagerImpl.cpp @@ -138,7 +138,7 @@ _ImageFeatureManagerImpl::GetTotalNumberOfFeatures(void) result _ImageFeatureManagerImpl::SaveDB(bool optimizeDatabase, const Tizen::Base::String* dbPath) { - SysTryReturnResult(NID_UIX, (!__path.IsEmpty()) || (null != dbPath), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, (!__path.IsEmpty()) || (null != dbPath), E_INVALID_ARG, "You need to open some database first or specify path to save data. [E_INVALID_ARG]"); UpdateDB(); @@ -154,7 +154,7 @@ _ImageFeatureManagerImpl::SaveDB(bool optimizeDatabase, const Tizen::Base::Strin if (null != dbPath) { - SysTryReturnResult(NID_UIX, !dbPath->IsEmpty(), E_INVALID_ARG, + SysSecureTryReturnResult(NID_UIX, !dbPath->IsEmpty(), E_INVALID_ARG, "database path must not be empty. [E_INVALID_ARG]"); Tizen::Text::Utf8Encoding utf8; result = __imageFeatureManager->saveDB(optimizeDatabase, (const char*) utf8.GetBytesN(*dbPath)->GetPointer()) ? E_SUCCESS : E_FAILURE;