From: Philipp Zabel Date: Tue, 11 May 2010 19:11:42 +0000 (+0200) Subject: Make LED pattern parser return success or failure X-Git-Tag: v0.0.3~2 X-Git-Url: https://vcs.maemo.org/git/?p=led-pattern-ed;a=commitdiff_plain;h=0da3c97e58b49732395220eb2b7806b880fa00eb Make LED pattern parser return success or failure --- diff --git a/src/led-pattern-rx51.vala b/src/led-pattern-rx51.vala index 72f3638..2c62e92 100644 --- a/src/led-pattern-rx51.vala +++ b/src/led-pattern-rx51.vala @@ -22,23 +22,23 @@ class LedPatternRX51 : LedPattern { public List engine1; public List engine2; - public void parse (string line) { + public bool parse (string line) { string[] key_value = line.split ("="); if (key_value.length != 2) { print ("pattern line does not contain '=': %s\n", line); - return; + return false; } string[] p = key_value[1].split (";"); if (p.length != 6) { print ("pattern does not contain 6 components: %d\n", p.length); - return; + return false; } if (p[4].length > 16*4 || p[5].length > 16*4) { print ("pattern too long!\n"); - return; + return false; } name = key_value[0]; @@ -57,6 +57,7 @@ class LedPatternRX51 : LedPattern { } on_changed (); + return true; } private void parse_led_map (string led_map, out LedColor color1, out LedColor color2) {