/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
}
default:
{
- DALI_LOG_ERROR("Unsupported pixel format for encoding to PNG.\n");
+ DALI_LOG_ERROR("Unsupported pixel format for encoding to PNG. Format enum : [%d]\n", pixelFormat);
return false;
}
}
const int interlace = PNG_INTERLACE_NONE;
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if(!png_ptr)
+ if(DALI_UNLIKELY(!png_ptr))
{
+ DALI_LOG_ERROR("Fail to create png_structp for png version" PNG_LIBPNG_VER_STRING "\n");
return false;
}
/* Allocate/initialize the image information data. REQUIRED */
png_infop info_ptr = png_create_info_struct(png_ptr);
- if(!info_ptr)
+ if(DALI_UNLIKELY(!info_ptr))
{
+ DALI_LOG_ERROR("Fail to create png_infop\n");
png_destroy_write_struct(&png_ptr, NULL);
return false;
}
/* Set error handling. REQUIRED if you aren't supplying your own
* error handling functions in the png_create_write_struct() call.
*/
- if(setjmp(png_jmpbuf(png_ptr)))
+ if(DALI_UNLIKELY(setjmp(png_jmpbuf(png_ptr))))
{
+ DALI_LOG_ERROR("Fail to png_jmpbuf\n");
png_destroy_write_struct(&png_ptr, &info_ptr);
return false;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
{
result = true;
}
+ else
+ {
+ const int bufferLength = 128;
+ char buffer[bufferLength];
+
+ // Return type of stderror_r is different between system type. We should not use return value.
+ [[maybe_unused]] auto ret = strerror_r(errno, buffer, bufferLength - 1);
+
+ DALI_LOG_ERROR("Can't write to %s: buffer length : %d, error message : [%s]\n", filename.c_str(), length, buffer);
+ }
}
return result;