Code review request "6402006: FileInputStream.available() returns negative values when reading a large file"
mike.duigou at oracle.com
Fri Nov 19 00:55:42 UTC 2010
Would it be possible to call GetFileSizeEx() (or add a call to GetLastError())
> Note that if the return value is INVALID_FILE_SIZE (0xffffffff), an application must call GetLastError to determine whether the function has succeeded or failed. The reason the function may appear to fail when it has not is that lpFileSizeHigh could be non-NULL or the file size could be 0xffffffff. In this case, GetLastError will return NO_ERROR (0) upon success. Because of this behavior, it is recommended that you use GetFileSizeEx instead.
There is a similar problem for for SetFilePosition():
> Note Because INVALID_SET_FILE_POINTER is a valid value for the low-order DWORD of the new file pointer, you must check both the return value of the function and the error code returned by GetLastError to determine whether or not an error has occurred. If an error has occurred, the return value of SetFilePointer is INVALID_SET_FILE_POINTER and GetLastError returns a value other than NO_ERROR. For a code example that demonstrates how to check for failure, see the Remarks section in this topic.
On Nov 18 2010, at 13:43 , Mandy Chung wrote:
> 6402006 FileInputStream.available() returns negative values when reading a large file
> Webrev at:
> This fixes a bug in the windows implementation of io_util.c that ignores the high-order doubleword of the file size in computing the end of the file. Thus the available() method incorrectly returns only the low-order 32-bit for large files.
More information about the core-libs-dev