A method with return type size_t returns negative value

Jing LV lvjing at linux.vnet.ibm.com
Thu Mar 24 07:33:24 UTC 2011

于 2011-3-23 18:23, Alan Bateman 写道:
> Jing LV wrote:
>> Hello,
>> I found a problem in windows/native/java/io/io_util_md.c, method
>> handleRead(). The return type of the method is size_t, which is defined
>> as unsigned int. However we see the method would return negative values
>> while it meets some error. This may be a problem as the API comsumer and
>> later developer may have misunderstand it. I suggest modify it to
>> ssize_t (or SSIZE_T as it is on windows).
>> Any comments?
> I suspect this just haven't been noticed before. I checked the 
> pre-OpenJDK history and these handle* functions have been returning 
> size_t since the code was changed from using C runtime functions to 
> win32 functions (in 2003). I don't think we have any resulting bugs 
> but it should be cleaned up so I'll create a bug to track it. I see 
> there are a few other places that have the same issue.
> -Alan.

Thanks Alan. Would you please tell me the bug number?

Best Regards,
Jimmy, Jing LV

More information about the core-libs-dev mailing list