[freewrl] fixup more missing API bits

Tom Callaway spot at fedoraproject.org
Fri Feb 1 16:04:24 UTC 2013


commit f41343ea39e8e8a81da925353a92254915c09068
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Fri Feb 1 17:06:51 2013 +0100

    fixup more missing API bits

 freewrl-1.22.13-no-JS_ConstructObject.patch |  277 +++++++++++++++++++++++++++
 freewrl-1.22.13-wrappers-removed-api.patch  |   36 ++++
 freewrl.spec                                |    6 +
 3 files changed, 319 insertions(+), 0 deletions(-)
---
diff --git a/freewrl-1.22.13-no-JS_ConstructObject.patch b/freewrl-1.22.13-no-JS_ConstructObject.patch
new file mode 100644
index 0000000..769ac1d
--- /dev/null
+++ b/freewrl-1.22.13-no-JS_ConstructObject.patch
@@ -0,0 +1,277 @@
+diff -upa freewrl-1.22.13/src/lib/world_script/fieldGet.c.nojsco freewrl-1.22.13/src/lib/world_script/fieldGet.c
+--- freewrl-1.22.13/src/lib/world_script/fieldGet.c.nojsco	2013-02-01 17:02:35.955396943 +0100
++++ freewrl-1.22.13/src/lib/world_script/fieldGet.c	2013-02-01 17:04:54.512391990 +0100
+@@ -242,7 +242,7 @@ int set_one_MFElementType(int tonode, in
+ 			float *fp, *fp_in=(float *)Data;
+ 
+ 			/* create a new MFRotation object... */
+-			newMFObject = JS_ConstructObject(cx, &MFRotationClass,JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFRotationClass,JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -252,7 +252,7 @@ int set_one_MFElementType(int tonode, in
+ 			elementlen = (int) sizeof (float);
+ 			for (x=0; x<datalen; x++) {
+ 				/* create a new SFRotation object */
+-				newSFObject = JS_ConstructObject(cx,&SFRotationClass, newMFObject);
++				newSFObject = JS_NewObject(cx,&SFRotationClass, newMFObject, NULL);
+ 				if ((SFRPptr = (SFRotationNative *)JS_GetPrivate(newSFObject)) == NULL) {
+ 					printf ("failure in getting SF class at %s:%d\n",__FILE__,__LINE__);
+ #if defined(JS_THREADSAFE)
+@@ -293,7 +293,7 @@ int set_one_MFElementType(int tonode, in
+ 			float *fp, *fp_in=(float *)Data;
+ 
+ 			/* create a new MFVec3f object... */
+-			newMFObject = JS_ConstructObject(cx, &MFVec3fClass,JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFVec3fClass,JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -303,7 +303,7 @@ int set_one_MFElementType(int tonode, in
+ 			elementlen = (int) sizeof (float);
+ 			for (x=0; x<datalen; x++) {
+ 				/* create a new SFVec3f object */
+-				newSFObject = JS_ConstructObject(cx,&SFVec3fClass, newMFObject);
++				newSFObject = JS_NewObject(cx,&SFVec3fClass, newMFObject, NULL);
+ 				if ((SFRPptr = (SFVec3fNative *)JS_GetPrivate(newSFObject)) == NULL) {
+ 					printf ("failure in getting SF class at %s:%d\n",__FILE__,__LINE__);
+ #if defined(JS_THREADSAFE)
+@@ -343,7 +343,7 @@ int set_one_MFElementType(int tonode, in
+ 			float *fp, *fp_in=(float *)Data;
+ 
+ 			/* create a new MFColor object... */
+-			newMFObject = JS_ConstructObject(cx, &MFColorClass,JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFColorClass,JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -353,7 +353,7 @@ int set_one_MFElementType(int tonode, in
+ 			elementlen = (int) sizeof (float);
+ 			for (x=0; x<datalen; x++) {
+ 				/* create a new SFColor object */
+-				newSFObject = JS_ConstructObject(cx,&SFColorClass, newMFObject);
++				newSFObject = JS_NewObject(cx,&SFColorClass, newMFObject, NULL);
+ 				if ((SFRPptr = (SFColorNative *)JS_GetPrivate(newSFObject)) == NULL) {
+ 					printf ("failure in getting SF class at %s:%d\n",__FILE__,__LINE__);
+ #if defined(JS_THREADSAFE)
+@@ -393,7 +393,7 @@ int set_one_MFElementType(int tonode, in
+ 			float *fp, *fp_in=(float *)Data;
+ 
+ 			/* create a new MFVec2f object... */
+-			newMFObject = JS_ConstructObject(cx, &MFVec2fClass,JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFVec2fClass,JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -403,7 +403,7 @@ int set_one_MFElementType(int tonode, in
+ 			elementlen = (int) sizeof (float);
+ 			for (x=0; x<datalen; x++) {
+ 				/* create a new SFVec2f object */
+-				newSFObject = JS_ConstructObject(cx,&SFVec2fClass, newMFObject);
++				newSFObject = JS_NewObject(cx,&SFVec2fClass, newMFObject, NULL);
+ 				if ((SFRPptr = (SFVec2fNative *)JS_GetPrivate(newSFObject)) == NULL) {
+ 					printf ("failure in getting SF class at %s:%d\n",__FILE__,__LINE__);
+ #if defined(JS_THREADSAFE)
+@@ -441,7 +441,7 @@ int set_one_MFElementType(int tonode, in
+ 			jsval newjsval;
+ 			float *fp, *fp_in=(float *)Data;
+ 			/* create a new MFFloat object... */
+-			newMFObject = JS_ConstructObject(cx, &MFFloatClass, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFFloatClass, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -480,7 +480,7 @@ int set_one_MFElementType(int tonode, in
+ 			double *dp, *dp_in=(double *)Data;
+ 
+ 			/* create a new MFTime object... */
+-			newMFObject = JS_ConstructObject(cx, &MFTimeClass, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFTimeClass, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -519,7 +519,7 @@ int set_one_MFElementType(int tonode, in
+ 			int *ip, *ip_in=(int *)Data;
+ 
+ 			/* create a new MFInt32 object... */
+-			newMFObject = JS_ConstructObject(cx, &MFInt32Class, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFInt32Class, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -558,7 +558,7 @@ int set_one_MFElementType(int tonode, in
+ 			struct Uni_String * *ip_in=(struct Uni_String **)Data;
+ 
+ 			/* create a new MFString object... */
+-			newMFObject = JS_ConstructObject(cx, &MFStringClass, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFStringClass, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* Data points to a Uni_String */
+@@ -597,7 +597,7 @@ int set_one_MFElementType(int tonode, in
+ 			jsval newjsval;
+ 			double *ip, *ip_in=(double *)Data;
+ 			/* create a new MFNode object... */
+-			newMFObject = JS_ConstructObject(cx, &MFNodeClass, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &MFNodeClass, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+@@ -635,7 +635,7 @@ int set_one_MFElementType(int tonode, in
+ 			double *ip, *ip_in=(double *)Data;
+ 
+ 			/* create a new MFNode object... */
+-			newMFObject = JS_ConstructObject(cx, &SFImageClass, JS_GetParent(obj));
++			newMFObject = JS_NewObject(cx, &SFImageClass, JS_GetParent(obj), NULL);
+ 			ADD_ROOT (cx, newMFObject)
+ 
+ 			/* define the "length" property for this object */ 
+diff -upa freewrl-1.22.13/src/lib/world_script/jsVRML_MFClasses.c.nojsco freewrl-1.22.13/src/lib/world_script/jsVRML_MFClasses.c
+--- freewrl-1.22.13/src/lib/world_script/jsVRML_MFClasses.c.nojsco	2013-02-01 17:00:53.353400611 +0100
++++ freewrl-1.22.13/src/lib/world_script/jsVRML_MFClasses.c	2013-02-01 17:01:46.316398717 +0100
+@@ -1300,7 +1300,7 @@ VrmlMatrixinverse(JSContext *cx, unsigne
+ 	_getmatrix (cx, obj,src);
+ 	matinverse (dest,src);
+ 
+-        retObj = JS_ConstructObject(cx,&VrmlMatrixClass, NULL);
++        retObj = JS_NewObject(cx,&VrmlMatrixClass, NULL, NULL);
+ 
+         _setmatrix(cx,retObj,dest);
+ #if JS_VERSION < 185
+@@ -1332,7 +1332,7 @@ VrmlMatrixtranspose(JSContext *cx, unsig
+ 	_getmatrix (cx, obj,src);
+ 	mattranspose (dest,src);
+ 
+-        retObj = JS_ConstructObject(cx,&VrmlMatrixClass, NULL);
++        retObj = JS_NewObject(cx,&VrmlMatrixClass, NULL, NULL);
+ 
+         _setmatrix(cx,retObj,dest);
+ #if JS_VERSION < 185
+@@ -1376,7 +1376,7 @@ VrmlMatrixmultLeft(JSContext *cx, unsign
+ 	_getmatrix(cx,transObj,matrix2);
+ 	matmultiply(matrix1,matrix1,matrix2);
+ 
+-	retObj = JS_ConstructObject(cx,&VrmlMatrixClass, NULL);
++	retObj = JS_NewObject(cx,&VrmlMatrixClass, NULL, NULL);
+ 
+ 	/*
+        printf ("multLeft calculated Matrix: \n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n",
+@@ -1426,7 +1426,7 @@ VrmlMatrixmultRight(JSContext *cx, unsig
+ 	_getmatrix(cx,transObj,matrix2);
+ 	matmultiply(matrix1,matrix2,matrix1);
+ 
+-	retObj = JS_ConstructObject(cx,&VrmlMatrixClass, NULL);
++	retObj = JS_NewObject(cx,&VrmlMatrixClass, NULL, NULL);
+ 
+ 	/*
+        printf ("multRight calculated Matrix: \n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f %5.2f\n",
+@@ -1487,7 +1487,7 @@ VrmlMatrixmultVecMatrix(JSContext *cx, u
+ 	
+ 	matrotate2v(matrix1, inp, outp);
+ 
+-	retObj = JS_ConstructObject(cx,&SFVec3fClass, NULL);
++	retObj = JS_NewObject(cx,&SFVec3fClass, NULL, NULL);
+ 	if ((Vptr = (SFVec3fNative *)JS_GetPrivate(retObj)) == NULL) {
+ 		printf ("error in new VrmlMatrix\n");
+ 		return JS_FALSE;
+@@ -1545,7 +1545,7 @@ VrmlMatrixmultMatrixVec(JSContext *cx, u
+ 	
+ 	matrotate2v(matrix1, inp, outp);
+ 
+-	retObj = JS_ConstructObject(cx,&SFVec3fClass, NULL);
++	retObj = JS_NewObject(cx,&SFVec3fClass, NULL, NULL);
+ 	if ((Vptr = (SFVec3fNative *)JS_GetPrivate(retObj)) == NULL) {
+ 		printf ("error in new VrmlMatrix\n");
+ 		return JS_FALSE;
+diff -upa freewrl-1.22.13/src/lib/world_script/jsVRML_SFClasses.c.nojsco freewrl-1.22.13/src/lib/world_script/jsVRML_SFClasses.c
+--- freewrl-1.22.13/src/lib/world_script/jsVRML_SFClasses.c.nojsco	2013-02-01 16:58:12.819406349 +0100
++++ freewrl-1.22.13/src/lib/world_script/jsVRML_SFClasses.c	2013-02-01 17:00:23.814401666 +0100
+@@ -1850,8 +1850,8 @@ SFRotationGetAxis(JSContext *cx, uint32_
+ 	printf ("start of SFRotationGetAxis\n");
+ 	#endif
+ 
+-	if ((_retObj = JS_ConstructObject(cx, &SFVec3fClass, NULL)) == NULL) {
+-		printf( "JS_ConstructObject failed in SFRotationGetAxis.\n");
++	if ((_retObj = JS_NewObject(cx, &SFVec3fClass, NULL, NULL)) == NULL) {
++		printf( "JS_NewObject failed in SFRotationGetAxis.\n");
+ 		return JS_FALSE;
+ 	}
+ 
+@@ -1909,8 +1909,8 @@ SFRotationInverse(JSContext *cx, uint32_
+ 		printf( "JS_GetPrototype failed in SFRotationInverse.\n");
+ 		return JS_FALSE;
+ 	}
+-	if ((_retObj = JS_ConstructObject(cx, &SFRotationClass, _proto)) == NULL) {
+-		printf( "JS_ConstructObject failed in SFRotationInverse.\n");
++	if ((_retObj = JS_NewObject(cx, &SFRotationClass, _proto, NULL)) == NULL) {
++		printf( "JS_NewObject failed in SFRotationInverse.\n");
+ 		return JS_FALSE;
+ 	}
+ #if JS_VERSION < 185
+@@ -1979,8 +1979,8 @@ SFRotationMultiply(JSContext *cx, uint32
+ 		return JS_FALSE;
+ 	}
+ 
+-	if ((_retObj = JS_ConstructObject(cx, &SFRotationClass, _proto)) == NULL) {
+-		printf( "JS_ConstructObject failed in SFRotationMultiply.\n");
++	if ((_retObj = JS_NewObject(cx, &SFRotationClass, _proto, NULL)) == NULL) {
++		printf( "JS_NewObject failed in SFRotationMultiply.\n");
+ 		return JS_FALSE;
+ 	}
+ 
+@@ -2060,8 +2060,8 @@ SFRotationMultVec(JSContext *cx, uint32_
+ 		return JS_FALSE;
+ 	}
+ 
+-	if ((_retObj = JS_ConstructObject(cx, &SFVec3fClass, _proto)) == NULL) {
+-		printf( "JS_ConstructObject failed in SFRotationMultVec.\n");
++	if ((_retObj = JS_NewObject(cx, &SFVec3fClass, _proto, NULL)) == NULL) {
++		printf( "JS_NewObject failed in SFRotationMultVec.\n");
+ 		return JS_FALSE;
+ 	}
+ 
+@@ -2203,8 +2203,8 @@ SFRotationSlerp(JSContext *cx, uint32_t
+ 			return JS_FALSE;
+ 		}
+ 
+-		if ((_retObj = JS_ConstructObject(cx, &SFRotationClass, _proto)) == NULL) {
+-			printf( "JS_ConstructObject failed in SFRotationSlerp.\n");
++		if ((_retObj = JS_NewObject(cx, &SFRotationClass, _proto, NULL)) == NULL) {
++			printf( "JS_NewObject failed in SFRotationSlerp.\n");
+ 			return JS_FALSE;
+ 		}
+ 		/* root the object */
+@@ -2775,8 +2775,8 @@ JSBool SFVec2fGeneric( JSContext *cx, JS
+ 			return JS_FALSE;
+ 		}
+ 		if ((_retObj =
+-			JS_ConstructObject(cx, &SFVec2fClass, _proto)) == NULL) {
+-			printf( "JS_ConstructObject failed in SFVec2f.\n");
++			JS_NewObject(cx, &SFVec2fClass, _proto, NULL)) == NULL) {
++			printf( "JS_NewObject failed in SFVec2f.\n");
+ 			return JS_FALSE;
+ 		}
+ 		*rval = OBJECT_TO_JSVAL(_retObj);
+@@ -3336,8 +3336,8 @@ JSBool SFVec3fGeneric( JSContext *cx, JS
+ 			return JS_FALSE;
+ 		}
+ 		if ((_retObj =
+-			JS_ConstructObject(cx, &SFVec3fClass, _proto)) == NULL) {
+-			printf( "JS_ConstructObject failed in SFVec3f.\n");
++			JS_NewObject(cx, &SFVec3fClass, _proto, NULL)) == NULL) {
++			printf( "JS_NewObject failed in SFVec3f.\n");
+ 			return JS_FALSE;
+ 		}
+ 		*rval = OBJECT_TO_JSVAL(_retObj);
+@@ -3988,8 +3988,8 @@ JSBool SFVec3dGeneric( JSContext *cx, JS
+ 			return JS_FALSE;
+ 		}
+ 		if ((_retObj =
+-			JS_ConstructObject(cx, &SFVec3dClass, _proto)) == NULL) {
+-			printf( "JS_ConstructObject failed in SFVec3d.\n");
++			JS_NewObject(cx, &SFVec3dClass, _proto, NULL)) == NULL) {
++			printf( "JS_NewObject failed in SFVec3d.\n");
+ 			return JS_FALSE;
+ 		}
+ 		*rval = OBJECT_TO_JSVAL(_retObj);
diff --git a/freewrl-1.22.13-wrappers-removed-api.patch b/freewrl-1.22.13-wrappers-removed-api.patch
new file mode 100644
index 0000000..a7d8f24
--- /dev/null
+++ b/freewrl-1.22.13-wrappers-removed-api.patch
@@ -0,0 +1,36 @@
+diff -upa freewrl-1.22.13/src/lib/world_script/JScript.c.wrappers freewrl-1.22.13/src/lib/world_script/JScript.c
+--- freewrl-1.22.13/src/lib/world_script/JScript.c.wrappers	2013-02-01 16:50:22.080423176 +0100
++++ freewrl-1.22.13/src/lib/world_script/JScript.c	2013-02-01 16:50:41.045422498 +0100
+@@ -81,6 +81,13 @@ static JSClass staticGlobalClass = {
+ 
+ #endif // HAVE_JAVASCRIPT
+ 
++static JSBool JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
++{
++        *rval = JS_NumberValue(d);
++        if (JSVAL_IS_NUMBER(*rval))
++                return JS_TRUE;
++        return JS_FALSE;
++}
+ 
+ typedef struct pJScript{
+ 	/* Script name/type table */
+diff -upa freewrl-1.22.13/src/lib/world_script/JScript.h.wrappers freewrl-1.22.13/src/lib/world_script/JScript.h
+--- freewrl-1.22.13/src/lib/world_script/JScript.h.wrappers	2013-02-01 16:47:41.128428929 +0100
++++ freewrl-1.22.13/src/lib/world_script/JScript.h	2013-02-01 16:53:37.180416202 +0100
+@@ -32,6 +32,15 @@ $Id: JScript.h,v 1.9 2011/01/04 19:50:19
+ 
+ #include <system_js.h>
+ 
++/*
++ * Wrappers for removed API
++ */
++#ifndef JSVAL_IS_OBJECT
++#define JSVAL_IS_OBJECT(obj) (JSVAL_IS_NULL(obj) || !JSVAL_IS_PRIMITIVE(obj))
++#endif
++
++static JSBool JS_NewNumberValue(JSContext *cx, double d, jsval *rval);
++
+ void kill_javascript(void);
+ void cleanupDie(int num, const char *msg);
+ void JSMaxAlloc(void);
diff --git a/freewrl.spec b/freewrl.spec
index 4e19113..ce16307 100644
--- a/freewrl.spec
+++ b/freewrl.spec
@@ -16,6 +16,9 @@ Patch3:		freewrl-1.22.13-use-JS_NewGlobalObject.patch
 # Sometimes JS_GetPrototype has one arg, sometimes two, now three.
 # What day is it today?
 Patch4:		freewrl-1.22.13-JS_GetPrototype-three-args.patch
+# Some wrappers for removed API
+Patch5:		freewrl-1.22.13-wrappers-removed-api.patch
+Patch6:		freewrl-1.22.13-no-JS_ConstructObject.patch
 BuildRequires:	zlib-devel, freetype-devel, fontconfig-devel 
 BuildRequires:	imlib2-devel, nspr-devel, xulrunner-devel
 BuildRequires:	expat-devel, libXxf86vm-devel, libX11-devel, libXext-devel
@@ -81,6 +84,8 @@ browser plugin for Firefox (and other xulrunner compatible browsers).
 %patch2 -p1 -b .noMaybeGC
 %patch3 -p1 -b .NewGlobalObject
 %patch4 -p1 -b .jsgp
+%patch5 -p1 -b .wrappers
+%patch6 -p1 -b .nojsco
 cp %{SOURCE1} .
 # Don't need it.
 rm -rf appleOSX/
@@ -156,6 +161,7 @@ chrpath --delete %{buildroot}%{_libdir}/libFreeWRLEAI.so.*
 %changelog
 * Fri Feb  1 2013 Tom Callaway <spot at fedoraproject.org> - 1.22.13.1-7
 - three args for JS_GetPrototype today
+- fix more abandoned API
 
 * Wed Jan  9 2013 Tom Callaway <spot at fedoraproject.org> - 1.22.13.1-6
 - use JS_NewGlobalObject instead of JS_NewCompartmentAndGlobalObject


More information about the scm-commits mailing list