diff -wbBur freewrl-1.22.10/src/lib/non_web3d_formats/ColladaParser.c freewrl-1.22.10.my/src/lib/non_web3d_formats/ColladaParser.c --- freewrl-1.22.10/src/lib/non_web3d_formats/ColladaParser.c 2010-08-19 06:20:36.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/non_web3d_formats/ColladaParser.c 2011-07-04 01:19:07.000000000 +0400 @@ -54,7 +54,7 @@ #include "ColladaParser.h" #if HAVE_EXPAT_H -# include +# include #endif #define PROTOINSTANCE_MAX_LEVELS 10 diff -wbBur freewrl-1.22.10/src/lib/world_script/fieldGet.c freewrl-1.22.10.my/src/lib/world_script/fieldGet.c --- freewrl-1.22.10/src/lib/world_script/fieldGet.c 2010-10-13 23:45:26.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/fieldGet.c 2011-07-04 20:21:21.000000000 +0400 @@ -412,7 +412,7 @@ /* create a new SFFloat object */ fp = (float *)fp_in; - newjsval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)*fp)); + newjsval = JS_NewJSVal(cx,(double)*fp); fp_in = offsetPointer_deref(float *,fp_in,elementlen); /* put this object into the MF class */ @@ -449,7 +449,7 @@ /* create a new SFTime object */ fp = (float *)fp_in; - newjsval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)*fp)); + newjsval = JS_NewJSVal(cx,(double)*fp); fp_in = offsetPointer_deref(float *,fp_in,elementlen); /* put this object into the MF class */ diff -wbBur freewrl-1.22.10/src/lib/world_script/fieldSet.c freewrl-1.22.10.my/src/lib/world_script/fieldSet.c --- freewrl-1.22.10/src/lib/world_script/fieldSet.c 2010-09-22 00:00:25.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/fieldSet.c 2011-07-04 20:03:53.000000000 +0400 @@ -748,7 +748,7 @@ #ifdef SETFIELDVERBOSE strval = JS_ValueToString(scriptContext, JSglobal_return_val); - strp = JS_GetStringBytes(strval); + strp = JS_EncodeString(scriptContext, strval); printf ("start of setField_javascriptEventOut, to %ld:%d = %p, fieldtype %d string %s\n",(long)tn, tptr, memptr, fieldType, strp); #endif @@ -813,7 +813,7 @@ case FIELDTYPE_SFImage: { /* the string should be saved as an SFImage */ strval = JS_ValueToString(scriptContext, JSglobal_return_val); - strp = JS_GetStringBytes(strval); + strp = JS_EncodeString(scriptContext, strval); Parser_scanStringValueToMem(tn, tptr, FIELDTYPE_SFImage, strp, FALSE); break; @@ -824,7 +824,7 @@ uintptr_t *newptr; strval = JS_ValueToString(scriptContext, JSglobal_return_val); - strp = JS_GetStringBytes(strval); + strp = JS_EncodeString(scriptContext, strval); /* copy the string over, delete the old one, if need be */ /* printf ("fieldSet SFString, tn %d tptr %d offset from struct %d\n", @@ -844,7 +844,7 @@ struct X3D_Node *mynode; strval = JS_ValueToString(scriptContext, JSglobal_return_val); - strp = JS_GetStringBytes(strval); + strp = JS_EncodeString(scriptContext, strval); /* we will have at least one node here, in an ascii string */ while ((*strp > '\0') && (*strp <= ' ')) strp ++; @@ -1227,7 +1227,7 @@ JSString *_tmpStr; _tmpStr = JS_ValueToString(cx, mainElement); - strp = JS_GetStringBytes(_tmpStr); + strp = JS_EncodeString(scriptContext, _tmpStr); printf ("sub element %d is \"%s\" \n",i,strp); if (JSVAL_IS_OBJECT(mainElement)) printf ("sub element %d is an OBJECT\n",i); @@ -1329,7 +1329,7 @@ JSString *strval; strval = JS_ValueToString(cx, mainElement); - strp = JS_GetStringBytes(strval); + strp = JS_EncodeString(cx, strval); #ifdef SETFIELDVERBOSE printf ("getJSMultiNumType, got string %s\n",strp); @@ -1441,7 +1441,7 @@ return; } strval = JS_ValueToString(cx, _v); - valStr = JS_GetStringBytes(strval); + valStr = JS_EncodeString(cx, strval); /* printf ("new string %d is %s\n",i,valStr); */ diff -wbBur freewrl-1.22.10/src/lib/world_script/jsUtils.c freewrl-1.22.10.my/src/lib/world_script/jsUtils.c --- freewrl-1.22.10/src/lib/world_script/jsUtils.c 2010-06-03 23:38:37.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsUtils.c 2011-07-04 20:21:44.000000000 +0400 @@ -134,7 +134,7 @@ nf = OBJECT_TO_JSVAL(me); #ifdef JSVRMLCLASSESVERBOSE - printf ("parentField is %u \"%s\"\n", pf, JS_GetStringBytes(JSVAL_TO_STRING(pf))); + printf ("parentField is %u \"%s\"\n", pf, JS_EncodeString(cx, JSVAL_TO_STRING(pf))); #endif if (!setSFNodeField (cx, par, pf, &nf)) { @@ -197,7 +197,7 @@ char *_id_c; _idStr = JS_ValueToString(cx, *newval); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); oldS = (struct Uni_String *) *((uintptr_t *)Data); @@ -305,12 +305,12 @@ case FIELDTYPE_SFFloat: { memcpy ((void *) &fl, Data, datalen); - *newval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)fl)); + *newval = JS_NewJSVal(cx,(double)fl); break; } case FIELDTYPE_SFTime: { memcpy ((void *) &dl, Data, datalen); - *newval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,dl)); + *newval = JS_NewJSVal(cx,dl); break; } case FIELDTYPE_SFBool: @@ -824,7 +824,7 @@ struct X3D_Node *node; _idStr = JS_ValueToString(context, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(context, _idStr); #ifdef JSVRMLCLASSESVERBOSE printf ("\ngetSFNodeField called on name %s object %u\n",_id_c, obj); @@ -912,7 +912,7 @@ /* get the id field... */ - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); #ifdef JSVRMLCLASSESVERBOSE printf ("\nsetSFNodeField called on name %s object %u, jsval %u\n",_id_c, obj, *vp); @@ -1131,10 +1131,10 @@ char *_id_c = "(no value in string)"; /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); /* printf ("hmmm...js_SetPropertyCheck called on string \"%s\" object %u, jsval %u\n",_id_c, obj, *vp); */ } else if (JSVAL_IS_DOUBLE(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyCheck called on double %s object %u, jsval %u\n",_id_c, obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1192,7 +1192,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); printf ("\n...js_GetPropertyDebug called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1211,7 +1211,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1229,7 +1229,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug1 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1247,7 +1247,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id)); printf ("...js_SetPropertyDebug2 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1265,7 +1265,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug3 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1283,7 +1283,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug4 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1301,7 +1301,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug5 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1319,7 +1319,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug6 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1337,7 +1337,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug7 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1355,7 +1355,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug8 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); @@ -1373,7 +1373,7 @@ /* get the id field... */ if (JSVAL_IS_STRING(id)) { - _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id)); + _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id)); printf ("\n...js_SetPropertyDebug9 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp); } else if (JSVAL_IS_INT(id)) { num = JSVAL_TO_INT(id); diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLBrowser.c freewrl-1.22.10.my/src/lib/world_script/jsVRMLBrowser.c --- freewrl-1.22.10/src/lib/world_script/jsVRMLBrowser.c 2010-08-02 23:55:57.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLBrowser.c 2011-07-04 20:06:25.000000000 +0400 @@ -336,7 +336,7 @@ return JS_FALSE; } _str = JS_ValueToString(context, argv[0]); - _costr = JS_GetStringBytes(_str); + _costr = JS_EncodeString(context, _str); /* sanitize string, for the EAI_RW call (see EAI_RW code) */ tptr = _costr; @@ -385,10 +385,10 @@ return JS_FALSE; } _str[0] = JS_ValueToString(context, argv[0]); - _costr[0] = JS_GetStringBytes(_str[0]); + _costr[0] = JS_EncodeString(context, _str[0]); _str[1] = JS_ValueToString(context, argv[1]); - _costr[1] = JS_GetStringBytes(_str[1]); + _costr[1] = JS_EncodeString(context, _str[1]); /* we use the EAI code for this - so reformat this for the EAI format */ { @@ -575,7 +575,7 @@ /* third parameter should be a string */ if (JSVAL_IS_STRING(argv[2])) { _str[1] = JSVAL_TO_STRING(argv[2]); - fieldStr = JS_GetStringBytes(_str[1]); + fieldStr = JS_EncodeString(context, _str[1]); #ifdef JSVERBOSE printf ("field string is :%s:\n",fieldStr); #endif @@ -590,7 +590,7 @@ /* get the URL listing as a string */ _str[0] = JS_ValueToString(context, argv[0]); - _costr0 = JS_GetStringBytes(_str[0]); + _costr0 = JS_EncodeString(context, _str[0]); #ifdef JSVERBOSE @@ -690,7 +690,7 @@ for (count=0; count < argc; count++) { if (JSVAL_IS_STRING(argv[count])) { _str = JSVAL_TO_STRING(argv[count]); - _id_c = JS_GetStringBytes(_str); + _id_c = JS_EncodeString(context, _str); #if defined(AQUA) || defined(_MSC_VER) BrowserPrintConsoleMessage(_id_c); /* statusbar hud */ consMsgCount = 0; /* reset the "Maximum" count */ @@ -850,7 +850,7 @@ /* parameter should be a string */ if (JSVAL_IS_STRING(argv[0])) { - target = JS_GetStringBytes( JSVAL_TO_STRING(argv[0])); + target = JS_EncodeString(context, JSVAL_TO_STRING(argv[0])); #ifdef JSVERBOSE printf ("field string is %s\n",target); #endif @@ -930,7 +930,7 @@ /* parameters should be a string */ if (JSVAL_IS_STRING(argv[0])) { - targetDevice = JS_GetStringBytes( JSVAL_TO_STRING(argv[0])); + targetDevice = JS_EncodeString(cx, JSVAL_TO_STRING(argv[0])); #ifdef JSVERBOSE printf ("field string is %s\n",targetDevice); #endif @@ -939,7 +939,7 @@ return -1; } if (JSVAL_IS_STRING(argv[1])) { - targetController = JS_GetStringBytes( JSVAL_TO_STRING(argv[1])); + targetController = JS_EncodeString(cx, JSVAL_TO_STRING(argv[1])); #ifdef JSVERBOSE printf ("field string is %s\n",targetController); #endif diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.c --- freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.c 2010-09-22 23:40:48.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.c 2011-07-04 20:08:03.000000000 +0400 @@ -935,7 +935,7 @@ printf( "JS_NewDouble failed for %f in simplecopyelements.\n",dd); return JS_FALSE; } - val = DOUBLE_TO_JSVAL(dp); + val = DOUBLE_TO_JSVAL(*dp); } } @@ -1108,7 +1108,7 @@ printf ("HAVE STRING HERE!\n"); _str = JS_ValueToString(cx, id); - asciiStr = JS_GetStringBytes(_str); + asciiStr = JS_EncodeString(context, _str); printf ("we have as a parameter :%s:\n",asciiStr); #endif @@ -1185,7 +1185,7 @@ if (_tmpStr==NULL) { _tmp_valStr = "NULL"; } else { - _tmp_valStr = JS_GetStringBytes(_tmpStr); + _tmp_valStr = JS_EncodeString(cx, _tmpStr); } } @@ -1281,7 +1281,7 @@ #endif str = JS_ValueToString(cx, id); - p = JS_GetStringBytes(str); + p = JS_EncodeString(cx, str); #ifdef JSVRMLCLASSESVERBOSE printf("\tid string %s\n ",p); #endif @@ -1368,12 +1368,12 @@ char * _c; printf ("doMFSetProperty, for object %u, vp %u\n", obj,*vp); _str = JS_ValueToString(cx, id); - _c = JS_GetStringBytes(_str); + _c = JS_EncodeString(cx, _str); printf ("id is %s\n",_c); _sstr = JS_ValueToString(cx, *vp); printf ("looking up value for %d %x object %p\n",*vp,*vp,obj); - _cc = JS_GetStringBytes(_sstr); + _cc = JS_EncodeString(cx, _sstr); printf("\tdoMFSetProperty:%d: obj = %p, id = %s, vp = %s\n",type, obj, _c, _cc); if (JSVAL_IS_OBJECT(*vp)) { printf ("doMFSet, vp is an OBJECT\n"); } @@ -1397,7 +1397,7 @@ if (!JS_ValueToInt32(cx, *vp, &i)) { _sstr = JS_ValueToString(cx, *vp); - _cc = JS_GetStringBytes(_sstr); + _cc = JS_EncodeString(cx, _sstr); printf ("can not convert %s to an integer in doMFAddProperty for type %d\n",_cc,type); return JS_FALSE; } @@ -1408,7 +1408,7 @@ #ifdef JSVRMLCLASSESVERBOSE printf ("doMFSetProperty - ensure that this is a DOUBLE "); _sstr = JS_ValueToString(cx, *vp); - _cc = JS_GetStringBytes(_sstr); + _cc = JS_EncodeString(cx, _sstr); printf ("value is %s \n",_cc); #endif @@ -1420,7 +1420,7 @@ printf( "JS_NewDouble failed for %f in simplecopyelements.\n",dd); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); } } @@ -1511,7 +1511,7 @@ nf = OBJECT_TO_JSVAL(me); #ifdef JSVRMLCLASSESVERBOSE - printf ("parentField is %u \"%s\"\n", pf, JS_GetStringBytes(JSVAL_TO_STRING(pf))); + printf ("parentField is %u \"%s\"\n", pf, JS_EncodeString(cx, JSVAL_TO_STRING(pf))); #endif if (!setSFNodeField (cx, par, pf, &nf)) { @@ -1535,7 +1535,7 @@ unsigned int i, j = 0; _str = JS_ValueToString(cx, *vp); - _buff = JS_GetStringBytes(_str); + _buff = JS_EncodeString(cx, _str); _buff_len = strlen(_buff) + 1; #ifdef JSVRMLCLASSESVERBOSE @@ -1719,14 +1719,14 @@ size_t len = 0; _idStr = JS_ValueToString(context, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(context, _idStr); /* "register" this ECMA value for routing changed flag stuff */ setInECMATable(context, _id_c); if (JSVAL_IS_STRING(*vp)) { _vpStr = JS_ValueToString(context, *vp); - _vp_c = JS_GetStringBytes(_vpStr); + _vp_c = JS_EncodeString(context, _vpStr); len = strlen(_vp_c); @@ -1752,7 +1752,7 @@ } else { #ifdef JSVRMLCLASSESVERBOSE _vpStr = JS_ValueToString(context, *vp); - _vp_c = JS_GetStringBytes(_vpStr); + _vp_c = JS_EncodeString(cx, _vpStr); printf("setECMANative: obj = %p, id = \"%s\", vp = %s\n", obj, _id_c, _vp_c); #endif @@ -1770,9 +1770,9 @@ JSString *_idStr, *_vpStr; char *_id_c, *_vp_c; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _vpStr = JS_ValueToString(cx, *vp); - _vp_c = JS_GetStringBytes(_vpStr); + _vp_c = JS_EncodeString(cx, _vpStr); printf("getAssignProperty: obj = %p, id = \"%s\", vp = %s\n", obj, _id_c, _vp_c); printf ("what is vp? \n"); @@ -1803,7 +1803,7 @@ if (JSVAL_IS_STRING(id)) { _str = JSVAL_TO_STRING(id); - _id_c = JS_GetStringBytes(_str); + _id_c = JS_EncodeString(cx, _str); if (!JS_ConvertValue(cx, *vp, JSTYPE_OBJECT, &newVal)) { printf( "JS_ConvertValue failed in setAssignProperty.\n"); return JS_FALSE; @@ -1834,9 +1834,9 @@ if (JSVAL_IS_DOUBLE(id)) printf ("id is an DOUBLE\n"); if (JSVAL_IS_INT(id)) printf ("id is an INT\n"); - printf ("id is %s\n",JS_GetStringBytes(JS_ValueToString(cx,id))); - printf ("initVal is %s\n",JS_GetStringBytes(JS_ValueToString(cx,initVal))); - printf ("newVal is %s\n",JS_GetStringBytes(JS_ValueToString(cx,newVal))); + printf ("id is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,id))); + printf ("initVal is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,initVal))); + printf ("newVal is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,newVal))); #endif @@ -1859,7 +1859,7 @@ } else { #ifdef JSVRMLCLASSESVERBOSE _str = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_str); + _id_c = JS_EncodeString(cx, _str); printf("setAssignProperty: obj = %p, id = \"%s\"\n", obj, _id_c); #endif diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.h freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.h --- freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.h 2010-10-13 23:45:26.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.h 2011-07-04 20:24:53.000000000 +0400 @@ -30,6 +30,21 @@ #ifndef __FREEWRL_JS_VRML_CLASSES_H__ #define __FREEWRL_JS_VRML_CLASSES_H__ +static inline jsval JS_NewJSVal(JSContext *cx, jsdouble d) +{ + jsval ret; + JS_NewNumberValue(cx, d, &ret); + return ret; +} + +static inline jsdouble * JS_NewDouble(JSContext *cx, jsdouble d) +{ + static jsdouble ret; + jsval rv; + JS_NewNumberValue(cx, d, &rv); + ret = JSVAL_TO_DOUBLE(rv); + return &ret; +} #ifndef UNUSED #define UNUSED(v) ((void) v) @@ -80,14 +95,14 @@ #define SET_JS_TICKTIME_FALSE(possibleRetVal) { jsval zimbo; \ - zimbo = DOUBLE_TO_JSVAL(JS_NewDouble(cx, TickTime)); \ + zimbo = JS_NewJSVal(cx, TickTime); \ if (!JS_DefineProperty(cx,obj, "__eventInTickTime", zimbo, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_STUB2, JSPROP_PERMANENT)) { \ printf( "JS_DefineProperty failed for \"__eventInTickTime\" at %s:%d.\n",__FILE__,__LINE__); \ return possibleRetVal; \ }} #define SET_JS_TICKTIME() { jsval zimbo; \ - zimbo = DOUBLE_TO_JSVAL(JS_NewDouble(cx, TickTime)); \ + zimbo = JS_NewJSVal(cx, TickTime); \ if (!JS_DefineProperty(cx,obj, "__eventInTickTime", zimbo, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_STUB2, JSPROP_PERMANENT)) { \ printf( "JS_DefineProperty failed for \"__eventInTickTime\" at %s:%d.\n",__FILE__,__LINE__); \ return FALSE; \ diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRML_MFClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRML_MFClasses.c --- freewrl-1.22.10/src/lib/world_script/jsVRML_MFClasses.c 2010-09-22 23:40:48.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsVRML_MFClasses.c 2011-07-04 20:08:44.000000000 +0400 @@ -596,7 +596,7 @@ return; } - val = DOUBLE_TO_JSVAL(dp); + val = DOUBLE_TO_JSVAL(*dp); if (!JS_SetElement(cx, obj, (jsint) i, &val)) { printf( "JS_DefineElement failed for arg %u in VrmlMatrixSetTransform.\n", i); @@ -1212,7 +1212,7 @@ /* if (JSVAL_IS_STRING(id)==TRUE) { printf(" is a common string :%s:\n", - JS_GetStringBytes(JS_ValueToString(cx, id))); + JS_EncodeString(cx, JS_ValueToString(cx, id))); } if (JSVAL_IS_OBJECT(id)==TRUE) { printf (" parameter is an object\n"); @@ -1231,7 +1231,7 @@ _index = JSVAL_TO_INT(id); if (_index >= _length) { - *vp = DOUBLE_TO_JSVAL(&zerojsdouble); + *vp = DOUBLE_TO_JSVAL(zerojsdouble); if (!JS_DefineElement(cx, obj, (jsint) _index, *vp, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_CHECK, JSPROP_ENUMERATE)) { printf( "JS_DefineElement failed in VrmlMatrixGetProperty.\n"); return JS_FALSE; @@ -1331,7 +1331,7 @@ printf("MFStringAddProperty: vp = %p\n", obj); if (JSVAL_IS_STRING(*vp)==TRUE) { printf(" is a common string :%s:\n", - JS_GetStringBytes(JS_ValueToString(cx, *vp))); + JS_EncodeString(cx, JS_ValueToString(cx, *vp))); } if (JSVAL_IS_OBJECT(*vp)==TRUE) { printf (" parameter is an object\n"); @@ -1345,7 +1345,7 @@ printf("MFStringAddProperty: id = %p\n", obj); if (JSVAL_IS_STRING(id)==TRUE) { printf(" is a common string :%s:\n", - JS_GetStringBytes(JS_ValueToString(cx, id))); + JS_EncodeString(cx, JS_ValueToString(cx, id))); } if (JSVAL_IS_OBJECT(id)==TRUE) { printf (" parameter is an object\n"); @@ -1494,7 +1494,7 @@ if (JSVAL_IS_STRING(argv[i])==TRUE) { printf (" Common String, is"); _str = JS_ValueToString(cx, argv[i]); - printf (JS_GetStringBytes(_str)); + printf (JS_EncodeString(cx, _str)); printf (".."); } diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRML_SFClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRML_SFClasses.c --- freewrl-1.22.10/src/lib/world_script/jsVRML_SFClasses.c 2010-09-25 00:22:05.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/world_script/jsVRML_SFClasses.c 2011-07-04 20:09:01.000000000 +0400 @@ -161,7 +161,7 @@ printf( "JS_NewDouble failed for %f in SFColorGetHSV.\n", xp[i]); return JS_FALSE; } - _v = DOUBLE_TO_JSVAL(dp); + _v = DOUBLE_TO_JSVAL(*dp); JS_SetElement(cx, result, (jsint)i, &_v); } @@ -336,7 +336,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -346,7 +346,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -356,7 +356,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } @@ -387,13 +387,13 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(_val); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(_val); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(_val); break; } @@ -422,18 +422,18 @@ *rval = OBJECT_TO_JSVAL(_arrayObj); /* construct new double before conversion? */ - _v = DOUBLE_TO_JSVAL(&hue); + _v = DOUBLE_TO_JSVAL(hue); if (!JS_SetElement(cx, _arrayObj, 0, &_v)) { printf( "JS_SetElement failed for hue in SFColorRGBAGetHSV.\n"); return JS_FALSE; } - _v = DOUBLE_TO_JSVAL(&saturation); + _v = DOUBLE_TO_JSVAL(saturation); if (!JS_SetElement(cx, _arrayObj, 1, &_v)) { printf( "JS_SetElement failed for saturation in SFColorRGBAGetHSV.\n"); return JS_FALSE; } - _v = DOUBLE_TO_JSVAL(&value); + _v = DOUBLE_TO_JSVAL(value); if (!JS_SetElement(cx, _arrayObj, 2, &_v)) { printf( "JS_SetElement failed for value in SFColorRGBAGetHSV.\n"); return JS_FALSE; @@ -601,7 +601,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -611,7 +611,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -621,7 +621,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 3: d = (ptr->v).c[3]; @@ -631,7 +631,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } @@ -662,16 +662,16 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(_val); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(_val); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(_val); break; case 3: - (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(_val); + (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(_val); break; } @@ -983,7 +983,7 @@ } else if (argc == 1) { /* is this a string, or a number indicating a node? */ myStr = JS_ValueToString(cx, argv[0]); - cString = JS_GetStringBytes(myStr); + cString = JS_EncodeString(cx, myStr); #ifdef JSVRMLCLASSESVERBOSE printf ("SFNodeConstr, argc =1l string %s\n",cString); #endif @@ -1067,13 +1067,13 @@ char *_id_c; _idStr = JS_ValueToString(cx, argv[0]); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); /* printf ("first string :%s:\n",_id_c); */ cString = STRDUP(_id_c); _idStr = JS_ValueToString(cx, argv[1]); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); /* printf ("second string :%s:\n",_id_c); */ if (sscanf (_id_c,"%p",&newHandle) != 1) { @@ -1190,7 +1190,7 @@ jsval rval; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); #ifdef JSVRMLCLASSESVERBOSE printf ("start of SFNodeGetProperty... id is %s\n",_id_c); @@ -1264,10 +1264,10 @@ _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _valStr = JS_ValueToString(cx, *vp); - _val_c = JS_GetStringBytes(_valStr); + _val_c = JS_EncodeString(cx, _valStr); #ifdef JSVRMLCLASSESVERBOSE printf("SFNodeSetProperty: obj = %p, id = %s, vp = %s\n", @@ -1904,7 +1904,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -1914,7 +1914,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -1924,7 +1924,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 3: d = (ptr->v).c[3]; @@ -1934,7 +1934,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } @@ -1969,16 +1969,16 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv); break; case 3: - (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv); break; } } @@ -2051,7 +2051,7 @@ * it get created in javascript? */ if (param_isString) { _str = JS_ValueToString(cx, *argv); - charString = JS_GetStringBytes(_str); + charString = JS_EncodeString(cx, _str); if (sscanf(charString, "%lf %lf", &(pars[0]), &(pars[1])) != 2) { @@ -2143,7 +2143,7 @@ printf( "JS_NewDouble failed for %f in SFVec2f.\n",d); return JS_FALSE; } - *rval = DOUBLE_TO_JSVAL(dp); + *rval = DOUBLE_TO_JSVAL(*dp); } #ifdef JSVRMLCLASSESVERBOSE @@ -2332,7 +2332,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -2342,7 +2342,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } @@ -2373,13 +2373,13 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv); break; } } @@ -2458,7 +2458,7 @@ * it get created in javascript? */ if (param_isString) { _str = JS_ValueToString(cx, *argv); - charString = JS_GetStringBytes(_str); + charString = JS_EncodeString(cx, _str); if (sscanf(charString, "%lf %lf %lf", &(pars[0]), &(pars[1]), &(pars[2])) != 3) { @@ -2580,7 +2580,7 @@ printf( "JS_NewDouble failed for %f in SFVec3f.\n",d); return JS_FALSE; } - *rval = DOUBLE_TO_JSVAL(dp); + *rval = DOUBLE_TO_JSVAL(*dp); } #ifdef JSVRMLCLASSESVERBOSE if (retSFVec3f){ @@ -2792,9 +2792,9 @@ char *_id_c; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _idStr = JS_ValueToString(cx, *vp); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); #endif @@ -2813,7 +2813,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -2823,7 +2823,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -2833,7 +2833,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } else { @@ -2869,13 +2869,13 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv); break; } } @@ -2949,7 +2949,7 @@ * it get created in javascript? */ if (param_isString) { _str = JS_ValueToString(cx, *argv); - charString = JS_GetStringBytes(_str); + charString = JS_EncodeString(cx, _str); if (sscanf(charString, "%lf %lf %lf", &(pars[0]), &(pars[1]), &(pars[2])) != 3) { @@ -3071,7 +3071,7 @@ printf( "JS_NewDouble failed for %f in SFVec3d.\n",d); return JS_FALSE; } - *rval = DOUBLE_TO_JSVAL(dp); + *rval = DOUBLE_TO_JSVAL(*dp); } #ifdef JSVRMLCLASSESVERBOSE if (retSFVec3d){ @@ -3282,9 +3282,9 @@ char *_id_c; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _idStr = JS_ValueToString(cx, *vp); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); #endif @@ -3303,7 +3303,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -3313,7 +3313,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -3323,7 +3323,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } else { @@ -3359,13 +3359,13 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = JSVAL_TO_DOUBLE(myv); break; } } @@ -3513,9 +3513,9 @@ char *_id_c; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _idStr = JS_ValueToString(cx, *vp); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); #endif @@ -3534,7 +3534,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -3544,7 +3544,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -3554,7 +3554,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 3: d = (ptr->v).c[3]; @@ -3564,7 +3564,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } else { @@ -3600,16 +3600,16 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv); break; case 3: - (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv); break; } } @@ -3758,9 +3758,9 @@ char *_id_c; _idStr = JS_ValueToString(cx, id); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); _idStr = JS_ValueToString(cx, *vp); - _id_c = JS_GetStringBytes(_idStr); + _id_c = JS_EncodeString(cx, _idStr); #endif @@ -3779,7 +3779,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 1: d = (ptr->v).c[1]; @@ -3789,7 +3789,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 2: d = (ptr->v).c[2]; @@ -3799,7 +3799,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; case 3: d = (ptr->v).c[3]; @@ -3809,7 +3809,7 @@ d); return JS_FALSE; } - *vp = DOUBLE_TO_JSVAL(dp); + *vp = DOUBLE_TO_JSVAL(*dp); break; } } else { @@ -3845,16 +3845,16 @@ if (JSVAL_IS_INT(id)) { switch (JSVAL_TO_INT(id)) { case 0: - (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv); break; case 1: - (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv); break; case 2: - (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv); break; case 3: - (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv); + (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv); break; } } diff -wbBur freewrl-1.22.10/src/lib/x3d_parser/X3DParser.c freewrl-1.22.10.my/src/lib/x3d_parser/X3DParser.c --- freewrl-1.22.10/src/lib/x3d_parser/X3DParser.c 2010-09-22 20:54:59.000000000 +0400 +++ freewrl-1.22.10.my/src/lib/x3d_parser/X3DParser.c 2011-07-04 01:19:07.000000000 +0400 @@ -54,7 +54,7 @@ #include "X3DProtoScript.h" #if HAVE_EXPAT_H -# include +# include #endif //#define X3DPARSERVERBOSE 1