On 10/16/21 17:15, Thibaut Cuvelier wrote:
Dear list,
In my last patch (21366155), I added a dependency from InsetText to Qt
to be able to generate SHA hashes. The main goal is to have an
almost-collision-free name-generation technique, which is a great
useability enhancement, that's why I already pushed the patch.
Collisions would be awful, because two different insets would have the
same file name.
I don't think Bernstein's hash (in Author.cpp) would fit the bill: it
doesn't go to great lengths to avoid collisions (it has a lot for
strings:
https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed).
UUID/GUID are mostly time-based or use cryptographic hash functions:
they do not really depend on the content, but mostly on time, and I
need that the file names remain constant in time (unless the LaTeX
code that is compiled gets changed).
CityHash would be enough, but that's another dependency to add to LyX
(https://github.com/google/cityhash).
The only solution I found without importing a large new dependency
into LyX was to use Qt's QCryptographicHash, just like
support/FileName.cpp. I know that LyX tries to have clear boundaries
for dependencies, that's why I'm bringing the question to the list. Is
the current solution acceptable? Maybe move some of the code to
support/FileName.cpp?
Basically, the rule is to keep Qt dependencies that aren't in the
frontend in support. Just put some wrapper function in there, and
that'll be fine. Maybe in support/filetools?
Riki
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel