[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pdf-devel] Disk filesystem module questions
From: |
Aleksander Morgado |
Subject: |
[pdf-devel] Disk filesystem module questions |
Date: |
Mon, 10 Nov 2008 22:02:48 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080925) |
Hi Jose & Zac,
I started to work in the Disk Filesystem to finish it, and I have a
couple of comments regarding pdf_fsys_disk_get_free_space (but I guess
some of them also apply to other functions):
* First thing in the function is calling pdf_fsys_get_host_path(),
which internally calls pdf_text_get_host(). After that call, we get a
host_path and a host_path_size. The problem is that it seems assumed in
the source code that the host encoded string is NUL-terminated, as the
host_path_size is no longer used. But this may be false. That string
is used in GetDiskFreeSpace() or statfs(), and both expect a
NUL-terminated string. For GetDiskFreeSpace, the NUL-terminated string
should really be a double-NUL terminated string "\0\0", as the expected
data is a Unicode string (in UTF-16BE). For statfs I guess it should be
UTF-8 encoded string. So, instead of getting the host-encoded
representation of the filepath, I think that we should get the
UTF-16BE-encoded representation in Windows and the UTF-8 representation
in Posix systems. Note that in Windows, you can also use
single-NUL-terminated ASCII path in the same function, if the path is
only composed of ASCII characters; but to do it correctly we should only
use the Unicode representation.
* GetVolumePathName (windows). I saw the #if 0 deactivating the usage of
GetVolumePathName in the code. Is it only deactivated because it's not
available in mingw? The provided approach won't work for UTF-16BE
encoded filesystem paths.
http://msdn.microsoft.com/en-us/library/aa364996(VS.85).aspx
* GetDiskFreeSpace (windows). From the info in MSDN: "The
GetDiskFreeSpace function cannot report volume sizes that are greater
than 2 gigabytes". We should use GetDiskFreeSpaceEx, which has a
different API.
http://msdn.microsoft.com/en-us/library/aa364937(VS.85).aspx
BTW, the unit tests to test the Disk Filesystem are the generic ones
that Hans is doing, right? FS#24?
Cheers,
-Aleksander
- [pdf-devel] Disk filesystem module questions,
Aleksander Morgado <=