/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Internal::Platform::FileReader fileReader(url);
FILE* const fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::Devel::PixelBuffer bitmap;
bool success = TizenPlatform::ImageLoader::ConvertStreamToBitmap(resourceType, url, fp, bitmap);
return bitmap;
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return Dali::Devel::PixelBuffer();
}
Internal::Platform::FileReader fileReader(url);
FILE* const fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
TizenPlatform::ImageLoader::ConvertStreamToPlanes(resourceType, url, fp, buffers);
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
}
Devel::PixelBuffer LoadImageFromBuffer(const Dali::Vector<uint8_t>& buffer, ImageDimensions size, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection)
Internal::Platform::FileReader fileReader(buffer);
FILE* const fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::Devel::PixelBuffer bitmap;
// Make path as empty string. Path information just for file format hint.
return bitmap;
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return Dali::Devel::PixelBuffer();
}
Internal::Platform::FileReader fileReader(buffer, bufferSize);
FILE* const fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::Devel::PixelBuffer bitmap;
// Make path as empty string. Path information just for file format hint.
return bitmap;
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return Dali::Devel::PixelBuffer();
}
if(succeeded)
{
size_t blobSize = dataBuffer.Size();
- DALI_ASSERT_DEBUG(blobSize > 0U);
- if(blobSize > 0U)
+ if(DALI_LIKELY(blobSize > 0U))
{
// Open a file handle on the memory buffer:
Dali::Internal::Platform::FileReader fileReader(dataBuffer, blobSize);
FILE* const fp = fileReader.GetFile();
- if(NULL != fp)
+ if(DALI_LIKELY(NULL != fp))
{
Dali::Devel::PixelBuffer bitmap;
bool result = TizenPlatform::ImageLoader::ConvertStreamToBitmap(
DALI_LOG_WARNING("Unable to decode bitmap supplied as in-memory blob.\n");
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
}
+ else
+ {
+ DALI_LOG_ERROR("Error download empty buffer!\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error download failed!\n");
}
return Dali::Devel::PixelBuffer();
}
FILE* fp = fileReader.GetFile();
if(DALI_UNLIKELY(fp == NULL))
{
+ DALI_LOG_ERROR("Error reading file\n");
return false;
}
if(DALI_UNLIKELY(fseek(fp, 0, SEEK_END) <= -1))
{
+ DALI_LOG_ERROR("Error seeking within file\n");
return false;
}
length = ftell(fp);
if(DALI_UNLIKELY(length <= -1))
{
+ DALI_LOG_ERROR("Could not determine GIF file size.\n");
return false;
}
}
else
{
+ DALI_LOG_ERROR("Error seeking within file\n");
return false;
}
return true;
DALI_LOG_ERROR("Error reading file\n");
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error download empty buffer!\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error download failed!\n");
}
return succeeded;
size_t read = fread(magic, sizeof(unsigned char), MAGIC_LENGTH, fp);
// Reset to the start of the file.
- if(fseek(fp, 0, SEEK_SET))
+ if(DALI_UNLIKELY(fseek(fp, 0, SEEK_SET)))
{
DALI_LOG_ERROR("Error seeking to start of file\n");
}
}
// Reset to the start of the file.
- if(fseek(fp, 0, SEEK_SET))
+ if(DALI_UNLIKELY(fseek(fp, 0, SEEK_SET)))
{
DALI_LOG_ERROR("Error seeking to start of file\n");
}
bool result = false;
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::ImageLoader::LoadBitmapFunction function;
Dali::ImageLoader::LoadPlanesFunction planeLoader;
DALI_LOG_ERROR("Image Decoder for %s unavailable\n", path.c_str());
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return result;
}
bool result = false;
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::ImageLoader::LoadBitmapFunction loader;
Dali::ImageLoader::LoadPlanesFunction planeLoader;
DALI_LOG_ERROR("Image Decoder for %s unavailable\n", path.c_str());
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return result;
}
Internal::Platform::FileReader fileReader(path);
FILE* const fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
bool success = ConvertStreamToBitmap(resource, path, fp, bitmap);
if(success && bitmap)
result.Reset(retval);
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
+ }
return result;
}
Internal::Platform::FileReader fileReader(filename);
FILE* fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::ImageLoader::LoadBitmapFunction loaderFunction;
Dali::ImageLoader::LoadPlanesFunction planeLoader;
DALI_LOG_ERROR("Image Decoder for %s unavailable\n", filename.c_str());
}
}
+ else
+ {
+ DALI_LOG_ERROR("Error reading file for %s\n", filename.c_str());
+ }
return ImageDimensions(width, height);
}
DALI_ASSERT_DEBUG(resourceBuffer);
Dali::RefCountedVector<uint8_t>* const encodedBlob = reinterpret_cast<Dali::RefCountedVector<uint8_t>*>(resourceBuffer.Get());
- if(encodedBlob != 0)
+ if(DALI_LIKELY(encodedBlob != 0))
{
- if(encodedBlob->GetVector().Size())
+ if(DALI_LIKELY(encodedBlob->GetVector().Size()))
{
// Open a file handle on the memory buffer:
Internal::Platform::FileReader fileReader(encodedBlob->GetVector());
FILE* fp = fileReader.GetFile();
- if(fp != NULL)
+ if(DALI_LIKELY(fp != NULL))
{
Dali::ImageLoader::LoadBitmapFunction loaderFunction;
Dali::ImageLoader::LoadPlanesFunction planeLoader;
DALI_LOG_ERROR("Image Decoder failed to read header for resourceBuffer\n");
}
}
+ else
+ {
+ DALI_LOG_ERROR("Image Decoder unavailable\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
}
}
+ else
+ {
+ DALI_LOG_ERROR("Image Buffer is empty size\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Image Buffer is nullptr\n");
}
return ImageDimensions(width, height);
}
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if(DALI_UNLIKELY(0u == fsize))
{
+ DALI_LOG_ERROR("Error ICO data size is zero!\n");
return false;
}
if(DALI_UNLIKELY(fsize < (ICO_FILE_HEADER + ICO_IMAGE_INFO_HEADER))) //6 + 16 + 40
{
+ DALI_LOG_ERROR("Error ICO data size is too small! (%ld < %u)!\n", fsize, static_cast<uint32_t>(ICO_FILE_HEADER + ICO_IMAGE_INFO_HEADER));
return false;
}
map.ResizeUninitialized(fsize);
unsigned short reserved, type, count;
if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &reserved)))
{
+ DALI_LOG_ERROR("Error ICO header.reserved decode failed!\n");
return false;
}
if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &type)))
{
+ DALI_LOG_ERROR("Error ICO header.type decode failed!\n");
return false;
}
if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &count)))
{
+ DALI_LOG_ERROR("Error ICO header.count decode failed!\n");
return false;
}
if(DALI_UNLIKELY(!((reserved == 0) &&
((type == ICON) || (type == CURSOR)) && (count != 0))))
{
+ DALI_LOG_ERROR("Error ICO header is invalid! (reserved : %hu, type : %hu, count : %hu)\n", reserved, type, count);
return false;
}
search = BIGGEST;
if(DALI_UNLIKELY(chosen.bmoffset == 0))
{
+ DALI_LOG_ERROR("Error ICO data is invalid!\n");
return false;
}
// Open a file handle on the memory buffer:
fileReader = std::make_unique<Internal::Platform::FileReader>(dataBuffer, mBufferSize);
}
+ else
+ {
+ DALI_LOG_ERROR("Error download empty buffer!\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error download failed!\n");
}
}
- if(fileReader)
+ if(DALI_LIKELY(fileReader))
{
fp = fileReader->GetFile();
}
{
if(DALI_UNLIKELY(fseek(fp, 0, SEEK_END) <= -1))
{
+ DALI_LOG_ERROR("Error seeking within file\n");
return false;
}
mBufferSize = ftell(fp);
mBufferSize = fread(mBuffer, sizeof(WebPByteType), mBufferSize, fp);
return true;
}
+ else
+ {
+ DALI_LOG_ERROR("Error seeking within file\n");
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error reading file\n");
}
return false;
}