[Swfdec-commits] vivified/code

Benjamin Otte company at kemper.freedesktop.org
Fri Nov 27 08:41:03 PST 2009


 vivified/code/vivi_decompiler.c |   71 +++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 32 deletions(-)

New commits:
commit 86aac5f2b7dd5b2685b92225a7ba1c03949928a7
Author: Johan Gill <johan.gill at gmail.com>
Date:   Fri Nov 27 17:40:46 2009 +0100

    Fix compile warnings in vivified

diff --git a/vivified/code/vivi_decompiler.c b/vivified/code/vivi_decompiler.c
index 0d49678..e3b751b 100644
--- a/vivified/code/vivi_decompiler.c
+++ b/vivified/code/vivi_decompiler.c
@@ -459,23 +459,26 @@ vivi_decompile_function_call (ViviDecompilerBlock *block, ViviDecompilerState *s
   if (name)
     g_object_unref (name);
 
-  if (!VIVI_IS_CODE_NUMBER (args) || 
-      ((count = d = vivi_code_number_get_value (VIVI_CODE_NUMBER (args))) != d)) {
-    vivi_decompiler_block_add_error (block, state, "could not determine function argument count");
-    g_object_unref (args);
-    g_object_unref (call);
-    return NULL;
+  if (VIVI_IS_CODE_NUMBER (args)) {
+    count = d = vivi_code_number_get_value (VIVI_CODE_NUMBER (args));
+    if (count == d) {
+      g_object_unref (args);
+
+      count = MIN (count, vivi_decompiler_state_get_stack_depth (state));
+      for (i = 0; i < count; i++) {
+	value = vivi_decompiler_state_pop (state);
+	vivi_code_function_call_add_argument (VIVI_CODE_FUNCTION_CALL (call), value);
+	g_object_unref (value);
+      }
+      vivi_decompiler_state_push (state, call);
+      return call;
+    }
   }
+  /* Invalid code number, or problem getting a value for the code number */
+  vivi_decompiler_block_add_error (block, state, "could not determine function argument count");
   g_object_unref (args);
-
-  count = MIN (count, vivi_decompiler_state_get_stack_depth (state));
-  for (i = 0; i < count; i++) {
-    value = vivi_decompiler_state_pop (state);
-    vivi_code_function_call_add_argument (VIVI_CODE_FUNCTION_CALL (call), value);
-    g_object_unref (value);
-  }
-  vivi_decompiler_state_push (state, call);
-  return call;
+  g_object_unref (call);
+  return NULL;
 }
 
 static gboolean
@@ -651,25 +654,29 @@ vivi_decompile_init_object (ViviDecompilerBlock *block, ViviDecompilerState *sta
   guint i, count;
 
   args = vivi_decompiler_state_pop (state);
-  if (!VIVI_IS_CODE_NUMBER (args) || 
-      ((count = d = vivi_code_number_get_value (VIVI_CODE_NUMBER (args))) != d)) {
-    vivi_decompiler_block_add_error (block, state, "could not determine init object argument count");
-    g_object_unref (args);
-    return FALSE;
+  if (VIVI_IS_CODE_NUMBER (args)) {
+    count = d = vivi_code_number_get_value (VIVI_CODE_NUMBER (args));
+    if (count == d) {
+      /* All is well */
+      g_object_unref (args);
+      count = MIN (count, (vivi_decompiler_state_get_stack_depth (state) + 1) / 2);
+
+      init = vivi_code_init_object_new ();
+      for (i = 0; i < count; i++) {
+	value = vivi_decompiler_state_pop (state);
+	name = vivi_decompiler_state_pop (state);
+	vivi_code_init_object_add_variable (VIVI_CODE_INIT_OBJECT (init), name, value);
+	g_object_unref (name);
+	g_object_unref (value);
+      }
+      vivi_decompiler_state_push (state, init);
+      return TRUE;
+    }
   }
+  /* Invalid code number, or problem getting a value for the code number */
+  vivi_decompiler_block_add_error (block, state, "could not determine init object argument count");
   g_object_unref (args);
-  count = MIN (count, (vivi_decompiler_state_get_stack_depth (state) + 1) / 2);
-
-  init = vivi_code_init_object_new ();
-  for (i = 0; i < count; i++) {
-    value = vivi_decompiler_state_pop (state);
-    name = vivi_decompiler_state_pop (state);
-    vivi_code_init_object_add_variable (VIVI_CODE_INIT_OBJECT (init), name, value);
-    g_object_unref (name);
-    g_object_unref (value);
-  }
-  vivi_decompiler_state_push (state, init);
-  return TRUE;
+  return FALSE;
 }
 
 static DecompileFunc decompile_funcs[256] = {


More information about the Swfdec-commits mailing list