A method with return type size_t returns negative value
Alan.Bateman at oracle.com
Wed Mar 23 03:23:37 PDT 2011
Jing LV wrote:
> 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.
More information about the core-libs-dev