[rygel] core: Correctly handle unset port in configs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Correctly handle unset port in configs
- Date: Wed, 2 Sep 2009 23:24:19 +0000 (UTC)
commit 8a5db7a17a0727b542e166483cd0e04c5e70f22f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Sep 2 22:09:15 2009 +0300
core: Correctly handle unset port in configs
src/rygel/rygel-cmdline-config.vala | 6 +++++-
src/rygel/rygel-user-config.vala | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index a6a77eb..01931cd 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -34,7 +34,7 @@ public errordomain Rygel.CmdlineConfigError {
*/
public class Rygel.CmdlineConfig : GLib.Object, Configuration {
private static string host_ip;
- private static int port;
+ private static int port = -1;
private static bool no_transcoding;
private static bool no_mp3_trans;
@@ -117,6 +117,10 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
}
public int get_port () throws GLib.Error {
+ if (this.port == -1) {
+ throw new ConfigurationError.NO_VALUE_SET ("No value available");
+ }
+
return port;
}
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index 5508261..6802619 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -210,7 +210,7 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
throws GLib.Error {
int val = this.key_file.get_integer (section, key);
- if (val < min || val > max) {
+ if (val == 0 || val < min || val > max) {
throw new ConfigurationError.VALUE_OUT_OF_RANGE (
"Value of '%s' out of range", key);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]