Enable -Wold-style-cast in Adaptor
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / image-loaders / loader-astc.cpp
index 67b1ff5..bddf954 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -122,11 +122,11 @@ Pixel::Format GetAstcPixelFormat( AstcFileHeader& header )
  * @param[out] fileHeader  This will be populated with the header data
  * @return                 True if the file is valid, false otherwise
  */
-bool LoadAstcHeader( FILE * const filePointer, unsigned int &width, unsigned int &height, AstcFileHeader &fileHeader )
+bool LoadAstcHeader( FILE * const filePointer, unsigned int& width, unsigned int& height, AstcFileHeader& fileHeader )
 {
   // Pull the bytes of the file header in as a block:
-  unsigned int readLength = sizeof( AstcFileHeader );
-  if( fread( (void*)&fileHeader, 1, readLength, filePointer ) != readLength )
+  const unsigned int readLength = sizeof( AstcFileHeader );
+  if( fread( &fileHeader, 1, readLength, filePointer ) != readLength )
   {
     return false;
   }
@@ -174,7 +174,7 @@ bool LoadAstcHeader( const ImageLoader::Input& input, unsigned int& width, unsig
 }
 
 // File loading API entry-point:
-bool LoadBitmapFromAstc( const ResourceLoadingClient& client, const ImageLoader::Input& input, Integration::Bitmap& bitmap )
+bool LoadBitmapFromAstc( const ImageLoader::Input& input, Integration::Bitmap& bitmap )
 {
   FILE* const filePointer = input.file;
   if( !filePointer )
@@ -202,14 +202,24 @@ bool LoadBitmapFromAstc( const ResourceLoadingClient& client, const ImageLoader:
   }
 
   // Retrieve the file size.
-  fseek( filePointer, 0L, SEEK_END );
+  if( fseek( filePointer, 0L, SEEK_END ) )
+  {
+    DALI_LOG_ERROR( "Could not seek through file.\n" );
+    return false;
+  }
+
   off_t fileSize = ftell( filePointer );
   if( fileSize == -1L )
   {
     DALI_LOG_ERROR( "Could not determine ASTC file size.\n" );
     return false;
   }
-  fseek( filePointer, sizeof( AstcFileHeader ), SEEK_SET );
+
+  if( fseek( filePointer, sizeof( AstcFileHeader ), SEEK_SET ) )
+  {
+    DALI_LOG_ERROR( "Could not seek through file.\n" );
+    return false;
+  }
 
   // Data size is file size - header size.
   size_t imageByteCount = fileSize - sizeof( AstcFileHeader );