5778593
diff -up cups-filters-1.0.69/utils/cups-browsed.c.browsed-sources cups-filters-1.0.69/utils/cups-browsed.c
5778593
--- cups-filters-1.0.69/utils/cups-browsed.c.browsed-sources	2015-05-30 23:37:24.000000000 +0100
5778593
+++ cups-filters-1.0.69/utils/cups-browsed.c	2015-06-22 12:43:17.951984451 +0100
5778593
@@ -173,7 +173,7 @@ static AvahiGLibPoll *glib_poll = NULL;
5778593
 static AvahiClient *client = NULL;
5778593
 static AvahiServiceBrowser *sb1 = NULL, *sb2 = NULL;
5778593
 #endif /* HAVE_AVAHI */
5778593
-static guint queues_timer_id = (guint) -1;
5778593
+static guint queues_timer_id = 0;
5778593
 static int browsesocket = -1;
5778593
 
5778593
 #define BROWSE_DNSSD (1<<0)
5778593
@@ -185,14 +185,14 @@ static unsigned int BrowseTimeout = 300;
5778593
 static uint16_t BrowsePort = 631;
5778593
 static browsepoll_t **BrowsePoll = NULL;
5778593
 static size_t NumBrowsePoll = 0;
5778593
-static guint update_netifs_sourceid = -1;
5778593
+static guint update_netifs_sourceid = 0;
5778593
 static char *DomainSocket = NULL;
5778593
 static unsigned int CreateIPPPrinterQueues = 0;
5778593
 static ipp_queue_type_t IPPPrinterQueueType = PPD_AUTO;
5778593
 static int autoshutdown = 0;
5778593
 static int autoshutdown_avahi = 0;
5778593
 static int autoshutdown_timeout = 30;
5778593
-static guint autoshutdown_exec_id = -1;
5778593
+static guint autoshutdown_exec_id = 0;
5778593
 
5778593
 static int debug = 0;
5778593
 
