diff options
Diffstat (limited to 'indra/llimage')
| -rw-r--r-- | indra/llimage/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | indra/llimage/llimage.cpp | 36 | ||||
| -rw-r--r-- | indra/llimage/llimage.h | 3 | ||||
| -rw-r--r-- | indra/llimage/llimagedimensionsinfo.cpp | 2 | ||||
| -rw-r--r-- | indra/llimage/llimagetga.cpp | 2 |
5 files changed, 43 insertions, 4 deletions
diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt index 3abc85954b..90199faa46 100644 --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -77,6 +77,10 @@ endif() include(LibraryInstall) +if (USE_PRECOMPILED_HEADERS) + target_precompile_headers(llimage REUSE_FROM llprecompiled) +endif () + # Add tests if (LL_TESTS) SET(llimage_TEST_SOURCE_FILES diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 35bc7065b1..b4d34f536c 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -2048,6 +2048,25 @@ file_extensions[] = { "dxt", IMG_CODEC_DXT }, { "png", IMG_CODEC_PNG } }; + +static struct +{ + const wchar_t* exten; + EImageCodec codec; +} +wide_file_extensions[] = +{ + { L"bmp", IMG_CODEC_BMP }, + { L"tga", IMG_CODEC_TGA }, + { L"j2c", IMG_CODEC_J2C }, + { L"jp2", IMG_CODEC_J2C }, + { L"texture", IMG_CODEC_J2C }, + { L"jpg", IMG_CODEC_JPEG }, + { L"jpeg", IMG_CODEC_JPEG }, + { L"mip", IMG_CODEC_DXT }, + { L"dxt", IMG_CODEC_DXT }, + { L"png", IMG_CODEC_PNG } +}; #define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions) #if 0 static std::string find_file(std::string &name, S8 *codec) @@ -2068,7 +2087,8 @@ static std::string find_file(std::string &name, S8 *codec) return std::string(""); } #endif -EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) + +EImageCodec LLImageBase::getCodecFromExtension(std::string_view exten) { if (!exten.empty()) { @@ -2080,6 +2100,20 @@ EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) } return IMG_CODEC_INVALID; } + +EImageCodec LLImageBase::getCodecFromExtension(std::wstring_view exten) +{ + if (!exten.empty()) + { + for (int i = 0; i < (int)(NUM_FILE_EXTENSIONS); i++) + { + if (exten == wide_file_extensions[i].exten) + return wide_file_extensions[i].codec; + } + } + return IMG_CODEC_INVALID; +} + #if 0 bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only) { diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 1fb61673bd..8569c28528 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -159,7 +159,8 @@ public: // <= 0 priority means that there's no need for more data. static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent); - static EImageCodec getCodecFromExtension(const std::string& exten); + static EImageCodec getCodecFromExtension(std::string_view exten); + static EImageCodec getCodecFromExtension(std::wstring_view exten); //static LLTrace::MemStatHandle sMemStat; diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c896d60c85..2ae7760d4c 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -166,7 +166,7 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() { sJpegErrorEncountered = false; clean(); - FILE* fp = LLFile::fopen(mSrcFilename, "rb"); + FILE* fp = LLFile::fopen(mSrcFilename, LLFILE_MODE("rb")); if (!fp) { setLastError("Unable to open file for reading", mSrcFilename); diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index 25232b77aa..7b09553974 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -1191,7 +1191,7 @@ bool LLImageTGA::loadFile( const std::string& path ) return false; } - LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ + LLFILE* file = LLFile::fopen(path, LLFILE_MODE("rb")); /* Flawfinder: ignore */ if( !file ) { LL_WARNS() << "Couldn't open file " << path << LL_ENDL; |
