/*
- * Copyright (c) 2023 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.
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;
}
if(DALI_LIKELY(!fseek(fp, 0, SEEK_SET)))
{
- globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * length));
- length = fread(globalMap, sizeof(GifByteType), length, fp);
+ globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * static_cast<unsigned long long>(length)));
+ if(DALI_UNLIKELY(globalMap == nullptr))
+ {
+ DALI_LOG_ERROR("malloc is failed. request malloc size : %llu\n", sizeof(GifByteType) * static_cast<unsigned long long>(length));
+ return false;
+ }
+ length = fread(globalMap, sizeof(GifByteType), length, fp);
}
else
{
+ DALI_LOG_ERROR("Error seeking within file\n");
return false;
}
return true;
if(DALI_LIKELY(!fseek(fp, 0, SEEK_SET)))
{
globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * blobSize));
- length = fread(globalMap, sizeof(GifByteType), blobSize, fp);
- succeeded = true;
+ if(DALI_UNLIKELY(globalMap == nullptr))
+ {
+ DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", sizeof(GifByteType) * blobSize);
+ }
+ else
+ {
+ length = fread(globalMap, sizeof(GifByteType), blobSize, fp);
+ succeeded = true;
+ }
}
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 succeeded;
delete mImpl;
}
-Dali::Devel::PixelBuffer GifLoading::LoadFrame(uint32_t frameIndex)
+Dali::Devel::PixelBuffer GifLoading::LoadFrame(uint32_t frameIndex, ImageDimensions desiredSize)
{
int error;
Dali::Devel::PixelBuffer pixelBuffer;