From: Bert Vermeulen Date: Wed, 27 Aug 2014 23:49:48 +0000 (+0200) Subject: C++: Use sr_input_scan_*() API changes. X-Git-Tag: libsigrok-0.4.0~1087 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f88c73732cbef5dad58788d1555bd66742001192;p=libsigrok.git C++: Use sr_input_scan_*() API changes. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index ce458eeb..2b26f1a8 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -229,20 +229,21 @@ shared_ptr Context::create_trigger(string name) shared_ptr 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( new Input(shared_from_this(), input), Input::Deleter()); } shared_ptr 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( new Input(shared_from_this(), input), Input::Deleter()); }