[graphics/krita/krita/4.3] plugins/impex/exr: Attempt to account for OpenExrFile's new way of handling utf-8 filenames

Boudewijn Rempt null at kde.org
Sat Nov 21 09:27:35 GMT 2020


Git commit b67d0aacd6a7686e3791c5b2352dd0e55e2d7123 by Boudewijn Rempt.
Committed on 21/11/2020 at 09:27.
Pushed by rempt into branch 'krita/4.3'.

Attempt to account for OpenExrFile's new way of handling utf-8 filenames

See https://github.com/AcademySoftwareFoundation/openexr/issues/292 ,
https://github.com/AcademySoftwareFoundation/openexr/blob/master/src/lib/OpenEXR/ImfStdIO.cpp#L116
and https://forum.kde.org/viewtopic.php?f=139&t=168870&p=440067#p440067

We need to be aware, though, that this still might blow up on us.

CCMAIL:kimageshop at kde.org
(cherry picked from commit eb884934d1434f61189d552df7ae627f057fd702)

M  +5    -5    plugins/impex/exr/exr_converter.cc

https://invent.kde.org/graphics/krita/commit/b67d0aacd6a7686e3791c5b2352dd0e55e2d7123

diff --git a/plugins/impex/exr/exr_converter.cc b/plugins/impex/exr/exr_converter.cc
index 29aee31f15..604804d33c 100644
--- a/plugins/impex/exr/exr_converter.cc
+++ b/plugins/impex/exr/exr_converter.cc
@@ -566,7 +566,7 @@ bool EXRConverter::Private::checkExtraLayersInfoConsistent(const QDomDocument &d
 KisImportExportErrorCode EXRConverter::decode(const QString &filename)
 {
     try {
-        Imf::InputFile file(QFile::encodeName(filename));
+        Imf::InputFile file(filename.toUtf8());
 
         Imath::Box2i dw = file.header().dataWindow();
         Imath::Box2i displayWindow = file.header().displayWindow();
@@ -1125,7 +1125,7 @@ KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisPai
 
     // Open file for writing
     try {
-        Imf::OutputFile file(QFile::encodeName(filename), header);
+        Imf::OutputFile file(filename.toUtf8(), header);
 
         QList<ExrPaintLayerSaveInfo> informationObjects;
         informationObjects.push_back(info);
@@ -1134,7 +1134,7 @@ KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisPai
 
     } catch(std::exception &e) {
         dbgFile << "Exception while writing to exr file: " << e.what();
-        if (!KisImportExportAdditionalChecks::isFileWritable(QFile::encodeName(filename))) {
+        if (!KisImportExportAdditionalChecks::isFileWritable(filename.toUtf8())) {
             return ImportExportCodes::NoAccessToWrite;
         }
         return ImportExportCodes::ErrorWhileWriting;
@@ -1377,12 +1377,12 @@ KisImportExportErrorCode EXRConverter::buildFile(const QString &filename, KisGro
 
         // Open file for writing
         try {
-            Imf::OutputFile file(QFile::encodeName(filename), header);
+            Imf::OutputFile file(filename.toUtf8(), header);
             encodeData(file, informationObjects, width, height);
             return ImportExportCodes::OK;
         } catch(std::exception &e) {
             dbgFile << "Exception while writing to exr file: " << e.what();
-            if (!KisImportExportAdditionalChecks::isFileWritable(QFile::encodeName(filename))) {
+            if (!KisImportExportAdditionalChecks::isFileWritable(filename.toUtf8())) {
                 return ImportExportCodes::NoAccessToWrite;
             }
             return ImportExportCodes::ErrorWhileWriting;


More information about the kimageshop mailing list