Aleksander Morgado wrote: > 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. > Thats probably a good plan. Though I'll have to think about it further. My gut feeling right now is that its good.
> > * 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 > Thats a question for Jose because I'm pretty sure he wrote that portion. > > * 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 > Think Jose wrote that, but good catch no less. I hope we aren't reading PDF's that big though :-| (haha). > > BTW, the unit tests to test the Disk Filesystem are the generic ones > that Hans is doing, right? FS#24? > Think so, it interfaces with the "Filesystem" interface, not actually the disk filesystem implementation which is the default. -Zac
