[Swfdec] 6 commits - libswfdec/compiler.c libswfdec/swfdec_as_date.h libswfdec/swfdec_text_format.c libswfdec/swfdec_xml.c test/dump.c test/render.c test/render-fast.c

Benjamin Otte company at kemper.freedesktop.org
Thu Nov 15 04:52:32 PST 2007


 libswfdec/compiler.c           |    2 
 libswfdec/swfdec_as_date.h     |    2 
 libswfdec/swfdec_text_format.c |    2 
 libswfdec/swfdec_xml.c         |    2 
 test/dump.c                    |    1 
 test/render-fast.c             |  102 -----------------------------------------
 test/render.c                  |   87 ----------------------------------
 7 files changed, 3 insertions(+), 195 deletions(-)

New commits:
commit 2c9d3fef226dd1ffee9548d2207ba07c8e2a6178
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:51:58 2007 +0100

    s/size_t/gsize/

diff --git a/libswfdec/compiler.c b/libswfdec/compiler.c
index 7299dd6..5a2f75c 100644
--- a/libswfdec/compiler.c
+++ b/libswfdec/compiler.c
@@ -60,7 +60,7 @@ main (int argc, char **argv)
   char *contents;
   GError *error = NULL;
   guint i;
-  size_t len;
+  gsize len;
   byte *data;
 
   if (argc < 2) {
commit 6060502a0ec7dcf948e8a85ad59e59ea39de6c6e
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:50:53 2007 +0100

    another s/size_t/gsize/

diff --git a/libswfdec/swfdec_text_format.c b/libswfdec/swfdec_text_format.c
index c884323..79443a1 100644
--- a/libswfdec/swfdec_text_format.c
+++ b/libswfdec/swfdec_text_format.c
@@ -770,7 +770,7 @@ swfdec_text_format_do_set_tab_stops (SwfdecAsContext *cx,
   }
   else if (SWFDEC_AS_VALUE_IS_STRING (&argv[0]))
   {
-    size_t i, len;
+    gsize i, len;
     SwfdecAsValue val;
 
     len = strlen (SWFDEC_AS_VALUE_GET_STRING (&argv[0]));
commit 9ec6d5c8a83429c6fec7afc17f601202f71c7c42
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:44:19 2007 +0100

    remove unused header

diff --git a/test/dump.c b/test/dump.c
index 56a270d..38a456d 100644
--- a/test/dump.c
+++ b/test/dump.c
@@ -23,7 +23,6 @@
 #include "config.h"
 #endif
 #include <stdio.h>
-#include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
commit 19684b2510e4bb8de0195ba396993e0722151043
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:41:13 2007 +0100

    remove unused files
    
    I wonder how long they've been existing :o

diff --git a/test/render-fast.c b/test/render-fast.c
deleted file mode 100644
index 7e6fdae..0000000
--- a/test/render-fast.c
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <glib.h>
-#include <swfdec.h>
-#include <swfdec_render.h>
-#include <swfdec_decoder.h>
-#include <swfdec_sprite.h>
-#include <swfdec_buffer.h>
-
-
-SwfdecDecoder *s;
-
-void read_swf_file(char *fn);
-
-int main (int argc, char *argv[])
-{
-  char *fn = "it.swf";
-
-  if(argc>=2){
-	fn = argv[1];
-  }
-
-  read_swf_file(fn);
-
-  return 0;
-}
-
-
-
-unsigned char *data;
-int len;
-
-void read_swf_file(char *fn)
-{
-	struct stat sb;
-	int fd;
-	int ret;
-	int i;
-
-	s = swfdec_decoder_new();
-
-	fd = open(fn,O_RDONLY);
-	if(fd<0){
-		perror(fn);
-		exit(1);
-	}
-
-	ret = fstat(fd, &sb);
-	if(ret<0){
-		perror("stat");
-		exit(1);
-	}
-
-	len = sb.st_size;
-	data = malloc(len);
-	ret = read(fd, data, len);
-	if(ret<0){
-		perror("read");
-		exit(1);
-	}
-
-	ret = SWF_NEEDBITS;
-	i = 0;
-	while(ret != SWF_EOF){
-		ret = swfdec_decoder_parse(s);
-		//fprintf(stderr,"swf_parse returned %d\n",ret);
-		if(ret == SWF_NEEDBITS){
-			if(i==len){
-				printf("needbits at eof\n");
-			}
-			if(i+1000 < len){
-				ret = swfdec_decoder_add_data(s,data + i,1000);
-				i += 1000;
-			}else{
-				ret = swfdec_decoder_add_data(s,data + i,len - i);
-				i = len;
-			}
-			//fprintf(stderr,"swf_addbits returned %d\n",ret);
-		}
-        }
-        for (i=0;i<s->main_sprite->n_frames;i++) {
-          SwfdecBuffer *buffer;
-
-          swfdec_render_seek (s, i);
-
-          swfdec_render_iterate (s);
-
-          buffer = swfdec_render_get_image (s);
-          swfdec_buffer_unref (buffer);
-
-          buffer = swfdec_render_get_audio (s);
-          swfdec_buffer_unref (buffer);
-	}
-
-	swfdec_decoder_free(s);
-	g_free(data);
-}
-
diff --git a/test/render.c b/test/render.c
deleted file mode 100644
index 6918ea3..0000000
--- a/test/render.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <glib.h>
-#include <glib-object.h>
-#include <swfdec.h>
-#include <swfdec_decoder.h>
-#include <swfdec_render.h>
-#include <swfdec_sprite.h>
-#include <swfdec_buffer.h>
-#include <ucontext.h>
-#include <sys/mman.h>
-
-#if 0
-void * smash_checker (void * (func) (void *), void *priv);
-void *go(void *priv);
-#endif
-
-void dump_sprite(SwfdecSprite *s);
-
-static void buffer_free (SwfdecBuffer *buffer, void *priv)
-{
-  g_free (buffer->data);
-}
-
-int main (int argc, char *argv[])
-{
-  gsize length;
-  int ret;
-  char *fn = "it.swf";
-  SwfdecDecoder *s;
-  int i;
-  char *contents;
-  SwfdecBuffer *buffer;
-  int n_frames;
-
-  swfdec_init ();
-
-  if(argc>=2){
-	fn = argv[1];
-  }
-
-  ret = g_file_get_contents (fn, &contents, &length, NULL);
-  if (!ret) {
-    exit(1);
-  }
-
-  s = swfdec_decoder_new();
-
-  buffer = swfdec_buffer_new_with_data (contents, length);
-  buffer->free = buffer_free;
-  ret = swfdec_decoder_add_buffer(s, buffer);
-
-  while (ret != SWF_EOF) {
-    ret = swfdec_decoder_parse(s);
-    if (ret == SWF_NEEDBITS) {
-      swfdec_decoder_eof(s);
-    }
-    if (ret == SWF_ERROR) {
-      g_print("error while parsing\n");
-      exit(1);
-    }
-  }
-
-  swfdec_decoder_get_n_frames(s, &n_frames);
-  for (i=0;i<n_frames;i++){
-    SwfdecBuffer *buffer;
-
-    swfdec_render_seek (s, i);
-    swfdec_render_iterate (s);
-
-    buffer = swfdec_render_get_image (s);
-    swfdec_buffer_unref (buffer);
-
-    buffer = swfdec_render_get_audio (s);
-    swfdec_buffer_unref (buffer);
-  }
-
-  g_object_unref (s);
-  s=NULL;
-
-  return 0;
-}
-
commit cc6d444841dbf5486ea0fb0afffd07f92781396d
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:40:36 2007 +0100

    use gsize instead of size_t

diff --git a/libswfdec/swfdec_xml.c b/libswfdec/swfdec_xml.c
index 9edf4d0..0f30d7e 100644
--- a/libswfdec/swfdec_xml.c
+++ b/libswfdec/swfdec_xml.c
@@ -639,7 +639,7 @@ swfdec_xml_parse_text (SwfdecXml *xml, SwfdecXmlNode *node,
   if (end == NULL)
     end = strchr (p, '\0');
 
-  if (!xml->ignoreWhite || strspn (p, " \t\r\n") < (size_t)(end - p))
+  if (!xml->ignoreWhite || strspn (p, " \t\r\n") < (gsize)(end - p))
   {
     text = g_strndup (p, end - p);
     unescaped = swfdec_xml_unescape (SWFDEC_AS_OBJECT (xml)->context, text);
commit 86770e723777a886832ca97836762c7a54af0937
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 15 13:40:17 2007 +0100

    no need for sys/time.h

diff --git a/libswfdec/swfdec_as_date.h b/libswfdec/swfdec_as_date.h
index 547b568..b095520 100644
--- a/libswfdec/swfdec_as_date.h
+++ b/libswfdec/swfdec_as_date.h
@@ -21,8 +21,6 @@
 #ifndef _SWFDEC_AS_DATE_H_
 #define _SWFDEC_AS_DATE_H_
 
-#include <sys/time.h>
-
 #include <libswfdec/swfdec_as_object.h>
 #include <libswfdec/swfdec_as_types.h>
 #include <libswfdec/swfdec_script.h>


More information about the Swfdec mailing list