Change-Id: I9a38b6b8271a908b94deecef15f6103a05e00219
Signed-off-by: santhosh.au <santhosh.au@samsung.com>
result
QrCodeGenerator::EncodeToFile(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel errorCorrectionLevel, bool compatibility, const Tizen::Base::String& imageFilePath, Tizen::Media::ImageFormat imageFormat, int& width, int& height)
{
result
QrCodeGenerator::EncodeToFile(const Tizen::Base::String& message, QrCodeMode mode, QrCodeErrorCorrectionLevel errorCorrectionLevel, bool compatibility, const Tizen::Base::String& imageFilePath, Tizen::Media::ImageFormat imageFormat, int& width, int& height)
{
SysAssertf(__pQrCodeGeneratorImpl != null, "Not yet constructed! Consruct() should be called before use.");
SysSecureTryReturnResult(NID_UIX, !message.IsEmpty(), E_INVALID_ARG,
SysAssertf(__pQrCodeGeneratorImpl != null, "Not yet constructed! Consruct() should be called before use.");
SysSecureTryReturnResult(NID_UIX, !message.IsEmpty(), E_INVALID_ARG,
Tizen::Text::Utf8Encoding utf8;
std::unique_ptr<Tizen::Base::ByteBuffer> pBuffer(utf8.GetBytesN(message));
Tizen::Text::Utf8Encoding utf8;
std::unique_ptr<Tizen::Base::ByteBuffer> pBuffer(utf8.GetBytesN(message));
- if (!__pQrCodeGeneratorImpl->Encode((char*) pBuffer->GetPointer(), mode, errorCorrectionLevel, compatibility))
- {
- return E_FAILURE;
- }
+ if (!__pQrCodeGeneratorImpl->Encode((char*) pBuffer->GetPointer(), mode, errorCorrectionLevel, compatibility))
+ {
+ return E_OPERATION_FAILED;
+ }
+
+ if(!__pQrCodeGeneratorImpl->SaveToFile(imageFilePath, imageFormat,width, height))
+ {
+ r = GetLastResult();
+ if( r == E_ILLEGAL_ACCESS || r == E_OUT_OF_RANGE)
+ r = E_FILE_NOT_FOUND;
+ }
- return __pQrCodeGeneratorImpl->SaveToFile(imageFilePath, imageFormat, width, height) ? E_SUCCESS : E_FAILURE;
}
Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>*
}
Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>*
{
if(!GetSize(width, height))
{
{
if(!GetSize(width, height))
{
+ SetLastResult(E_INVALID_ARG);
return false;
}
unsigned char* grayBuffer = new unsigned char[(width * height * 3) >> 1];
if(!SaveToBuffer(grayBuffer))
{
return false;
}
unsigned char* grayBuffer = new unsigned char[(width * height * 3) >> 1];
if(!SaveToBuffer(grayBuffer))
{
+ SetLastResult(E_OPERATION_FAILED); //No proper error returned from SaveToBuffer() Api.
delete[] grayBuffer;
if(IsFailed(r))
{
delete[] grayBuffer;
if(IsFailed(r))
{
+ SetLastResult(r);
+ return false;
}
r = imBuf.EncodeToFile(imagepath, imageFormat, true);
if(IsFailed(r))
{
}
r = imBuf.EncodeToFile(imagepath, imageFormat, true);
if(IsFailed(r))
{
+ SetLastResult(r);
+ return false;