- more assert fun, but with quaterinions! :)

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3706 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2010-07-25 12:00:52 +00:00
parent aa8cbd1978
commit 6ddd61a87f
2 changed files with 10 additions and 4 deletions

View File

@ -43,10 +43,10 @@ BOOL JSValueToQuaternion(JSContext *context, jsval value, Quaternion *outQuatern
anything else, return NO. (Other implicit conversions may be added in
future.)
*/
BOOL JSObjectGetQuaternion(JSContext *context, JSObject *quaternionObj, Quaternion *outQuaternion) NONNULL_FUNC;
BOOL JSObjectGetQuaternion(JSContext *context, JSObject *quaternionObj, Quaternion *outQuaternion) GCC_ATTR((nonnull (1, 4)));
// Set the value of a JS quaternion object.
BOOL JSQuaternionSetQuaternion(JSContext *context, JSObject *quaternionObj, Quaternion quaternion) NONNULL_FUNC;
BOOL JSQuaternionSetQuaternion(JSContext *context, JSObject *quaternionObj, Quaternion quaternion) GCC_ATTR((nonnull (1)));
/* QuaternionFromArgumentList()

View File

@ -203,13 +203,16 @@ BOOL JSObjectGetQuaternion(JSContext *context, JSObject *quaternionObj, Quaterni
{
OOJS_PROFILE_ENTER
assert(outQuaternion != NULL);
Quaternion *private = NULL;
Entity *entity = nil;
jsuint arrayLength;
jsval arrayW, arrayX, arrayY, arrayZ;
jsdouble dVal;
assert(outQuaternion != NULL && quaternionObj != NULL);
// quaternionObj can legitimately be NULL, e.g. when JS_NULL is converted to a JSObject *.
if (quaternionObj == NULL) return NO;
private = JS_GetInstancePrivate(context, quaternionObj, &sQuaternionClass.base, NULL);
if (private != NULL) // If this is a (JS) Quaternion...
@ -293,7 +296,8 @@ static BOOL QuaternionFromArgumentListNoErrorInternal(JSContext *context, uintN
double w, x, y, z;
assert(argc != 0 && argv != NULL && outQuaternion != NULL);
if (EXPECT_NOT(argc == 0)) return NO;
assert(argv != NULL && outQuaternion != NULL);
if (outConsumed != NULL) *outConsumed = 0;
@ -492,6 +496,8 @@ static JSBool QuaternionEquality(JSContext *context, JSObject *this, jsval value
{
OOJS_PROFILE_ENTER
assert(outEqual != NULL);
Quaternion thisq, thatq;
// Note: "return YES" means no error, not equality.