Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6631362
Votes 0
Synopsis Nuke io_util_md.c:handleFileSizeFD (win)
Category java:classes_io
Reported Against
Release Fixed 7(b25)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 17-NOV-2007
Description
What's wrong with this function?

int
handleFileSizeFD(jlong fd, jlong *size)
{
    DWORD sizeLow = 0;
    DWORD sizeHigh = 0;
    HANDLE h = (HANDLE)fd;
    if (h == INVALID_HANDLE_VALUE) {
        return -1;
    }
    sizeLow = GetFileSize(h, &sizeHigh);
    if (sizeLow == ((DWORD)-1)) {
        if (GetLastError() != ERROR_SUCCESS) {
            return -1;
        }
    }
    return (((jlong)sizeHigh) << 32) | sizeLow;
}

Let's see...

The function tries to compute a 64-bit quantity to return,
but the return type is "int", unlikely to be able to hold 64-bits.

Meanwhile, the "size" argument provides a place where the 64-bit quantity
could be stored, but it is simply ignored.

Finally, the function is completely unused.  Good thing, that.

Let's put this code out of its misery.
Posted Date : 2007-11-17 20:11:54.0
Work Around
N/A
Evaluation
Agreed.

With the removal of this code, we can finally compile io_util_md.c
without any warnings.
Posted Date : 2007-11-17 20:11:54.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang