X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Ffile-loader.cpp;h=e4a2030c32779043de9a002820c1d65442dead3c;hb=f32f04052accfe880a9141d554091d4cfe922d47;hp=b63b5c7c4ad83f1fdf95a93c5fc696a4c72d1b4e;hpb=9b1765f8a352f63cc78fae36f28ed23d05b6e942;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/devel-api/adaptor-framework/file-loader.cpp b/dali/devel-api/adaptor-framework/file-loader.cpp index b63b5c7..e4a2030 100644 --- a/dali/devel-api/adaptor-framework/file-loader.cpp +++ b/dali/devel-api/adaptor-framework/file-loader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -18,26 +18,33 @@ #include // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include +#include namespace Dali { +namespace +{ +// limit maximum image down load size to 50 MB +const size_t MAXIMUM_DOWNLOAD_IMAGE_SIZE = 50 * 1024 * 1024; + +} // namespace namespace FileLoader { - -int ReadFile(const std::string& filename, Dali::Vector & memblock, FileLoader::FileType fileType) +int ReadFile(const std::string& filename, Dali::Vector& memblock, FileLoader::FileType fileType) { - return Dali::Internal::Adaptor::ReadFile( filename, memblock, fileType ); + return Dali::Internal::Adaptor::ReadFile(filename, memblock, fileType); } int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector& memblock, FileLoader::FileType fileType) { - return Dali::Internal::Adaptor::ReadFile( filename, fileSize, memblock, fileType );; + return Dali::Internal::Adaptor::ReadFile(filename, fileSize, memblock, fileType); + ; } std::streampos GetFileSize(const std::string& filename) @@ -45,6 +52,12 @@ std::streampos GetFileSize(const std::string& filename) return Dali::Internal::Adaptor::GetFileSize(filename); } -} //FileLoader +bool DownloadFileSynchronously(const std::string& filename, Dali::Vector& dataBuffer) +{ + size_t dataSize; + return TizenPlatform::Network::DownloadRemoteFileIntoMemory(filename, dataBuffer, dataSize, MAXIMUM_DOWNLOAD_IMAGE_SIZE); +} + +} // namespace FileLoader -} //Dali +} // namespace Dali