summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2026-08-11 21:39:19 -0400
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2026-08-11 21:39:19 -0400
commit8cabc33e960ca93fdc1a32c77cf611269d95d51b (patch)
tree931fcecac10bf73214efa07cc3d704ba2bd01272 /indra/llimage
parent9b7ab49575b54523128952af6686d17eb6696725 (diff)
parentd045f9aa32789a35628aced166145c182751acbf (diff)
Merge remote-tracking branch 'origin/develop-linux' into geenz/linux-to-develop
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/CMakeLists.txt4
-rw-r--r--indra/llimage/llimage.cpp36
-rw-r--r--indra/llimage/llimage.h3
-rw-r--r--indra/llimage/llimagedimensionsinfo.cpp2
-rw-r--r--indra/llimage/llimagetga.cpp2
5 files changed, 43 insertions, 4 deletions
diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt
index cc75c463bc..a81808343f 100644
--- a/indra/llimage/CMakeLists.txt
+++ b/indra/llimage/CMakeLists.txt
@@ -63,6 +63,10 @@ target_link_libraries(llimage
ll::libjpeg
)
+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;