Merge "Use FileStream API in gltf-loader." into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 11 Jul 2019 17:39:05 +0000 (17:39 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 11 Jul 2019 17:39:05 +0000 (17:39 +0000)
dali-toolkit/internal/controls/scene3d-view/gltf-loader.cpp

index e1d9d34..0f69edc 100644 (file)
@@ -22,7 +22,7 @@
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
-#include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <dali/devel-api/adaptor-framework/file-stream.h>
 
 namespace Dali
 {
@@ -236,21 +236,19 @@ void FitBuffer( Dali::Vector<Vector4>& bufferDestination, Dali::Vector<T>& buffe
 template <typename T>
 bool ReadBinFile( Vector<T> &dataBuffer, std::string url, int32_t offset, int32_t count )
 {
-  std::streampos bufferSize = 0;
-  Dali::Vector<char> fileBuffer;
-  if( !Dali::FileLoader::ReadFile( url, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) )
+  Dali::FileStream fileStream( url, FileStream::READ || FileStream::BINARY );
+  FILE* fp = fileStream.GetFile();
+  if( !fp )
   {
     return false;
   }
 
-  FILE* fp = fmemopen( &fileBuffer[0], bufferSize, "rb" );
   dataBuffer.Resize( count );
   ssize_t result = -1;
   if( !fseek( fp, offset, SEEK_SET ) )
   {
     result = fread( &dataBuffer[0], sizeof( T ), count, fp );
   }
-  fclose( fp );
 
   return ( result >= 0 );
 }