summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-office/lyx/files/2.3.patches')
-rw-r--r--app-office/lyx/files/2.3.patches86
1 files changed, 86 insertions, 0 deletions
diff --git a/app-office/lyx/files/2.3.patches b/app-office/lyx/files/2.3.patches
index c2b2407..b5aeabc 100644
--- a/app-office/lyx/files/2.3.patches
+++ b/app-office/lyx/files/2.3.patches
@@ -216,3 +216,89 @@ index df20f7b285..34a1b87721 100644
if (prefixIs(token, "LaTeX Warning:") ||
prefixIs(token, "! pdfTeX warning")) {
+diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
+index 88ee9a0320..a3ea0e141a 100644
+--- a/src/insets/InsetGraphics.cpp
++++ b/src/insets/InsetGraphics.cpp
+@@ -580,7 +580,7 @@ copyToDirIfNeeded(DocFileName const & file, string const & dir)
+ if (rtrim(only_path, "/") == rtrim(dir, "/"))
+ return make_pair(IDENTICAL_PATHS, FileName(file_in));
+
+- string mangled = file.mangledFileName();
++ string mangled = file.mangledFileName(empty_string(), false, true);
+ if (theFormats().isZippedFile(file)) {
+ // We need to change _eps.gz to .eps.gz. The mangled name is
+ // still unique because of the counter in mangledFileName().
+diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp
+index df5b443381..f5a67af3cf 100644
+--- a/src/support/FileName.cpp
++++ b/src/support/FileName.cpp
+@@ -22,6 +22,7 @@
+ #include "support/Package.h"
+ #include "support/qstring_helpers.h"
+
++#include <QCryptographicHash>
+ #include <QDateTime>
+ #include <QDir>
+ #include <QFile>
+@@ -942,6 +943,11 @@ string DocFileName::outputFileName(string const & path) const
+
+
+ string DocFileName::mangledFileName(string const & dir) const
++{
++ return mangledFileName(dir, true, false);
++};
++
++string DocFileName::mangledFileName(string const & dir, bool use_counter, bool encrypt_path) const
+ {
+ // Concurrent access to these variables is possible.
+
+@@ -961,6 +967,19 @@ string DocFileName::mangledFileName(string const & dir) const
+ string mname = os::internal_path(name);
+ // Remove the extension.
+ mname = support::changeExtension(name, string());
++
++ if (encrypt_path) {
++ QString qname = toqstr(mname);
++#if QT_VERSION >= 0x050000
++ QByteArray hash = QCryptographicHash::hash(qname.toLocal8Bit(),QCryptographicHash::Sha256);
++#else
++ QByteArray hash = QCryptographicHash::hash(qname.toLocal8Bit(),QCryptographicHash::Sha1);
++#endif
++ hash = hash.toHex();
++ mname = fromqstr(QString(hash));
++ mname = mname + "_" + onlyFileName();
++ }
++
+ // The mangled name must be a valid LaTeX name.
+ // The list of characters to keep is probably over-restrictive,
+ // but it is not really a problem.
+@@ -980,9 +999,12 @@ string DocFileName::mangledFileName(string const & dir) const
+ // Prepend a counter to the filename. This is necessary to make
+ // the mangled name unique.
+ static int counter = 0;
+- ostringstream s;
+- s << counter++ << mname;
+- mname = s.str();
++
++ if (use_counter) {
++ ostringstream s;
++ s << counter++ << mname;
++ mname = s.str();
++ }
+
+ // MiKTeX's YAP (version 2.4.1803) crashes if the file name
+ // is longer than about 160 characters. MiKTeX's pdflatex
+diff --git a/src/support/FileName.h b/src/support/FileName.h
+index 3bfdf13f26..f46537ef33 100644
+--- a/src/support/FileName.h
++++ b/src/support/FileName.h
+@@ -290,6 +290,8 @@ public:
+ */
+ std::string
+ mangledFileName(std::string const & dir = empty_string()) const;
++ std::string
++ mangledFileName(std::string const & dir, bool use_counter, bool encrypt_path) const;
+
+ /// \return the absolute file name without its .gz, .z, .Z extension
+ std::string unzippedFileName() const;