diff options
author | Jens Georg <mail@jensge.org> | 2020-01-12 19:50:48 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2020-01-12 19:50:48 +0100 |
commit | 2e65748ed178fefebe29318265e9ac72d62a2d2c (patch) | |
tree | 01aa632ea61870a928d8c7d6639d10fd494a882e | |
parent | cbec35a7853601047759643de85bfc6dd0f2a1d8 (diff) | |
download | rygel-2e65748ed178fefebe29318265e9ac72d62a2d2c.tar.gz |
server: Small code simplification
Early exist can save one level of indentation
-rw-r--r-- | src/librygel-server/rygel-visual-item.vala | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/librygel-server/rygel-visual-item.vala b/src/librygel-server/rygel-visual-item.vala index f3e4a27d..edb3e87e 100644 --- a/src/librygel-server/rygel-visual-item.vala +++ b/src/librygel-server/rygel-visual-item.vala @@ -78,37 +78,39 @@ public interface Rygel.VisualItem : MediaFileItem { } internal void add_thumbnail_resources (HTTPServer http_server) { + if (this.place_holder) { + return; + } + for (var i = 0; i < this.thumbnails.size; i++) { - if (!this.place_holder) { - var thumbnail = this.thumbnails.get (i); - // Add the defined thumbnail uri unconditionally - // (it will be filtered out if the request is remote) - string protocol; - try { - protocol = this.get_protocol_for_uri (thumbnail.uri); - } catch (Error e) { - message (/*_*/("Could not determine protocol for URI %s"), - thumbnail.uri); + var thumbnail = this.thumbnails.get (i); + // Add the defined thumbnail uri unconditionally + // (it will be filtered out if the request is remote) + string protocol; + try { + protocol = this.get_protocol_for_uri (thumbnail.uri); + } catch (Error e) { + message (/*_*/("Could not determine protocol for URI %s"), + thumbnail.uri); - continue; - } + continue; + } - var thumb_res = thumbnail.get_resource (protocol, i); - thumb_res.uri = thumbnail.uri; - this.get_resource_list ().add (thumb_res); - if (http_server.need_proxy (thumbnail.uri)) { - var http_thumb_res = thumbnail.get_resource - (http_server.get_protocol (), i); + var thumb_res = thumbnail.get_resource (protocol, i); + thumb_res.uri = thumbnail.uri; + this.get_resource_list ().add (thumb_res); + if (http_server.need_proxy (thumbnail.uri)) { + var http_thumb_res = thumbnail.get_resource + (http_server.get_protocol (), i); - var index = this.thumbnails.index_of (thumbnail); - // Make a http uri for the thumbnail - http_thumb_res.uri = http_server.create_uri_for_object - (this, - index, - -1, - null); - this.get_resource_list ().add (http_thumb_res); - } + var index = this.thumbnails.index_of (thumbnail); + // Make a http uri for the thumbnail + http_thumb_res.uri = http_server.create_uri_for_object + (this, + index, + -1, + null); + this.get_resource_list ().add (http_thumb_res); } } } |