]> sigrok.org Git - libsigrok.git/commitdiff
C++: Use sr_input_scan_*() API changes.
authorBert Vermeulen <redacted>
Wed, 27 Aug 2014 23:49:48 +0000 (01:49 +0200)
committerBert Vermeulen <redacted>
Thu, 28 Aug 2014 10:19:55 +0000 (12:19 +0200)
bindings/cxx/classes.cpp

index ce458eeb6c61255b1904d4824b10cc491ddb4bd9..2b26f1a88d90f6aa20c614216da9be293d020d6b 100644 (file)
@@ -229,20 +229,21 @@ shared_ptr<Trigger> Context::create_trigger(string name)
 
 shared_ptr<Input> Context::open_file(string filename)
 {
-       auto input = sr_input_scan_file(filename.c_str());
-       if (!input)
-               throw Error(SR_ERR_NA);
+       const struct sr_input *input;
+
+       check( sr_input_scan_file(filename.c_str(), &input));
        return shared_ptr<Input>(
                new Input(shared_from_this(), input), Input::Deleter());
 }
 
 shared_ptr<Input> Context::open_stream(string header)
 {
+       const struct sr_input *input;
+
        auto gstr = g_string_new(header.c_str());
-       auto input = sr_input_scan_buffer(gstr);
-       g_string_free(gstr, false);
-       if (!input)
-               throw Error(SR_ERR_NA);
+       auto ret = sr_input_scan_buffer(gstr, &input);
+       g_string_free(gstr, true);
+       check(ret);
        return shared_ptr<Input>(
                new Input(shared_from_this(), input), Input::Deleter());
 }