Improvements made to the uzbl_tabbed.py fifo init and fifo cleanup code.
[uzbl-mobile] / uzbl.c
diff --git a/uzbl.c b/uzbl.c
index ea2e910..e2148fd 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -88,8 +88,6 @@ enum ptr_type {TYPE_INT, TYPE_STR, TYPE_FLOAT};
 
 /* associate command names to their properties */
 typedef struct {
-    /* TODO: Make this ambiguous void **ptr into a union { char *char_p; int *int_p; float *float_p; } val;
-             the PTR() macro is kind of preventing this change at the moment. */
     enum ptr_type type;
     union {
         int *i;
@@ -224,10 +222,12 @@ const struct {
 /* construct a hash from the var_name_to_ptr array for quick access */
 void
 make_var_to_name_hash() {
-    struct var_name_to_ptr_t *n2v_p = &var_name_to_ptr;
+    const struct var_name_to_ptr_t *n2v_p = var_name_to_ptr;
     uzbl.comm.proto_var = g_hash_table_new(g_str_hash, g_str_equal);
     while(n2v_p->name) {
-        g_hash_table_insert(uzbl.comm.proto_var, n2v_p->name, (gpointer) &n2v_p->cp);
+        g_hash_table_insert(uzbl.comm.proto_var,
+                (gpointer) n2v_p->name,
+                (gpointer) &n2v_p->cp);
         n2v_p++;
     }
 }
@@ -305,6 +305,9 @@ expand(const char *s, guint recurse) {
                         vend = strstr(s, "]@");
                         if(!vend) vend = strchr(s, '\0');
                         break;
+                    /*@notreached@*/
+                    case EXP_ERR:
+                        break;
                 }
                 assert(vend);
 
@@ -315,7 +318,8 @@ expand(const char *s, guint recurse) {
                     if( (c = g_hash_table_lookup(uzbl.comm.proto_var, ret)) ) {
                         if(c->type == TYPE_STR && *c->ptr.s != NULL) {
                             g_string_append(buf, (gchar *)*c->ptr.s);
-                        } else if(c->type == TYPE_INT) {
+                        }
+                        else if(c->type == TYPE_INT) {
                             g_string_append_printf(buf, "%d", *c->ptr.i);
                         }
                         else if(c->type == TYPE_FLOAT) {
@@ -846,7 +850,7 @@ commands_hash(void)
     uzbl.behave.commands = g_hash_table_new(g_str_hash, g_str_equal);
 
     for (i = 0; i < LENGTH(cmdlist); i++)
-        g_hash_table_insert(uzbl.behave.commands, cmdlist[i].key, &cmdlist[i].value);
+        g_hash_table_insert(uzbl.behave.commands, (gpointer) cmdlist[i].key, &cmdlist[i].value);
 }
 
 /* -- CORE FUNCTIONS -- */
@@ -2925,10 +2929,13 @@ main (int argc, char* argv[]) {
     uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h);
     gtk_widget_set_scroll_adjustments ((GtkWidget*) uzbl.gui.web_view, uzbl.gui.bar_h, uzbl.gui.bar_v);
 
-    if(uzbl.gui.geometry)
-        cmd_set_geometry();
-    else
-        retrieve_geometry();
+    /* Check uzbl is in window mode before getting/setting geometry */
+    if (uzbl.gui.main_window) {
+        if(uzbl.gui.geometry)
+            cmd_set_geometry();
+        else
+            retrieve_geometry();
+    }
 
     gchar *uri_override = (uzbl.state.uri ? g_strdup(uzbl.state.uri) : NULL);
     if (argc > 1 && !uzbl.state.uri)