diff gtk/dw.c @ 986:87dc0f5f96d0

Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return. Changed return values of a number of functions to be consistent across platforms and use the defines.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 07 May 2011 05:14:06 +0000
parents 2497a806d34e
children 98d73c9e81fc
line wrap: on
line diff
--- a/gtk/dw.c	Sat May 07 02:15:50 2011 +0000
+++ b/gtk/dw.c	Sat May 07 05:14:06 2011 +0000
@@ -6292,7 +6292,7 @@
    if(!clist)
    {
       DW_MUTEX_UNLOCK;
-      return FALSE;
+      return DW_ERROR_GENERAL;
    }
    multi = (int)gtk_object_get_data(GTK_OBJECT(handle), "_dw_multi");
    gtk_object_set_data(GTK_OBJECT(handle), "_dw_multi", GINT_TO_POINTER(multi));
@@ -6326,7 +6326,7 @@
    }
 
    DW_MUTEX_UNLOCK;
-   return TRUE;
+   return DW_ERROR_NONE;
 }
 
 /*
@@ -6356,6 +6356,7 @@
 {
    char **newtitles = malloc(sizeof(char *) * (count + 1));
    unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1));
+   int res;
 
    newtitles[0] = "Filename";
 
@@ -6364,11 +6365,11 @@
    memcpy(&newtitles[1], titles, sizeof(char *) * count);
    memcpy(&newflags[1], flags, sizeof(unsigned long) * count);
 
-   _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1);
+   res = _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1);
 
    if ( newtitles) free(newtitles);
    if ( newflags ) free(newflags);
-   return TRUE;
+   return res;
 }
 
 /*
@@ -8370,14 +8371,14 @@
 int dw_event_reset (HEV eve)
 {
    if(!eve)
-      return FALSE;
+      return DW_ERROR_NON_INIT;
 
    pthread_mutex_lock (&(eve->mutex));
    pthread_cond_broadcast (&(eve->event));
    pthread_cond_init (&(eve->event), NULL);
    eve->posted = 0;
    pthread_mutex_unlock (&(eve->mutex));
-   return 0;
+   return DW_ERROR_NONE;
 }
 
 /*
@@ -8389,13 +8390,13 @@
 int dw_event_post (HEV eve)
 {
    if(!eve)
-      return FALSE;
+      return DW_ERROR_NON_INIT;
 
    pthread_mutex_lock (&(eve->mutex));
    pthread_cond_broadcast (&(eve->event));
    eve->posted = 1;
    pthread_mutex_unlock (&(eve->mutex));
-   return 0;
+   return DW_ERROR_NONE;
 }
 
 /*
@@ -8411,10 +8412,10 @@
    struct timespec timeo;
 
    if(!eve)
-      return FALSE;
+      return DW_ERROR_NON_INIT;
 
    if(eve->posted)
-      return 0;
+      return DW_ERROR_GENERAL;
 
    pthread_mutex_lock (&(eve->mutex));
    gettimeofday(&now, 0);
@@ -8423,10 +8424,10 @@
    rc = pthread_cond_timedwait (&(eve->event), &(eve->mutex), &timeo);
    pthread_mutex_unlock (&(eve->mutex));
    if(!rc)
-      return 1;
+      return DW_ERROR_NONE;
    if(rc == ETIMEDOUT)
-      return -1;
-   return 0;
+      return DW_ERROR_TIMEOUT;
+   return DW_ERROR_GENERAL;
 }
 
 /*
@@ -8437,7 +8438,7 @@
 int dw_event_close(HEV *eve)
 {
    if(!eve || !(*eve))
-      return FALSE;
+      return DW_ERROR_NON_INIT;
 
    pthread_mutex_lock (&((*eve)->mutex));
    pthread_cond_destroy (&((*eve)->event));
@@ -8446,7 +8447,7 @@
    free(*eve);
    *eve = NULL;
 
-   return TRUE;
+   return DW_ERROR_NONE;
 }
 
 struct _seminfo {
@@ -10112,7 +10113,7 @@
  * Parameters:
  *          handle: Handle to the listbox to be queried.
  */
-unsigned int dw_listbox_selected(HWND handle)
+int dw_listbox_selected(HWND handle)
 {
    GtkWidget *handle2 = handle;
    int retval = DW_LIT_NONE;