5778593
@@ -1051,11 +1051,11 @@ create_local_queue (const char *name,
5778593
 
5778593
   /* If auto shutdown is active we have perhaps scheduled a timer to shut down
5778593
      due to not having queues any more to maintain, kill the timer now */
5778593
-  if (autoshutdown && autoshutdown_exec_id > 0 &&
5778593
+  if (autoshutdown && autoshutdown_exec_id &&
5778593
       cupsArrayCount(remote_printers) > 0) {
5778593
     debug_printf ("cups-browsed: New printers there to make available, killing auto shutdown timer.\n");
5778593
     g_source_remove(autoshutdown_exec_id);
5778593
-    autoshutdown_exec_id = -1;
5778593
+    autoshutdown_exec_id = 0;
5778593
   }
5778593
 
5778593
   return p;
5778593
@@ -1289,7 +1289,7 @@ gboolean handle_cups_queues(gpointer unu
5778593
 
5778593
       /* If auto shutdown is active and all printers we have set up got removed
5778593
 	 again, schedule the shutdown in autoshutdown_timeout seconds */
5778593
-      if (autoshutdown && autoshutdown_exec_id <= 0 &&
5778593
+      if (autoshutdown && !autoshutdown_exec_id &&
5778593
 	  cupsArrayCount(remote_printers) == 0) {
5778593
 	debug_printf ("cups-browsed: No printers there any more to make available, shutting down in %d sec...\n", autoshutdown_timeout);
5778593
 	autoshutdown_exec_id =
5778593
@@ -1440,14 +1440,14 @@ recheck_timer (void)
5778593
     } else if (timeout == (time_t) -1 || p->timeout - now < timeout)
5778593
       timeout = p->timeout - now;
5778593
 
5778593
-  if (queues_timer_id > 0)
5778593
+  if (queues_timer_id)
5778593
     g_source_remove (queues_timer_id);
5778593
 
5778593
   if (timeout != (time_t) -1) {
5778593
     queues_timer_id = g_timeout_add_seconds (timeout, handle_cups_queues, NULL);
5778593
     debug_printf("cups-browsed: checking queues in %ds\n", timeout);
5778593
   } else {
5778593
-    queues_timer_id = (guint) -1;
5778593
+    queues_timer_id = 0;
5778593
     debug_printf("cups-browsed: listening\n");
5778593
   }
5778593
 }
5778593
@@ -1999,7 +1999,7 @@ void avahi_browser_shutdown() {
5778593
     debug_printf("cups-browsed: Avahi server disappeared, switching to auto shutdown mode ...\n");
5778593
     /* If there are no printers schedule the shutdown in autoshutdown_timeout
5778593
        seconds */
5778593
-    if (autoshutdown_exec_id <= 0 &&
5778593
+    if (!autoshutdown_exec_id &&
5778593
 	cupsArrayCount(remote_printers) == 0) {
5778593
       debug_printf ("cups-browsed: We entered auto shutdown mode and no printers are there to make available, shutting down in %d sec...\n", autoshutdown_timeout);
5778593
       autoshutdown_exec_id =
5778593
@@ -2059,10 +2059,10 @@ static void client_callback(AvahiClient
5778593
       autoshutdown = 0;
5778593
       debug_printf("cups-browsed: Avahi server available, switching to permanent mode ...\n");
5778593
       /* If there is still an active auto shutdown timer, kill it */
5778593
-      if (autoshutdown_exec_id > 0) {
5778593
+      if (autoshutdown_exec_id) {
5778593
 	debug_printf ("cups-browsed: We have left auto shutdown mode, killing auto shutdown timer.\n");
5778593
 	g_source_remove(autoshutdown_exec_id);
5778593
-	autoshutdown_exec_id = -1;
5778593
+	autoshutdown_exec_id = 0;
5778593
       }
5778593
     }
5778593
 
5778593
@@ -2370,7 +2370,7 @@ update_netifs (gpointer data)
5778593
   struct ifaddrs *ifaddr, *ifa;
5778593
   netif_t *iface;
5778593
 
5778593
-  update_netifs_sourceid = -1;
5778593
+  update_netifs_sourceid = 0;
5778593
   if (getifaddrs (&ifaddr) == -1) {
5778593
     debug_printf("cups-browsed: unable to get interface addresses: %s\n",
5778593
 		 strerror (errno));
5778593
@@ -2921,10 +2921,10 @@ sigusr1_handler(int sig) {
5778593
   autoshutdown = 0;
5778593
   debug_printf("cups-browsed: Caught signal %d, switching to permanent mode ...\n", sig);
5778593
   /* If there is still an active auto shutdown timer, kill it */
5778593
-  if (autoshutdown_exec_id > 0) {
5778593
+  if (autoshutdown_exec_id) {
5778593
     debug_printf ("cups-browsed: We have left auto shutdown mode, killing auto shutdown timer.\n");
5778593
     g_source_remove(autoshutdown_exec_id);
5778593
-    autoshutdown_exec_id = -1;
5778593
+    autoshutdown_exec_id = 0;
5778593
   }
5778593
 }
5778593
 
5778593
@@ -2937,7 +2937,7 @@ sigusr2_handler(int sig) {
5778593
   debug_printf("cups-browsed: Caught signal %d, switching to auto shutdown mode ...\n", sig);
5778593
   /* If there are no printers schedule the shutdown in autoshutdown_timeout
5778593
      seconds */
5778593
-  if (autoshutdown_exec_id <= 0 &&
5778593
+  if (!autoshutdown_exec_id &&
5778593
       cupsArrayCount(remote_printers) == 0) {
5778593
     debug_printf ("cups-browsed: We entered auto shutdown mode and no printers are there to make available, shutting down in %d sec...\n", autoshutdown_timeout);
5778593
     autoshutdown_exec_id =
5778593
@@ -3161,7 +3161,7 @@ read_configuration (const char *filename
5778593
 static void
5778593
 defer_update_netifs (void)
5778593
 {
5778593
-  if (update_netifs_sourceid > 0)
5778593
+  if (update_netifs_sourceid)
5778593
     g_source_remove (update_netifs_sourceid);
5778593
 
5778593
   update_netifs_sourceid = g_timeout_add_seconds (10, update_netifs, NULL);
5778593
@@ -3485,7 +3485,7 @@ int main(int argc, char*argv[]) {
5778593
 
5778593
   /* If auto shutdown is active and we do not find any printers initially,
5778593
      schedule the shutdown in autoshutdown_timeout seconds */
5778593
-  if (autoshutdown && autoshutdown_exec_id <= 0 &&
5778593
+  if (autoshutdown && !autoshutdown_exec_id &&
5778593
       cupsArrayCount(remote_printers) == 0) {
5778593
     debug_printf ("cups-browsed: No printers found to make available, shutting down in %d sec...\n", autoshutdown_timeout);
5778593
     autoshutdown_exec_id =