Fix more compile warnings for Windows in socket.c.
[claws.git] / src / ldapquery.c
index 2c504abbca4d1d3dfb964b6d6e817055a6f8cf9b..4ad97791271b10a9991be4de7e08a1edd6ce9967 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2003-2012 Match Grun and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2003-2015 Match Grun and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 /*
@@ -507,7 +506,7 @@ static GList *ldapqry_build_items_fl(
                                }
                        }
                        if( fullName ) {
-                               g_strchug( fullName ); g_strchomp( fullName );
+                               g_strstrip( fullName );
                                allocated = TRUE;
                        }
                }
@@ -527,7 +526,7 @@ static GList *ldapqry_build_items_fl(
                if (attrib->name && strcmp(attrib->name, "jpegPhoto")) {
                        addritem_person_add_attribute( person, attrib );
                } else {
-                       if (qry && qry->server && qry->server->control) {
+                       if (qry->server && qry->server->control) {
                                gchar *dir = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, 
                                                        ADDRBOOK_DIR, G_DIR_SEPARATOR_S, NULL );
                                gchar *filename = g_strdup_printf("%s-%s-%s",
@@ -640,7 +639,7 @@ static GList *ldapqry_process_single_entry(
        if( ber != NULL ) {
                ber_free( ber, 0 );
        }
-       g_free( dnEntry );
+       ldap_memfree( dnEntry );
 
        return listReturn;
 }
@@ -822,7 +821,11 @@ static gint ldapqry_search_retrieve( LdapQuery *qry ) {
        }
        ADDRQUERY_RETVAL(qry) = LDAPRC_STOP_FLAG;
 
+#ifdef G_OS_WIN32
+       debug_print("Total results are: %lu\n", ldap_count_entries(ld, result));
+#else
        debug_print("Total results are: %d\n", ldap_count_entries(ld, result));
+#endif
 
        /* Process results */
        first = TRUE;
@@ -974,8 +977,12 @@ gint ldapqry_read_data_th( LdapQuery *qry ) {
                        qry->thread = g_malloc0( sizeof( pthread_t ) );
 
                        /* Setup thread */                      
-                       pthread_create( qry->thread, NULL,
-                               (void *) ldapqry_search, (void *) qry );
+                       if (pthread_create( qry->thread, NULL,
+                               (void *) ldapqry_search, (void *) qry ) != 0) {
+                               g_free(qry->thread);
+                               qry->thread = NULL;
+                               ADDRQUERY_RETVAL(qry) = LDAPRC_SEARCH;
+                       }
                }
        }
        return ADDRQUERY_RETVAL(qry);
@@ -1214,7 +1221,11 @@ static gint ldapqry_locate_retrieve( LdapQuery *qry ) {
                return ADDRQUERY_RETVAL(qry);
        }
 
+#ifdef G_OS_WIN32
+       debug_print("Total results are: %lu\n", ldap_count_entries(ld, result));
+#else
        debug_print("Total results are: %d\n", ldap_count_entries(ld, result));
+#endif
 
        /* Process results */
        ADDRQUERY_RETVAL(qry) = LDAPRC_STOP_FLAG;