c++11 - use std::unique_ptr instead of boost::scoped_array

(TODO  - consider storing unique_ptr's in memory_fonts_ and avoid constructing std::string)
This commit is contained in:
artemp 2014-06-23 17:31:47 +01:00
parent 284786ec16
commit f4acd06f84

View file

@ -324,9 +324,9 @@ face_ptr freetype_engine::create_face(std::string const& family_name)
if (file != nullptr) if (file != nullptr)
{ {
std::fseek(file.get(), 0, SEEK_END); std::fseek(file.get(), 0, SEEK_END);
unsigned long file_size = std::ftell(file.get()); std::size_t file_size = std::ftell(file.get());
std::fseek(file.get(), 0, SEEK_SET); std::fseek(file.get(), 0, SEEK_SET);
boost::scoped_array<char> buffer(new char[file_size]); std::unique_ptr<char[]> buffer(new char[file_size]);
std::fread(buffer.get(), file_size, 1, file.get()); std::fread(buffer.get(), file_size, 1, file.get());
auto result = memory_fonts_.insert(std::make_pair(itr->second.second, std::string(buffer.get(),file_size))); auto result = memory_fonts_.insert(std::make_pair(itr->second.second, std::string(buffer.get(),file_size)));
FT_Error error = FT_New_Memory_Face (library_, FT_Error error = FT_New_Memory_Face (library_,