Commit 9251e439 authored by rswindell's avatar rswindell
Browse files

Replace ERROR_VALUE (socket error number) usage with COM_ERROR_VALUE

It appears when this module was created it was copied from js_socket.c and
the use of ERROR_VALUE (which is socket-specific on Windows) was not corrected.
parent ee777866
......@@ -116,7 +116,7 @@ js_close(JSContext *cx, uintN argc, jsval *arglist)
rc=JS_SUSPENDREQUEST(cx);
comClose(p->com);
p->last_error = ERROR_VALUE;
p->last_error = COM_ERROR_VALUE;
dbprintf(FALSE, p, "closed");
......@@ -146,8 +146,8 @@ js_open(JSContext *cx, uintN argc, jsval *arglist)
p->com=comOpen(p->dev);
if(p->com==COM_HANDLE_INVALID) {
p->last_error=ERROR_VALUE;
dbprintf(TRUE, p, "connect failed with error %d",ERROR_VALUE);
p->last_error=COM_ERROR_VALUE;
dbprintf(TRUE, p, "connect failed with error %d", p->last_error);
JS_SET_RVAL(cx, arglist, JSVAL_FALSE);
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
......@@ -192,7 +192,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
dbprintf(FALSE, p, "sent %u bytes",len);
JS_SET_RVAL(cx, arglist, JSVAL_TRUE);
} else {
p->last_error=ERROR_VALUE;
p->last_error=COM_ERROR_VALUE;
dbprintf(TRUE, p, "send of %u bytes failed",len);
}
if(cp)
......@@ -256,7 +256,7 @@ js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
dbprintf(FALSE, p, "sent %u bytes",len);
JS_SET_RVAL(cx, arglist, JSVAL_TRUE);
} else {
p->last_error=ERROR_VALUE;
p->last_error=COM_ERROR_VALUE;
dbprintf(TRUE, p, "send of %u bytes failed",len);
}
free(buf);
......@@ -321,7 +321,7 @@ js_sendbin(JSContext *cx, uintN argc, jsval *arglist)
dbprintf(FALSE, p, "sent %u bytes (binary)",size);
JS_SET_RVAL(cx, arglist, JSVAL_TRUE);
} else {
p->last_error=ERROR_VALUE;
p->last_error=COM_ERROR_VALUE;
dbprintf(TRUE, p, "send of %u bytes (binary) failed",size);
}
......@@ -367,7 +367,7 @@ js_recv(JSContext *cx, uintN argc, jsval *arglist)
len = comReadBuf(p->com,buf,len,NULL,timeout);
JS_RESUMEREQUEST(cx, rc);
if(len<0) {
p->last_error=ERROR_VALUE;
p->last_error=COM_ERROR_VALUE;
free(buf);
JS_SET_RVAL(cx, arglist, JSVAL_NULL);
return(JS_TRUE);
......@@ -441,7 +441,7 @@ js_recvline(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, STRING_TO_JSVAL(str));
rc=JS_SUSPENDREQUEST(cx);
dbprintf(FALSE, p, "received %u bytes (recvline) lasterror=%d"
,i,ERROR_VALUE);
,i,COM_ERROR_VALUE);
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
......@@ -500,7 +500,7 @@ js_recvbin(JSContext *cx, uintN argc, jsval *arglist)
}
if(rd!=size)
p->last_error=ERROR_VALUE;
p->last_error=COM_ERROR_VALUE;
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment