C++: Use sr_input_scan_*() API changes.
This commit is contained in:
parent
4f979115a4
commit
f88c73732c
|
@ -229,20 +229,21 @@ shared_ptr<Trigger> Context::create_trigger(string name)
|
||||||
|
|
||||||
shared_ptr<Input> Context::open_file(string filename)
|
shared_ptr<Input> Context::open_file(string filename)
|
||||||
{
|
{
|
||||||
auto input = sr_input_scan_file(filename.c_str());
|
const struct sr_input *input;
|
||||||
if (!input)
|
|
||||||
throw Error(SR_ERR_NA);
|
check( sr_input_scan_file(filename.c_str(), &input));
|
||||||
return shared_ptr<Input>(
|
return shared_ptr<Input>(
|
||||||
new Input(shared_from_this(), input), Input::Deleter());
|
new Input(shared_from_this(), input), Input::Deleter());
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Input> Context::open_stream(string header)
|
shared_ptr<Input> Context::open_stream(string header)
|
||||||
{
|
{
|
||||||
|
const struct sr_input *input;
|
||||||
|
|
||||||
auto gstr = g_string_new(header.c_str());
|
auto gstr = g_string_new(header.c_str());
|
||||||
auto input = sr_input_scan_buffer(gstr);
|
auto ret = sr_input_scan_buffer(gstr, &input);
|
||||||
g_string_free(gstr, false);
|
g_string_free(gstr, true);
|
||||||
if (!input)
|
check(ret);
|
||||||
throw Error(SR_ERR_NA);
|
|
||||||
return shared_ptr<Input>(
|
return shared_ptr<Input>(
|
||||||
new Input(shared_from_this(), input), Input::Deleter());
|
new Input(shared_from_this(), input), Input::Deleter());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue