Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 21233a7a authored by deuce's avatar deuce

Remove JS_NewNumberValue() usage (and now everything is broken).

parent 0e56b9d5
......@@ -572,7 +572,7 @@ BOOL js_add_file(JSContext* js_cx, JSObject* array,
if(!JS_SetProperty(js_cx, file, "credits", &val))
return(FALSE);
JS_NewNumberValue(js_cx,(jsdouble)time,&val);
val=DOUBLE_TO_JSVAL((double)time);
if(!JS_SetProperty(js_cx, file, "time", &val))
return(FALSE);
......
......@@ -625,7 +625,7 @@ static JSBool js_bbs_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
return(JS_FALSE);
*vp = STRING_TO_JSVAL(js_str);
} else
JS_NewNumberValue(cx,val,vp);
*vp = UINT_TO_JSVAL(val);
return(JS_TRUE);
}
......@@ -2857,7 +2857,7 @@ js_getnstime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx);
if(sbbs->inputnstime(&t)==true) {
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,t,rval);
*rval=DOUBLE_TO_JSVAL((double)t);
}
else
JS_RESUMEREQUEST(cx, rc);
......
......@@ -448,9 +448,7 @@ js_recvbin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if((rd=comReadBuf(p->com,(BYTE*)&l,size,NULL,timeout))==size) {
if(p->network_byte_order)
l=ntohl(l);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,l,rval);
rc=JS_SUSPENDREQUEST(cx);
*rval=UINT_TO_JSVAL(l);
}
break;
}
......@@ -597,9 +595,7 @@ static JSBool js_com_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
break;
case COM_PROP_BAUD_RATE:
baud_rate=comGetBaudRate(p->com);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,baud_rate,vp);
rc=JS_SUSPENDREQUEST(cx);
*vp=UINT_TO_JSVAL(baud_rate);
break;
case COM_PROP_DEVICE:
JS_RESUMEREQUEST(cx, rc);
......
......@@ -882,7 +882,7 @@ js_conio_gettext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
JS_RESUMEREQUEST(cx, rc);
array=JS_NewArrayObject(cx, 0, NULL);
for(i=0; i<size; i++) {
JS_NewNumberValue(cx, result[i], &val);
val=UINT_TO_JSVAL(result[i]);
if(!JS_SetElement(cx, array, i, &val)) {
free(result);
return(JS_FALSE);
......
......@@ -1448,7 +1448,7 @@ js_term_supports(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
rc=JS_SUSPENDREQUEST(cx);
flags=sbbs->term_supports();
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,flags,rval);
*rval=INT_TO_JSVAL(flags);
}
return(JS_TRUE);
......
......@@ -476,9 +476,7 @@ js_readbin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
*rval = INT_TO_JSVAL(*w);
break;
case sizeof(DWORD):
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,*l,rval);
rc=JS_SUSPENDREQUEST(cx);
*rval = UINT_TO_JSVAL(l);
break;
}
}
......@@ -496,7 +494,7 @@ js_readbin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
v = INT_TO_JSVAL(*(w++));
break;
case sizeof(DWORD):
JS_NewNumberValue(cx,*(l++),&v);
v=UINT_TO_JSVAL(l++);
break;
}
if(!JS_SetElement(cx, array, i, &v)) {
......@@ -561,8 +559,11 @@ static jsval get_value(JSContext *cx, char* value)
else if(!isdigit(*p))
break;
}
if(*p==0) {
JS_NewNumberValue(cx, f ? atof(value) : strtoul(value,NULL,10), &val);
if(*p==0) {
if(f)
val=DOUBLE_TO_JSVAL(atof(value));
else
val=DOUBLE_TO_JSVAL((double)strtoul(value,NULL,10));
return(val);
}
/* hexadecimal number? */
......@@ -571,7 +572,7 @@ static jsval get_value(JSContext *cx, char* value)
if(!isxdigit(*p))
break;
if(*p==0) {
JS_NewNumberValue(cx,strtoul(value,NULL,0),&val);
val=DOUBLE_TO_JSVAL((double)strtoul(value,NULL,0));
return(val);
}
}
......@@ -633,8 +634,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
rc=JS_SUSPENDREQUEST(cx);
dbl=iniReadFloat(p->fp,section,key,*JSVAL_TO_DOUBLE(dflt));
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx
,dbl,rval);
*rval=DOUBLE_TO_JSVAL(dbl);
break;
case JSVAL_OBJECT:
if((dflt_obj = JSVAL_TO_OBJECT(dflt))!=NULL && js_DateIsValid(cx, dflt_obj)) {
......@@ -669,7 +669,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
rc=JS_SUSPENDREQUEST(cx);
i=iniReadInteger(p->fp,section,key,i);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,i,rval);
*rval=INT_TO_JSVAL(i);
} else {
cstr=JS_GetStringBytes(JS_ValueToString(cx,dflt));
rc=JS_SUSPENDREQUEST(cx);
......@@ -1846,7 +1846,7 @@ static JSBool js_file_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
rc=JS_SUSPENDREQUEST(cx);
tt=fdate(p->name);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,tt,vp);
*vp=DOUBLE_TO_JSVAL((double)tt);
break;
case FILE_PROP_IS_OPEN:
*vp = BOOLEAN_TO_JSVAL(p->fp!=NULL);
......@@ -1874,7 +1874,7 @@ static JSBool js_file_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
rc=JS_SUSPENDREQUEST(cx);
lng=ftell(p->fp);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,(double)lng,vp);
*vp=DOUBLE_TO_JSVAL((double)lng);
}
else
*vp = INT_TO_JSVAL(-1);
......@@ -1886,13 +1886,13 @@ static JSBool js_file_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
else
lng = flength(p->name);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,(double)lng,vp);
*vp=DOUBLE_TO_JSVAL((double)lng);
break;
case FILE_PROP_ATTRIBUTES:
rc=JS_SUSPENDREQUEST(cx);
in=getfattr(p->name);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,in,vp);
*vp=INT_TO_JSVAL(in);
break;
case FILE_PROP_DEBUG:
*vp = BOOLEAN_TO_JSVAL(p->debug);
......@@ -1973,15 +1973,13 @@ static JSBool js_file_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
/* finalize */
switch(tiny) {
case FILE_PROP_CHKSUM:
JS_NewNumberValue(cx,sum,vp);
*vp=DOUBLE_TO_JSVAL((double)sum);
break;
case FILE_PROP_CRC16:
if(!JS_NewNumberValue(cx,c16,vp))
*vp=JSVAL_ZERO;
*vp=UINT_TO_JSVAL(c16);
break;
case FILE_PROP_CRC32:
if(!JS_NewNumberValue(cx,~c32,vp))
*vp=JSVAL_ZERO;
*vp=UINT_TO_JSVAL(c32);
break;
case FILE_PROP_MD5_HEX:
case FILE_PROP_MD5_B64:
......
......@@ -125,13 +125,11 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
return(NULL);
/* file_area.properties */
if(!JS_NewNumberValue(cx,cfg->min_dspace,&val))
return(NULL);
val=UINT_TO_JSVAL(cfg->min_dspace);
if(!JS_SetProperty(cx, areaobj, "min_diskspace", &val))
return(NULL);
if(!JS_NewNumberValue(cx,cfg->file_misc,&val))
return(NULL);
val=UINT_TO_JSVAL(cfg->file_misc);
if(!JS_SetProperty(cx, areaobj, "settings", &val))
return(NULL);
......@@ -369,8 +367,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
if(!JS_SetProperty(cx, dirobj, "data_dir", &val))
return(NULL);
if(!JS_NewNumberValue(cx,cfg->dir[d]->misc,&val))
return(NULL);
val=UINT_TO_JSVAL(cfg->dir[d]->misc);
if(!JS_SetProperty(cx, dirobj, "settings", &val))
return(NULL);
......
......@@ -76,10 +76,10 @@ static JSBool js_system_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
switch(tiny) {
case GLOB_PROP_SOCKET_ERRNO:
JS_NewNumberValue(cx,ERROR_VALUE,vp);
*vp=DOUBLE_TO_JSVAL(ERROR_VALUE);
break;
case GLOB_PROP_ERRNO:
JS_NewNumberValue(cx,errno,vp);
*vp=INT_TO_JSVAL(errno);
break;
case GLOB_PROP_ERRNO_STR:
if((js_str=JS_NewStringCopyZ(cx, strerror(errno)))==NULL)
......@@ -215,7 +215,7 @@ static jsval* js_CopyValue(JSContext* cx, jsval val, JSContext* new_cx, jsval* r
else if(JSVAL_IS_NUMBER(val)) {
jsdouble d;
if(JS_ValueToNumber(cx,val,&d))
JS_NewNumberValue(new_cx,d,rval);
*rval=DOUBLE_TO_JSVAL(d);
}
else {
JSString* str;
......@@ -525,7 +525,7 @@ js_mswait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
mswait(val);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,msclock()-start,rval);
*rval=UINT_TO_JSVAL(msclock()-start);
return(JS_TRUE);
}
......@@ -538,14 +538,14 @@ js_random(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if(argc)
JS_ValueToInt32(cx,argv[0],&val);
JS_NewNumberValue(cx,sbbs_random(val),rval);
*rval=INT_TO_JSVAL(sbbs_random(val));
return(JS_TRUE);
}
static JSBool
js_time(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JS_NewNumberValue(cx,time(NULL),rval);
*rval=UINT_TO_JSVAL(time(NULL));
return(JS_TRUE);
}
......@@ -613,7 +613,7 @@ js_crc32(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
cs=crc32(p,len);
rc=JS_SUSPENDREQUEST(cx);
JS_NewNumberValue(cx,cs,rval);
*rval=UINT_TO_JSVAL(cs);
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
}
......@@ -636,7 +636,7 @@ js_chksum(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
while(len--) sum+=*(p++);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,sum,rval);
*rval=DOUBLE_TO_JSVAL((double)sum);
return(JS_TRUE);
}
......@@ -2508,7 +2508,7 @@ js_fattr(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx);
attr=getfattr(p);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,attr,rval);
*rval=INT_TO_JSVAL(attr);
return(JS_TRUE);
}
......@@ -2528,7 +2528,7 @@ js_fdate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx);
fd=fdate(p);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,fd,rval);
*rval=DOUBLE_TO_JSVAL((double)fd);
return(JS_TRUE);
}
......@@ -2584,7 +2584,7 @@ js_flength(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx);
fl=flength(p);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,(double)fl,rval);
*rval=DOUBLE_TO_JSVAL((double)fl);
return(JS_TRUE);
}
......@@ -2763,7 +2763,7 @@ js_freediskspace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
rc=JS_SUSPENDREQUEST(cx);
fd=getfreediskspace(p,unit);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,fd,rval);
*rval=DOUBLE_TO_JSVAL((double)fd);
return(JS_TRUE);
}
......@@ -2788,7 +2788,7 @@ js_disksize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx);
ds=getdisksize(p,unit);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,ds,rval);
*rval=DOUBLE_TO_JSVAL((double)ds);
return(JS_TRUE);
}
......@@ -3076,7 +3076,7 @@ js_flags_str(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if((p=JS_GetStringBytes(JSVAL_TO_STRING(argv[0])))==NULL)
return(JS_FALSE);
JS_NewNumberValue(cx,aftol(p),rval);
*rval=DOUBLE_TO_JSVAL((double)aftol(p));
return(JS_TRUE);
}
......
......@@ -84,32 +84,32 @@ static JSBool js_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
*vp=BOOLEAN_TO_JSVAL(branch->auto_terminate);
break;
case PROP_BRANCH_COUNTER:
JS_NewNumberValue(cx,branch->counter,vp);
*vp=DOUBLE_TO_JSVAL((double)branch->counter);
break;
case PROP_BRANCH_LIMIT:
JS_NewNumberValue(cx,branch->limit,vp);
*cp=DOUBLE_TO_JSVAL(branch->limit);
break;
case PROP_YIELD_INTERVAL:
JS_NewNumberValue(cx,branch->yield_interval,vp);
*vp=DOUBLE_TO_JSVAL((double)branch->yield_interval);
break;
case PROP_GC_INTERVAL:
JS_NewNumberValue(cx,branch->gc_interval,vp);
*vp=DOUBLE_TO_JSVAL((double)branch->gc_interval);
break;
case PROP_GC_ATTEMPTS:
JS_NewNumberValue(cx,branch->gc_attempts,vp);
*vp=DOUBLE_TO_JSVAL((double)branch->gc_attempts);
break;
#ifdef jscntxt_h___
case PROP_GC_COUNTER:
JS_NewNumberValue(cx,cx->runtime->gcNumber,vp);
*vp=UINT_TO_JSVAL(cx->runtime->gcNumber);
break;
case PROP_GC_LASTBYTES:
JS_NewNumberValue(cx,cx->runtime->gcLastBytes,vp);
*vp=DOUBLE_TO_JSVAL((double)cx->runtime->gcLastBytes);
break;
case PROP_BYTES:
JS_NewNumberValue(cx,cx->runtime->gcBytes,vp);
*vp=DOUBLE_TO_JSVAL((double)cx->runtime->gcBytes);
break;
case PROP_MAXBYTES:
JS_NewNumberValue(cx,cx->runtime->gcMaxBytes,vp);
*vp=DOUBLE_TO_JSVAL((double)cx->runtime->gcMaxBytes);
break;
#endif
case PROP_GLOBAL:
......@@ -430,17 +430,19 @@ static JSClass js_internal_class = {
};
#if JS_VERSION >= 185
char* DLLCALL js_getstring(JSContext *cx, JSString *str)
char* DLLCALL JS_GetStringBytes_dumbass(JSContext *cx, JSString *str)
{
size_t len;
size_t pos;
const jschar *val;
char *ret;
if(!(val=JS_GetStringCharsAndLength(cx, str, &len)))
return NULL;
if(!(ret=malloc(len+1))
if(!(ret=malloc(len+1)))
return NULL;
memcpy(ret, val, len);
for(pos=0; pos<len; pos++)
ret[pos]=val[pos];
ret[len]=0;
return ret;
}
......
......@@ -205,8 +205,7 @@ BOOL DLLCALL js_CreateMsgAreaProperties(JSContext* cx, scfg_t* cfg, JSObject* su
,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
return(FALSE);
if(!JS_NewNumberValue(cx,sub->misc,&val))
return(FALSE);
val=UINT_TO_JSVAL(sub->misc);
if(!JS_DefineProperty(cx, subobj, "settings", val
,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
return(FALSE);
......@@ -260,13 +259,13 @@ static JSBool js_sub_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
switch(tiny) {
case SUB_PROP_SCAN_PTR:
JS_NewNumberValue(cx,scan->ptr,vp);
*vp=UINT_TO_JSVAL(scan->ptr);
break;
case SUB_PROP_SCAN_CFG:
JS_NewNumberValue(cx,scan->cfg,vp);
*vp=UINT_TO_JSVAL(scan->cfg);
break;
case SUB_PROP_LAST_READ:
JS_NewNumberValue(cx,scan->last,vp);
*vp=UINT_TO_JSVAL(scan->last);
break;
}
......
......@@ -621,31 +621,31 @@ js_get_msg_index(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
if((idxobj=JS_NewObject(cx,NULL,proto,obj))==NULL)
return(JS_TRUE);
JS_NewNumberValue(cx, msg.idx.number ,&val);
val=UINT_TO_JSVAL(msg.idx.number);
JS_DefineProperty(cx, idxobj, "number" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.idx.to ,&val);
val=UINT_TO_JSVAL(msg.idx.to;
JS_DefineProperty(cx, idxobj, "to" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.idx.from ,&val);
val=UINT_TO_JSVAL(msg.idx.from);
JS_DefineProperty(cx, idxobj, "from" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.idx.subj ,&val);
val=UINT_TO_JSVAL(msg.idx.subj);
JS_DefineProperty(cx, idxobj, "subject" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.idx.attr ,&val);
val=UINT_TO_JSVAL(msg.idx.attr);
JS_DefineProperty(cx, idxobj, "attr" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.offset ,&val);
val=UINT_TO_JSVAL(msg.offset);
JS_DefineProperty(cx, idxobj, "offset" ,val
,NULL,NULL,JSPROP_ENUMERATE);
JS_NewNumberValue(cx, msg.idx.time ,&val);
val=UINT_TO_JSVAL(msg.idx.time);
JS_DefineProperty(cx, idxobj, "time" ,val
,NULL,NULL,JSPROP_ENUMERATE);
......@@ -656,7 +656,7 @@ js_get_msg_index(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
#define LAZY_INTEGER(PropName, PropValue, flags) \
if(name==NULL || strcmp(name, (PropName))==0) { \
JS_NewNumberValue(cx,(PropValue),&v); \
v=UINT_TO_JSVAL((PropValue)); \
JS_DefineProperty(cx, obj, (PropName), v, NULL,NULL,flags); \
if(name) return(JS_TRUE); \
}
......@@ -664,7 +664,7 @@ js_get_msg_index(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
#define LAZY_INTEGER_EXPAND(PropName, PropValue, flags) \
if(name==NULL || strcmp(name, (PropName))==0) { \
if(p->expand_fields || (PropValue)) { \
JS_NewNumberValue(cx,(PropValue),&v); \
val=UINT_TO_JSVAL((PropValue)); \
JS_DefineProperty(cx, obj, (PropName), v, NULL,NULL,flags); \
if(name) return(JS_TRUE); \
} \
......@@ -674,7 +674,7 @@ js_get_msg_index(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
#define LAZY_INTEGER_COND(PropName, Condition, PropValue, flags) \
if(name==NULL || strcmp(name, (PropName))==0) { \
if(Condition) { \
JS_NewNumberValue(cx,(PropValue),&v); \
val=UINT_TO_JSVAL((PropValue)); \
JS_DefineProperty(cx, obj, (PropName), v, NULL,NULL,flags); \
if(name) return(JS_TRUE); \
} \
......@@ -1646,31 +1646,31 @@ static JSBool js_msgbase_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
memset(&idx,0,sizeof(idx));
smb_getfirstidx(&(p->smb),&idx);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,idx.number,vp);
*vp=UINT_TO_JSVAL(idx.number);
break;
case SMB_PROP_LAST_MSG:
rc=JS_SUSPENDREQUEST(cx);
smb_getstatus(&(p->smb));
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,p->smb.status.last_msg,vp);
*vp=UINT_TO_JSVAL(p->smb.status.last_msg);
break;
case SMB_PROP_TOTAL_MSGS:
rc=JS_SUSPENDREQUEST(cx);
smb_getstatus(&(p->smb));
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,p->smb.status.total_msgs,vp);
*vp=UINT_TO_JSVAL(p->smb.status.total_msgs);
break;
case SMB_PROP_MAX_CRCS:
JS_NewNumberValue(cx,p->smb.status.max_crcs,vp);
*vp=UINT_TO_JSVAL(p->smb.status.max_crcs);
break;
case SMB_PROP_MAX_MSGS:
JS_NewNumberValue(cx,p->smb.status.max_msgs,vp);
*vp=UINT_TO_JSVAL(p->smb.status.max_msgs);
break;
case SMB_PROP_MAX_AGE:
JS_NewNumberValue(cx,p->smb.status.max_age,vp);
*vp=UINT_TO_JSVAL(p->smb.status.max_age);
break;
case SMB_PROP_ATTR:
JS_NewNumberValue(cx,p->smb.status.attr,vp);
*vp=UINT_TO_JSVAL(p->smb.status.attr);
break;
case SMB_PROP_SUBNUM:
*vp = INT_TO_JSVAL(p->smb.subnum);
......
......@@ -96,7 +96,7 @@ static size_t js_decode_value(JSContext *cx, JSObject *parent
*rval = BOOLEAN_TO_JSVAL(v->value.b);
break;
case JSTYPE_NUMBER:
JS_NewNumberValue(cx,v->value.n,rval);
*rval=DOUBLE_TO_JSVAL(v->value.n);
break;
case JSTYPE_STRING:
if(v->value.s) {
......
......@@ -77,11 +77,11 @@ static JSBool js_server_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
break;
case SERVER_PROP_OPTIONS:
if(p->options!=NULL)
JS_NewNumberValue(cx,*p->options,vp);
*vp=UINT_TO_JSVAL(*p->options);
break;
case SERVER_PROP_CLIENTS:
if(p->clients!=NULL)
JS_NewNumberValue(cx,*p->clients,vp);
*vp=UINT_TO_JSVAL(*p->clients);
break;
}
......
......@@ -705,9 +705,7 @@ js_recvfrom(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if((rd=recvfrom(p->sock,(BYTE*)&l,len,0,(SOCKADDR*)&addr,&addrlen))==len) {
if(p->network_byte_order)
l=ntohl(l);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,l,&data_val);
rc=JS_SUSPENDREQUEST(cx);
data_val=UINT_TO_JSVAL(l);
}
break;
}
......@@ -943,9 +941,7 @@ js_recvbin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if((rd=recv(p->sock,(BYTE*)&l,size,0))==size) {
if(p->network_byte_order)
l=ntohl(l);
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,l,rval);
rc=JS_SUSPENDREQUEST(cx);
rval = UINT_TO_JSVAL(l);
}
break;
}
......@@ -994,9 +990,7 @@ js_getsockopt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
else
val = 0;
}
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,val,rval);
rc=JS_SUSPENDREQUEST(cx);
*rval = INT_TO_JSVAL(val);
} else {
p->last_error=ERROR_VALUE;
dbprintf(TRUE, p, "error %d getting option %d"
......@@ -1073,7 +1067,7 @@ js_ioctlsocket(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
rc=JS_SUSPENDREQUEST(cx);
if(ioctlsocket(p->sock,cmd,(ulong*)&arg)==0) {
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,arg,rval);
*rval=INT_TO_JSVAL(arg);
}
else {
*rval = INT_TO_JSVAL(-1);
......@@ -1272,9 +1266,7 @@ static JSBool js_socket_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
case SOCK_PROP_NREAD:
cnt=0;
if(ioctlsocket(p->sock, FIONREAD, &cnt)==0) {
JS_RESUMEREQUEST(cx, rc);
JS_NewNumberValue(cx,cnt,vp);
rc=JS_SUSPENDREQUEST(cx);
*vp=DOUBLE_TO_JSVAL((double)cnt);
}
else
*vp = JSVAL_ZERO;
......
......@@ -138,7 +138,7 @@ static JSBool js_system_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
p=cfg->sys_id;
break;
case SYS_PROP_MISC: