changeset 482:1fb0b96a52b8

Fixed a VOIDP2INT bug in the authentication dialog callback.
author Jorge Arellano Cid <jcid@dillo.org>
date Fri, 02 Jan 2009 17:04:10 -0300
parents 77b7a8656fc9
children ba5eed484075 ff39a0f05c39
files ChangeLog src/dialog.cc src/menu.cc
diffstat 3 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 02 16:27:01 2009 -0300
+++ b/ChangeLog	Fri Jan 02 17:04:10 2009 -0300
@@ -28,6 +28,7 @@
  - Standardised the installation of dpid/dpidrc with auto* tools.
  - Set the ScrollGroup as the resizable widget in downloads dpi.
  - Cleaned up and normalized D_SUN_LEN usage.
+ - Fixed incorrect use of VOIDP2INT in Dialog_user_password_cb().
    Patches: Jeremy Henty
 +- Implemented Basic authentication!
    Patch: Jeremy Henty, Jorge Arellano Cid
--- a/src/dialog.cc	Fri Jan 02 16:27:01 2009 -0300
+++ b/src/dialog.cc	Fri Jan 02 17:04:10 2009 -0300
@@ -217,7 +217,7 @@
        b = new HighlightButton(xpos, wh-bh, bw, bh, txt[i]);
        b->align(ALIGN_WRAP|ALIGN_CLIP);
        b->box(UP_BOX);
-       b->callback(choice5_cb, (void*)i);
+       b->callback(choice5_cb, INT2VOIDP(i));
        xpos += bw + gap;
     }
    window->end();
@@ -232,12 +232,14 @@
 
 
 /*--------------------------------------------------------------------------*/
-static int ok_answer = 1, cancel_answer = 0;
+/*
+ * ret: 0 = Cancel, 1 = OK
+ */
 static void Dialog_user_password_cb(Widget *button, void *vIntPtr)
 {
-   int ok = VOIDP2INT(vIntPtr);
-  _MSG("Dialog_user_password_cb: %d\n", ok);
-  button->window()->make_exec_return(ok);
+   int ret = VOIDP2INT(vIntPtr);
+  _MSG("Dialog_user_password_cb: %d\n", ret);
+  button->window()->make_exec_return(ret);
 }
 
 /*
@@ -279,14 +281,14 @@
       new Button(200,button_y,50,button_h,"OK");
    ok_button->labelsize(14);
    ok_button->callback(Dialog_user_password_cb);
-   ok_button->user_data(&ok_answer);
+   ok_button->user_data(INT2VOIDP(1));
 
    /* "Cancel" button */
    Button *cancel_button =
       new Button(50,button_y,100,button_h,"Cancel");
    cancel_button->labelsize(14);
    cancel_button->callback(Dialog_user_password_cb);
-   cancel_button->user_data(&cancel_answer);
+   cancel_button->user_data(INT2VOIDP(0));
 
    window->end();
    window->size_range(window_w,window_h,window_w,window_h);
--- a/src/menu.cc	Fri Jan 02 16:27:01 2009 -0300
+++ b/src/menu.cc	Fri Jan 02 17:04:10 2009 -0300
@@ -615,7 +615,7 @@
     for (i = 0; history_list[i] != -1; i += 1) {
        // TODO: restrict title size
        it = new CustItem(a_History_get_title(history_list[i], 1));
-       it->callback(Menu_history_cb, (void*)(i+1));
+       it->callback(Menu_history_cb, INT2VOIDP(i+1));
     }
    pm->type(PopupMenu::POPUP123);
    pm->end();