use _wfopen in windows

This commit is contained in:
artemp 2014-06-24 11:40:04 +01:00
parent 8255163945
commit 45ba10e701

View file

@ -132,9 +132,9 @@ bool freetype_engine::register_font(std::string const& file_name)
bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library) bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library)
{ {
#ifdef _WINDOWS #ifdef _WINDOWS
FILE * file = fopen(mapnik::utf8_to_utf16(file_name).c_str(),"rb"); FILE * file = _wfopen(mapnik::utf8_to_utf16(file_name).c_str(),"rb");
#else #else
FILE * file = fopen(file_name.c_str(),"rb"); FILE * file = std::fopen(file_name.c_str(),"rb");
#endif #endif
if (file == nullptr) return false; if (file == nullptr) return false;
FT_Face face = 0; FT_Face face = 0;
@ -316,7 +316,12 @@ face_ptr freetype_engine::create_face(std::string const& family_name)
#ifdef MAPNIK_THREADSAFE #ifdef MAPNIK_THREADSAFE
mapnik::scoped_lock lock(mutex_); mapnik::scoped_lock lock(mutex_);
#endif #endif
#ifdef _WINDOWS
std::unique_ptr<std::FILE, int (*)(std::FILE *)> file(_wfopen(mapnik::utf8_to_utf16(itr->second.second).c_str(),"rb"), fclose);
#else
std::unique_ptr<std::FILE, int (*)(std::FILE *)> file(std::fopen(itr->second.second.c_str(),"rb"), std::fclose); std::unique_ptr<std::FILE, int (*)(std::FILE *)> file(std::fopen(itr->second.second.c_str(),"rb"), std::fclose);
#endif
if (file != nullptr) if (file != nullptr)
{ {
std::fseek(file.get(), 0, SEEK_END); std::fseek(file.get(), 0, SEEK_END);