A method with return type size_t returns negative value
Jing Lv
lvjing at linux.vnet.ibm.com
Tue Nov 15 08:09:57 UTC 2011
Hello,
I search the E:\workspace\openjdk\jdk\src\windows\native but find
nothing similar (please tell me if I miss something), so I suggest we
have a quick fix for now, like:
--- E:\workspace\openjdk\jdk\src\windows\native\java\io\io_util_md.h~
2011-11-15 15:53:21.000000000 +0800
+++ E:\workspace\openjdk\jdk\src\windows\native\java\io\io_util_md.h
2011-11-15 15:56:27.000000000 +0800
@@ -36,14 +36,14 @@
WCHAR* currentDir(int di);
int currentDirLength(const WCHAR* path, int pathlen);
void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid,
int flags);
int handleAvailable(jlong fd, jlong *pbytes);
JNIEXPORT int handleSync(jlong fd);
int handleSetLength(jlong fd, jlong length);
-JNIEXPORT size_t handleRead(jlong fd, void *buf, jint len);
-JNIEXPORT size_t handleWrite(jlong fd, const void *buf, jint len);
+JNIEXPORT SSIZE_T handleRead(jlong fd, void *buf, jint len);
+JNIEXPORT SSIZE_T handleWrite(jlong fd, const void *buf, jint len);
jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
jlong handleLseek(jlong fd, jlong offset, jint whence);
/*
* Returns an opaque handle to file named by "path". If an error occurs,
* returns -1 and an exception is pending.
--- E:\workspace\openjdk\jdk\src\windows\native\java\io\io_util_md.c~
2011-11-15 16:02:55.000000000 +0800
+++ E:\workspace\openjdk\jdk\src\windows\native\java\io\io_util_md.c
2011-11-15 16:03:08.000000000 +0800
@@ -484,13 +484,13 @@
}
if (SetEndOfFile(h) == FALSE) return -1;
return 0;
}
JNIEXPORT
-size_t
+SSIZE_T
handleRead(jlong fd, void *buf, jint len)
{
DWORD read = 0;
BOOL result = 0;
HANDLE h = (HANDLE)fd;
if (h == INVALID_HANDLE_VALUE) {
@@ -509,13 +509,13 @@
return -1;
}
return read;
}
JNIEXPORT
-size_t
+SSIZE_T
handleWrite(jlong fd, const void *buf, jint len)
{
BOOL result = 0;
DWORD written = 0;
HANDLE h = (HANDLE)fd;
if (h != INVALID_HANDLE_VALUE) {
I will put it on the bug system.
On 2011/11/9 16:57, Jing Lv wrote:
> Hello Alan,
>
> (Sorry that haven't check this for months) I check with the bug
> 7030624 but see no progress now. What's the current status? Shall we
> go on with a simple patch to fix the problem?
>
>
> On 2011/7/21 21:32, Alan Bateman wrote:
>> Jing LV wrote:
>>> Ping, anyone notice this? :)
>>> My plan is that we'd search all source to find all kinds of such
>>> issues, and then refine them in a uniform solution. If jint is not
>>> good enough, how about ssize_t?
>> ACK, saw your mails and will get back to you soon on this.
>>
>> -Alan
>
More information about the core-libs-dev
mailing list