[rygel] server: Minor syle fixes/simplifications
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Minor syle fixes/simplifications
- Date: Sun, 8 Feb 2015 13:25:28 +0000 (UTC)
commit 30088312fd62d7d4e2e72156fddafb1b0462e343
Author: Jens Georg <mail jensge org>
Date: Thu Nov 20 07:35:36 2014 +0100
server: Minor syle fixes/simplifications
Signed-off-by: Jens Georg <mail jensge org>
.../rygel-http-resource-handler.vala | 31 ++++++--------------
1 files changed, 9 insertions(+), 22 deletions(-)
---
diff --git a/src/librygel-server/rygel-http-resource-handler.vala
b/src/librygel-server/rygel-http-resource-handler.vala
index dd87dc0..4dcf575 100644
--- a/src/librygel-server/rygel-http-resource-handler.vala
+++ b/src/librygel-server/rygel-http-resource-handler.vala
@@ -13,18 +13,6 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CABLE TELEVISION LABORATORIES
- * INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using GUPnP;
@@ -39,22 +27,20 @@ internal class Rygel.HTTPMediaResourceHandler : HTTPGetHandler {
public HTTPMediaResourceHandler (MediaObject media_object,
string media_resource_name,
- Cancellable? cancellable) throws HTTPRequestError
- {
+ Cancellable? cancellable)
+ throws HTTPRequestError {
this.media_object = media_object;
this.cancellable = cancellable;
this.media_resource_name = media_resource_name;
- foreach (var resource in media_object.get_resource_list ()) {
- if (resource.get_name () == media_resource_name) {
- this.media_resource
- = new MediaResource.from_resource (resource.get_name (),
- resource);
- }
- }
- if (this.media_resource == null) {
+ var resource = media_object.get_resource_by_name (media_resource_name);
+
+ if (resource == null) {
throw new HTTPRequestError.NOT_FOUND ("MediaResource %s not found",
media_resource_name);
}
+
+ // Handler modifies the resource, so we copy it.
+ this.media_resource = resource.dup ();
}
public override void add_response_headers (HTTPGet request)
@@ -97,6 +83,7 @@ internal class Rygel.HTTPMediaResourceHandler : HTTPGetHandler {
protected override DIDLLiteResource add_resource (DIDLLiteObject didl_object,
HTTPGet request)
throws Error {
+ // Temporary. Needed for abstract base class.
return null as DIDLLiteResource;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]