bindings: update for sr_output_options_{get,free} API change.

This commit is contained in:
Martin Ling 2014-08-17 11:44:05 +01:00
parent af7d656d37
commit 70d3b20ba6
2 changed files with 9 additions and 10 deletions

View File

@ -1160,7 +1160,7 @@ void InputFileDevice::load()
} }
Option::Option(const struct sr_option *structure, Option::Option(const struct sr_option *structure,
shared_ptr<const struct sr_option> structure_array) : shared_ptr<const struct sr_option *> structure_array) :
structure(structure), structure(structure),
structure_array(structure_array) structure_array(structure_array)
{ {
@ -1219,14 +1219,13 @@ string OutputFormat::get_description()
map<string, shared_ptr<Option>> OutputFormat::get_options() map<string, shared_ptr<Option>> OutputFormat::get_options()
{ {
const struct sr_option *option = sr_output_options_get(structure); const struct sr_option **options = sr_output_options_get(structure);
auto option_array = shared_ptr<const struct sr_option>( auto option_array = shared_ptr<const struct sr_option *>(
option, [=](const struct sr_option *) { options, sr_output_options_free);
sr_output_options_free(structure); });
map<string, shared_ptr<Option>> result; map<string, shared_ptr<Option>> result;
for (; option->id; option++) for (int i = 0; options[i]; i++)
result[option->id] = shared_ptr<Option>( result[options[i]->id] = shared_ptr<Option>(
new Option(option, option_array), Option::Deleter()); new Option(options[i], option_array), Option::Deleter());
return result; return result;
} }

View File

@ -785,10 +785,10 @@ public:
vector<Glib::VariantBase> get_values(); vector<Glib::VariantBase> get_values();
protected: protected:
Option(const struct sr_option *structure, Option(const struct sr_option *structure,
shared_ptr<const struct sr_option> structure_array); shared_ptr<const struct sr_option *> structure_array);
~Option(); ~Option();
const struct sr_option *structure; const struct sr_option *structure;
shared_ptr<const struct sr_option> structure_array; shared_ptr<const struct sr_option *> structure_array;
/** Deleter needed to allow shared_ptr use with protected destructor. */ /** Deleter needed to allow shared_ptr use with protected destructor. */
class Deleter class Deleter
{ {