Yes, the fact that this code _is not used_, provided that you use Qt4.4.
And we _will_ use Qt4.4 on Windows for 1.6.x. This code is meant to
disappear when we finally switch to 4.4, but this is not very important.
The other issue is much more important.
Yes, I know that. I can fully understand the code. But I still insist that
the function Filename::Private::checksum() should belong to Filename
class, _not_ Filename::Private class, no matter for Qt 4.4 or 4.3
I see no reason this function must be put in Filename::Private.
Certainly I'm open for this problem. May you address your reason
to put it in Filename::Private?
I have made the patch and tested. I moved your function to Filename
class and renamed to checksum_real().
As I said, those mofification are irrelevant for 1.6 on Windows. You
also moved the rest of the code outside the #ifdef for Qt which I've put
them explicitly so that it is still checked to compile even if you use
Qt4.4.
I can't understand your idea. Your original code will have _two_
methods linked in the executable if compiled with Qt 4.4
It reads as:
unsigned long FileName::checksum_real() const
{
#if QT_VERSION >= 0x040400
//method for Qt 4.4
#endif
//the two other methods for Qt 4.3
}
I believe this is an error. You have a return statement at the end
of the Qt 4.4 method block, so the following code wont be
executed under Qt 4.4. But the code will still exist in the
executable file. I modified it as:
unsigned long FileName::checksum_real() const
{
#if QT_VERSION >= 0x040400
//method for Qt 4.4
#else
//the two other methods for Qt 4.3
#endif //QT_VERSION >= 0x040400
}
You can see, I never move the code outside the #ifdef.
I just completed your incomplete #ifdef.
I have tested with both Qt 4.3 and 4.4 under Windows XP.
With my patch LyX can properly handle filenames with non-ASCII chars.
I will test whether Qt 4.4 will work withour my patch.
I am moving this discussion to the development list as this needs the
input of others. As I say in bugzilla, I don't know what to do with this
patch. I suspect that we might achieve the same functionality using
iconv in a cross-platform way, but I am not sure and don't really have
the time to investigate. Anyone who knows something about this, please
chime in.
Since this is on devel list now, I may need to say something more clear.
Firstly, I think this patch should _not_ go into 1.6. It may be go into
the next version or not, we need to discuss it. But 1.6 is not suitable
as it is not a significant patch.
Secondly, I strongly against the method of using mmap to compute
checksum. I suggest to use standard C file IO to read the file data with
block buffer around 64KB~16MB. mmap has different interface
on different system. It's performance is not significantly higher
than the standard file IO with proper block buffer. I see no
reason to use it at this specific situation.