[Swfdec] 4 commits - libswfdec/js libswfdec/swfdec_bits.c libswfdec/swfdec_codec_adpcm.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_script.c libswfdec/swfdec_shape.c libswfdec/swfdec_tag.c test/sound

Benjamin Otte company at kemper.freedesktop.org
Mon Mar 19 03:39:48 PDT 2007


 libswfdec/js/jsapi.c            |    2 +-
 libswfdec/js/jsatom.c           |    2 +-
 libswfdec/js/jsatom.h           |    6 +++---
 libswfdec/js/jsdhash.c          |    2 +-
 libswfdec/js/jsfun.c            |    2 +-
 libswfdec/js/jsinterp.c         |    4 ++--
 libswfdec/js/jsobj.c            |   15 ++++++++-------
 libswfdec/js/jsobj.h            |   10 +++++-----
 libswfdec/js/jsopcode.c         |   10 +++++-----
 libswfdec/js/jsstr.c            |    2 +-
 libswfdec/js/jstypes.h          |   13 +++++++++++++
 libswfdec/swfdec_bits.c         |    2 +-
 libswfdec/swfdec_codec_adpcm.c  |    2 +-
 libswfdec/swfdec_codec_screen.c |   12 ++++++------
 libswfdec/swfdec_script.c       |    9 +++++----
 libswfdec/swfdec_shape.c        |    6 ++++--
 libswfdec/swfdec_tag.c          |    2 +-
 test/sound/downsample.c         |    2 +-
 18 files changed, 60 insertions(+), 43 deletions(-)

New commits:
diff-tree 98cefbbedf8f1b5f7c1b9169f546cc92e149c341 (from 7f4afa674ee75f84bf3d9e69106bf9332dc0c644)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Mar 19 11:28:35 2007 +0100

    fix printf arguments to be 64bit clean

diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c
index ab46303..860d2c4 100644
--- a/libswfdec/swfdec_bits.c
+++ b/libswfdec/swfdec_bits.c
@@ -455,7 +455,7 @@ swfdec_bits_skip_bytes (SwfdecBits *bits
 {
   swfdec_bits_syncbits (bits);
   if ((guint) (bits->end - bits->ptr) < n_bytes) {
-    SWFDEC_WARNING ("supposed to skip %u bytes, but only %u available",
+    SWFDEC_WARNING ("supposed to skip %u bytes, but only %td available",
 	n_bytes, bits->end - bits->ptr);
     n_bytes = bits->end - bits->ptr;
   }
diff --git a/libswfdec/swfdec_codec_adpcm.c b/libswfdec/swfdec_codec_adpcm.c
index 8cf8da7..f0fcc0d 100644
--- a/libswfdec/swfdec_codec_adpcm.c
+++ b/libswfdec/swfdec_codec_adpcm.c
@@ -76,7 +76,7 @@ swfdec_codec_adpcm_decode_chunk (SwfdecB
     pred[ch] = swfdec_bits_getsbits (bits, 16);
     index[ch] = swfdec_bits_getbits (bits, 6);
     if (index[ch] >= G_N_ELEMENTS (stepSizeTable)) {
-      SWFDEC_ERROR ("initial index too big: %u, max allowed is %u",
+      SWFDEC_ERROR ("initial index too big: %u, max allowed is %td",
 	  index[ch], G_N_ELEMENTS (stepSizeTable) - 1);
       index[ch] = G_N_ELEMENTS (stepSizeTable) - 1;
     }
diff --git a/libswfdec/swfdec_shape.c b/libswfdec/swfdec_shape.c
index 08bd710..7277d87 100644
--- a/libswfdec/swfdec_shape.c
+++ b/libswfdec/swfdec_shape.c
@@ -1030,8 +1030,10 @@ tag_define_morph_shape (SwfdecSwfDecoder
   SWFDEC_LOG ("%u fill bits, %u line bits in end shape", morph->n_fill_bits, morph->n_line_bits);
 
   swfdec_morph_shape_get_recs (s, morph, &end_bits);
-  if (s->b.ptr != s->b.end)
-    SWFDEC_WARNING ("early finish when parsing start shapes: %d bytes", s->b.end - s->b.ptr);
+  if (swfdec_bits_left (&s->b)) {
+    SWFDEC_WARNING ("early finish when parsing start shapes: %u bytes",
+        swfdec_bits_left (&s->b));
+  }
 
   s->b = end_bits;
 
diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c
index d2649b1..255f6c3 100644
--- a/libswfdec/swfdec_tag.c
+++ b/libswfdec/swfdec_tag.c
@@ -221,7 +221,7 @@ tag_func_define_sprite (SwfdecSwfDecoder
     if (tag_len == 0x3f) {
       tag_len = swfdec_bits_get_u32 (&parse);
     }
-    SWFDEC_INFO ("sprite parsing at %d, tag %d %s, length %d",
+    SWFDEC_INFO ("sprite parsing at %td, tag %d %s, length %d",
         parse.ptr - parse.buffer->data, tag,
         swfdec_swf_decoder_get_tag_name (tag), tag_len);
 
diff --git a/test/sound/downsample.c b/test/sound/downsample.c
index 07ca342..4e05d06 100644
--- a/test/sound/downsample.c
+++ b/test/sound/downsample.c
@@ -141,7 +141,7 @@ main (int argc, char **argv)
       copy = tmp;
     }
     if (length % 2 != 0) {
-      g_print ("No more downsampling possible, sample count (%u) is not multiple of 2\n", length);
+      g_print ("No more downsampling possible, sample count (%zu) is not multiple of 2\n", length);
     }
     length = cut_silence (data, length,  2);
   } else {
diff-tree 7f4afa674ee75f84bf3d9e69106bf9332dc0c644 (from de08b4657be55b77c44302fa2c0c8bcb4a20cdec)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Mar 19 11:28:22 2007 +0100

    fix swfdec_action_init_object indexing pointer arrays with overflowing uints instead of ulongs

diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 5c6a0c2..c869e7b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -152,7 +152,7 @@ swfdec_script_ensure_stack (JSContext *c
     return JS_TRUE;
 
   if (n_elements > (guint) (fp->spend - fp->spbase)) {
-    SWFDEC_ERROR ("FIXME: implement stack expansion, we got an overflow (want %u, have %u)",
+    SWFDEC_ERROR ("FIXME: implement stack expansion, we got an overflow (want %u, have %td)",
 	n_elements, (fp->spend - fp->spbase));
     return JS_FALSE;
   }
@@ -1588,7 +1588,8 @@ swfdec_action_init_object (JSContext *cx
 {
   JSStackFrame *fp = cx->fp;
   JSObject *object;
-  guint i, n_args;
+  guint n_args;
+  gulong i;
 
   if (!JS_ValueToECMAUint32 (cx, fp->sp[-1], &n_args))
     return JS_FALSE;
@@ -2118,7 +2119,7 @@ swfdec_action_enumerate2 (JSContext *cx,
   if (!array)
     return JS_FALSE;
   if ((guint) (cx->fp->spend - cx->fp->sp) < array->length) {
-    SWFDEC_ERROR ("FIXME: not enough stack space, need %u, got %d",
+    SWFDEC_ERROR ("FIXME: not enough stack space, need %u, got %td",
 	array->length, cx->fp->spend - cx->fp->sp);
     JS_DestroyIdArray (cx, array);
     return JS_FALSE;
@@ -2963,7 +2964,7 @@ swfdec_script_interpret (SwfdecScript *s
 #ifndef G_DISABLE_ASSERT
     if (checksp != NULL && checksp != fp->sp) {
       /* check stack was handled like expected */
-      g_error ("action %s was supposed to change the stack by %d (+%d -%d), but it changed by %d",
+      g_error ("action %s was supposed to change the stack by %d (+%d -%d), but it changed by %td",
 	  spec->name, spec->add - spec->remove, spec->add, spec->remove,
 	  fp->sp - checksp + spec->add - spec->remove);
     }
diff-tree de08b4657be55b77c44302fa2c0c8bcb4a20cdec (from 4850dc84855288a062f64bcebb257f2c80b58d73)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Mar 19 11:27:18 2007 +0100

    make this code use unsigned variables so array indexes get 64bit clean

diff --git a/libswfdec/swfdec_codec_screen.c b/libswfdec/swfdec_codec_screen.c
index 0ba59f0..417fc58 100644
--- a/libswfdec/swfdec_codec_screen.c
+++ b/libswfdec/swfdec_codec_screen.c
@@ -32,8 +32,8 @@
 typedef struct _SwfdecCodecScreen SwfdecCodecScreen;
 
 struct _SwfdecCodecScreen {
-  guint			width;		/* width of last image */
-  guint			height;		/* height of last image */
+  gulong		width;		/* width of last image */
+  gulong		height;		/* height of last image */
   SwfdecBuffer *	buffer;		/* buffer containing last decoded image */
 };
 
@@ -65,7 +65,7 @@ swfdec_codec_screen_decode (gpointer cod
   SwfdecCodecScreen *screen = codec_data;
   SwfdecBuffer *ret;
   SwfdecBits bits;
-  guint i, j, w, h, bw, bh, stride;
+  gulong i, j, w, h, bw, bh, stride;
 
   swfdec_bits_init (&bits, buffer);
   bw = (swfdec_bits_getbits (&bits, 4) + 1) * 16;
@@ -74,13 +74,13 @@ swfdec_codec_screen_decode (gpointer cod
   h = swfdec_bits_getbits (&bits, 12);
   if (screen->width == 0 || screen->height == 0) {
     if (w == 0 || h == 0) {
-      SWFDEC_ERROR ("width or height is 0: %ux%u", w, h);
+      SWFDEC_ERROR ("width or height is 0: %lux%lu", w, h);
       return NULL;
     }
     screen->width = w;
     screen->height = h;
   } else if (screen->width != w || screen->height != h) {
-    SWFDEC_ERROR ("width or height differ from original: was %ux%u, is %ux%u",
+    SWFDEC_ERROR ("width or height differ from original: was %lux%lu, is %lux%lu",
 	screen->width, screen->height, w, h);
     /* FIXME: this is was ffmpeg does, should we be more forgiving? */
     return NULL;
@@ -100,7 +100,7 @@ swfdec_codec_screen_decode (gpointer cod
     screen->buffer = ret;
   }
   stride = w * 4;
-  SWFDEC_LOG ("size: %u x %u - block size %u x %u\n", w, h, bw, bh);
+  SWFDEC_LOG ("size: %lu x %lu - block size %lu x %lu\n", w, h, bw, bh);
   for (j = 0; j < h; j += bh) {
     for (i = 0; i < w; i += bw) {
       guint x, y, size;
diff-tree 4850dc84855288a062f64bcebb257f2c80b58d73 (from 4b27c650286f819714b1fd9048385796037a516a)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Mar 19 11:26:33 2007 +0100

    make Spidermonkey 64bit clean
    
    This is in large part based on the patch in
    https://bugzilla.mozilla.org/show_bug.cgi?id=265174

diff --git a/libswfdec/js/jsapi.c b/libswfdec/js/jsapi.c
index 7485350..75e594b 100644
--- a/libswfdec/js/jsapi.c
+++ b/libswfdec/js/jsapi.c
@@ -2197,7 +2197,7 @@ DefineProperty(JSContext *cx, JSObject *
     JSAtom *atom;
 
     if (attrs & JSPROP_INDEX) {
-        id = INT_TO_JSVAL((jsint)name);
+        id = INT_TO_JSVAL(JS_PTR_TO_INT32(name));
         atom = NULL;
         attrs &= ~JSPROP_INDEX;
     } else {
diff --git a/libswfdec/js/jsatom.c b/libswfdec/js/jsatom.c
index f0816b2..5714f96 100644
--- a/libswfdec/js/jsatom.c
+++ b/libswfdec/js/jsatom.c
@@ -136,7 +136,7 @@ const char js_ExecutionContext_str[] = "
 const char js_current_str[]          = "current";
 #endif
 
-#define HASH_OBJECT(o)  ((JSHashNumber)(o) >> JSVAL_TAGBITS)
+#define HASH_OBJECT(o)  ((JSHashNumber)(JS_PTR_TO_UINT32(o) >> JSVAL_TAGBITS))
 #define HASH_INT(i)     ((JSHashNumber)(i))
 #define HASH_DOUBLE(dp) ((JSHashNumber)(JSDOUBLE_HI32(*dp) ^ JSDOUBLE_LO32(*dp)))
 #define HASH_BOOLEAN(b) ((JSHashNumber)(b))
diff --git a/libswfdec/js/jsatom.h b/libswfdec/js/jsatom.h
index 6f486c3..804ad66 100644
--- a/libswfdec/js/jsatom.h
+++ b/libswfdec/js/jsatom.h
@@ -95,14 +95,14 @@ struct JSAtomListElement {
 };
 
 #define ALE_ATOM(ale)   ((JSAtom *) (ale)->entry.key)
-#define ALE_INDEX(ale)  ((jsatomid) (ale)->entry.value)
+#define ALE_INDEX(ale)  ((jsatomid) JS_PTR_TO_UINT32 ((ale)->entry.value))
 #define ALE_JSOP(ale)   ((JSOp) (ale)->entry.value)
 #define ALE_VALUE(ale)  ((jsval) (ale)->entry.value)
 #define ALE_NEXT(ale)   ((JSAtomListElement *) (ale)->entry.next)
 
 #define ALE_SET_ATOM(ale,atom)  ((ale)->entry.key = (const void *)(atom))
-#define ALE_SET_INDEX(ale,index)((ale)->entry.value = (void *)(index))
-#define ALE_SET_JSOP(ale,op)    ((ale)->entry.value = (void *)(op))
+#define ALE_SET_INDEX(ale,index)((ale)->entry.value = (void *)(jsuword)(index))
+#define ALE_SET_JSOP(ale,op)    ((ale)->entry.value = (void *)(jsuword)(op))
 #define ALE_SET_VALUE(ale,val)  ((ale)->entry.value = (JSHashEntry *)(val))
 #define ALE_SET_NEXT(ale,link)  ((ale)->entry.next = (JSHashEntry *)(link))
 
diff --git a/libswfdec/js/jsdhash.c b/libswfdec/js/jsdhash.c
index 736de04..1de288b 100644
--- a/libswfdec/js/jsdhash.c
+++ b/libswfdec/js/jsdhash.c
@@ -91,7 +91,7 @@ JS_DHashGetKeyStub(JSDHashTable *table, 
 JS_PUBLIC_API(JSDHashNumber)
 JS_DHashVoidPtrKeyStub(JSDHashTable *table, const void *key)
 {
-    return (JSDHashNumber)key >> 2;
+    return (JSDHashNumber)(unsigned long)key >> 2;
 }
 
 JS_PUBLIC_API(JSBool)
diff --git a/libswfdec/js/jsfun.c b/libswfdec/js/jsfun.c
index a6ae7fc..5418347 100644
--- a/libswfdec/js/jsfun.c
+++ b/libswfdec/js/jsfun.c
@@ -1063,8 +1063,8 @@ fun_finalize(JSContext *cx, JSObject *ob
     if (fun->script)
         js_DestroyScript(cx, fun->script);
     if (fun->swf) {
-	swfdec_script_unref (fun->swf);
 	((struct _SwfdecScript *) fun->swf)->fun = NULL;
+	swfdec_script_unref (fun->swf);
     }
     JS_free(cx, fun);
 }
diff --git a/libswfdec/js/jsinterp.c b/libswfdec/js/jsinterp.c
index fbf54b8..f92e9c9 100644
--- a/libswfdec/js/jsinterp.c
+++ b/libswfdec/js/jsinterp.c
@@ -1534,7 +1534,7 @@ js_Interpret(JSContext *cx, jsval *resul
                                 JS_GetStringBytes(str));
                     }
                 }
-                fprintf(tracefp, " @ %d\n", sp - fp->spbase);
+                fprintf(tracefp, " @ %td\n", sp - fp->spbase);
             }
         }
 #endif
@@ -4259,7 +4259,7 @@ do_call:
                                 JS_GetStringBytes(str));
                     }
                 }
-                fprintf(tracefp, " @ %d\n", sp - fp->spbase);
+                fprintf(tracefp, " @ %td\n", sp - fp->spbase);
             }
             fprintf(tracefp, "  stack: ");
             for (siter = fp->spbase; siter < sp; siter++) {
diff --git a/libswfdec/js/jsobj.c b/libswfdec/js/jsobj.c
index 0f825ff..70cd53a 100644
--- a/libswfdec/js/jsobj.c
+++ b/libswfdec/js/jsobj.c
@@ -375,7 +375,7 @@ js_SetProtoOrParent(JSContext *cx, JSObj
 JS_STATIC_DLL_CALLBACK(JSHashNumber)
 js_hash_object(const void *key)
 {
-    return (JSHashNumber)key >> JSVAL_TAGBITS;
+    return (JSHashNumber)JS_PTR_TO_UINT32(key) >> JSVAL_TAGBITS;
 }
 
 static JSHashEntry *
@@ -404,7 +404,8 @@ MarkSharpObjects(JSContext *cx, JSObject
     he = *hep;
     if (!he) {
         sharpid = 0;
-        he = JS_HashTableRawAdd(table, hep, hash, obj, (void *)sharpid);
+        he = JS_HashTableRawAdd(table, hep, hash, obj,
+                                JS_UINT32_TO_PTR(sharpid));
         if (!he) {
             JS_ReportOutOfMemory(cx);
             return NULL;
@@ -458,10 +459,10 @@ MarkSharpObjects(JSContext *cx, JSObject
         if (!ok)
             return NULL;
     } else {
-        sharpid = (jsatomid) he->value;
+        sharpid = JS_PTR_TO_UINT32(he->value);
         if (sharpid == 0) {
             sharpid = ++map->sharpgen << SHARP_ID_SHIFT;
-            he->value = (void *) sharpid;
+            he->value = JS_UINT32_TO_PTR(sharpid);
         }
         ida = NULL;
     }
@@ -502,7 +503,7 @@ js_EnterSharpObject(JSContext *cx, JSObj
         he = MarkSharpObjects(cx, obj, &ida);
         if (!he)
             goto bad;
-        JS_ASSERT((((jsatomid) he->value) & SHARP_BIT) == 0);
+        JS_ASSERT (!IS_SHARP (he));
         if (!idap) {
             JS_DestroyIdArray(cx, ida);
             ida = NULL;
@@ -531,7 +532,7 @@ js_EnterSharpObject(JSContext *cx, JSObj
         }
     }
 
-    sharpid = (jsatomid) he->value;
+    sharpid = JS_PTR_TO_UINT32(he->value);
     if (sharpid == 0) {
         *sp = NULL;
     } else {
@@ -1108,7 +1109,7 @@ resolving_HashKey(JSDHashTable *table, c
 {
     const JSResolvingKey *key = (const JSResolvingKey *)ptr;
 
-    return ((JSDHashNumber)key->obj >> JSVAL_TAGBITS) ^ key->id;
+    return ((JSDHashNumber) JS_PTR_TO_UINT32(key->obj) >> JSVAL_TAGBITS) ^ key->id;
 }
 
 JS_PUBLIC_API(JSBool)
diff --git a/libswfdec/js/jsobj.h b/libswfdec/js/jsobj.h
index c358d79..528c43b 100644
--- a/libswfdec/js/jsobj.h
+++ b/libswfdec/js/jsobj.h
@@ -240,11 +240,11 @@ struct JSSharpObjectMap {
 #define SHARP_BIT       ((jsatomid) 1)
 #define BUSY_BIT        ((jsatomid) 2)
 #define SHARP_ID_SHIFT  2
-#define IS_SHARP(he)    ((jsatomid)(he)->value & SHARP_BIT)
-#define MAKE_SHARP(he)  ((he)->value = (void*)((jsatomid)(he)->value|SHARP_BIT))
-#define IS_BUSY(he)     ((jsatomid)(he)->value & BUSY_BIT)
-#define MAKE_BUSY(he)   ((he)->value = (void*)((jsatomid)(he)->value|BUSY_BIT))
-#define CLEAR_BUSY(he)  ((he)->value = (void*)((jsatomid)(he)->value&~BUSY_BIT))
+#define IS_SHARP(he)    (JS_PTR_TO_UINT32((he)->value) & SHARP_BIT)
+#define MAKE_SHARP(he)  ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|SHARP_BIT))
+#define IS_BUSY(he)     (JS_PTR_TO_UINT32((he)->value) & BUSY_BIT)
+#define MAKE_BUSY(he)   ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|BUSY_BIT))
+#define CLEAR_BUSY(he)  ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)&~BUSY_BIT))
 
 extern JSHashEntry *
 js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
diff --git a/libswfdec/js/jsopcode.c b/libswfdec/js/jsopcode.c
index fabb9a6..2cb5b5d 100644
--- a/libswfdec/js/jsopcode.c
+++ b/libswfdec/js/jsopcode.c
@@ -180,7 +180,7 @@ js_Disassemble1(JSContext *cx, JSScript 
       case JOF_JUMP:
       case JOF_JUMPX:
         off = GetJumpOffset(pc, pc);
-        fprintf(fp, " %u (%d)", loc + off, off);
+        fprintf(fp, " %td (%td)", loc + off, off);
         break;
 
       case JOF_CONST:
@@ -215,10 +215,10 @@ js_Disassemble1(JSContext *cx, JSScript 
         pc2 += JUMP_OFFSET_LEN;
         high = GET_JUMP_OFFSET(pc2);
         pc2 += JUMP_OFFSET_LEN;
-        fprintf(fp, " defaultOffset %d low %d high %d", off, low, high);
+        fprintf(fp, " defaultOffset %td low %d high %d", off, low, high);
         for (i = low; i <= high; i++) {
             off = GetJumpOffset(pc, pc2);
-            fprintf(fp, "\n\t%d: %d", i, off);
+            fprintf(fp, "\n\t%d: %td", i, off);
             pc2 += jmplen;
         }
         len = 1 + pc2 - pc;
@@ -238,7 +238,7 @@ js_Disassemble1(JSContext *cx, JSScript 
         pc2 += jmplen;
         npairs = (jsint) GET_ATOM_INDEX(pc2);
         pc2 += ATOM_INDEX_LEN;
-        fprintf(fp, " offset %d npairs %u", off, (uintN) npairs);
+        fprintf(fp, " offset %td npairs %u", off, (uintN) npairs);
         while (npairs) {
             atom = GET_ATOM(cx, script, pc2);
             pc2 += ATOM_INDEX_LEN;
@@ -252,7 +252,7 @@ js_Disassemble1(JSContext *cx, JSScript 
                                     JSSTRING_LENGTH(str));
             if (!cstr)
                 return 0;
-            fprintf(fp, "\n\t%s: %d", cstr, off);
+            fprintf(fp, "\n\t%s: %td", cstr, off);
             JS_free(cx, cstr);
             npairs--;
         }
diff --git a/libswfdec/js/jsstr.c b/libswfdec/js/jsstr.c
index 801d81c..3ae214e 100644
--- a/libswfdec/js/jsstr.c
+++ b/libswfdec/js/jsstr.c
@@ -2574,7 +2574,7 @@ js_NewStringCopyZ(JSContext *cx, const j
 JS_STATIC_DLL_CALLBACK(JSHashNumber)
 js_hash_string_pointer(const void *key)
 {
-    return (JSHashNumber)key >> JSVAL_TAGBITS;
+    return (JSHashNumber)JS_PTR_TO_UINT32(key) >> JSVAL_TAGBITS;
 }
 
 void
diff --git a/libswfdec/js/jstypes.h b/libswfdec/js/jstypes.h
index b5c8096..541df9a 100644
--- a/libswfdec/js/jstypes.h
+++ b/libswfdec/js/jstypes.h
@@ -203,6 +203,19 @@
 #define JS_BITMASK(n)   (JS_BIT(n) - 1)
 
 /***********************************************************************
+** MACROS:      JS_PTR_TO_INT32
+**              JS_PTR_TO_UINT32
+**              JS_INT32_TO_PTR
+**              JS_UINT32_TO_PTR
+** DESCRIPTION:
+** Integer to pointer and pointer to integer conversion macros.
+***********************************************************************/
+#define JS_PTR_TO_INT32(x)  ((jsint)((char *)(x) - (char *)0))
+#define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0))
+#define JS_INT32_TO_PTR(x)  ((void *)((char *)0 + (jsint)(x)))
+#define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x)))
+
+/***********************************************************************
 ** MACROS:      JS_HOWMANY
 **              JS_ROUNDUP
 **              JS_MIN


More information about the Swfdec mailing list