Re: [MOD] STR #4170: Ordering in printer listing broken

Michael Sweet <[email protected]> Sat, 15 Sep 2012 11:48:59 -0700 (PDT)
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Closed w/Resolution]

Fixed in Subversion repository.

Link: http://www.cups.org/str.php?L4170
Version: 1.5.3
Fix Version: 1.7-current (r10605)

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
str4170.patch (text/plain, 1.9 KB)
Index: cgi-bin/printers.c
===================================================================
--- cgi-bin/printers.c	(revision 10596)
+++ cgi-bin/printers.c	(working copy)
@@ -397,7 +397,7 @@
     sprintf(val, "%d", count);
     cgiSetVariable("TOTAL", val);
 
-    if ((var = cgiGetVariable("ORDER")) != NULL)
+    if ((var = cgiGetVariable("ORDER")) != NULL && *var)
       ascending = !_cups_strcasecmp(var, "asc");
     else
       ascending = 1;
Index: cgi-bin/ipp-var.c
===================================================================
--- cgi-bin/ipp-var.c	(revision 10596)
+++ cgi-bin/ipp-var.c	(working copy)
@@ -1432,7 +1432,7 @@
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
         	 "ipp://localhost/");
 
-  if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
+  if ((which_jobs = cgiGetVariable("which_jobs")) != NULL && *which_jobs)
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
                  NULL, which_jobs);
 
@@ -1480,10 +1480,11 @@
     if (first < 0)
       first = 0;
 
-    if ((var = cgiGetVariable("ORDER")) != NULL)
+    if ((var = cgiGetVariable("ORDER")) != NULL && *var)
       ascending = !_cups_strcasecmp(var, "asc");
     else
-      ascending = !which_jobs || !_cups_strcasecmp(which_jobs, "not-completed");
+      ascending = !which_jobs || !*which_jobs ||
+                  !_cups_strcasecmp(which_jobs, "not-completed");
 
     section = cgiGetVariable("SECTION");
 
Index: cgi-bin/classes.c
===================================================================
--- cgi-bin/classes.c	(revision 10596)
+++ cgi-bin/classes.c	(working copy)
@@ -380,7 +380,7 @@
     sprintf(val, "%d", count);
     cgiSetVariable("TOTAL", val);
 
-    if ((var = cgiGetVariable("ORDER")) != NULL)
+    if ((var = cgiGetVariable("ORDER")) != NULL && *var)
       ascending = !_cups_strcasecmp(var, "asc");
     else
       ascending = 1;