[rygel] core: Make some code more readable



commit 73beeb52aac464d586b20a6c1d25cfe20f96f5f3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Aug 20 12:20:25 2010 +0300

    core: Make some code more readable
    
    Make the code deciding whether or not the mode of the HTTP GET is correct,
    more readable.

 src/rygel/rygel-http-get.vala |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 8a02a25..1530c23 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -125,27 +125,27 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
     private void ensure_correct_mode () throws HTTPRequestError {
         var mode = this.msg.request_headers.get_one (TRANSFER_MODE_HEADER);
-        var incorrect = false;
+        var correct = true;
 
         switch (mode) {
         case "Streaming":
-            incorrect = this.handler is HTTPIdentityHandler &&
-                        (!this.item.should_stream () ||
-                         this.subtitle != null ||
-                         this.thumbnail != null);
+            correct = this.handler is HTTPTranscodeHandler ||
+                      (this.item.should_stream () &&
+                       this.subtitle == null &&
+                       this.thumbnail == null);
 
             break;
         case "Interactive":
         case "Background":
-            incorrect =  this.handler is HTTPTranscodeHandler ||
-                         (this.item.should_stream () &&
-                          this.subtitle == null &&
-                          this.thumbnail == null);
+            correct =  this.handler is HTTPIdentityHandler &&
+                       (!this.item.should_stream () ||
+                        this.subtitle != null ||
+                        this.thumbnail != null);
 
             break;
         }
 
-        if (incorrect) {
+        if (!correct) {
             throw new HTTPRequestError.UNACCEPTABLE (
                                         "%s mode not supported for '%s'",
                                         mode,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]