]> sigrok.org Git - libsigrok.git/commitdiff
bindings: update for sr_output_options_{get,free} API change.
authorMartin Ling <redacted>
Sun, 17 Aug 2014 10:44:05 +0000 (11:44 +0100)
committerMartin Ling <redacted>
Sun, 17 Aug 2014 10:44:05 +0000 (11:44 +0100)
bindings/cxx/classes.cpp
bindings/cxx/include/libsigrok/libsigrok.hpp

index 67d490861b94503aacfd2298b01cda22bab93a5b..8e5874ca88037b7fb6dfee748f80c06eb46241dc 100644 (file)
@@ -1160,7 +1160,7 @@ void InputFileDevice::load()
 }
 
 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_array(structure_array)
 {
@@ -1219,14 +1219,13 @@ string OutputFormat::get_description()
 
 map<string, shared_ptr<Option>> OutputFormat::get_options()
 {
-       const struct sr_option *option = sr_output_options_get(structure);
-       auto option_array = shared_ptr<const struct sr_option>(
-               option, [=](const struct sr_option *) {
-                       sr_output_options_free(structure); });
+       const struct sr_option **options = sr_output_options_get(structure);
+       auto option_array = shared_ptr<const struct sr_option *>(
+               options, sr_output_options_free);
        map<string, shared_ptr<Option>> result;
-       for (; option->id; option++)
-               result[option->id] = shared_ptr<Option>(
-                       new Option(option, option_array), Option::Deleter());
+       for (int i = 0; options[i]; i++)
+               result[options[i]->id] = shared_ptr<Option>(
+                       new Option(options[i], option_array), Option::Deleter());
        return result;
 }
 
index fff92b63e5e5a9a388710730f37a402da7a6c432..ad683218a384820766be27d5ee6e74b9affc199d 100644 (file)
@@ -785,10 +785,10 @@ public:
        vector<Glib::VariantBase> get_values();
 protected:
        Option(const struct sr_option *structure,
-               shared_ptr<const struct sr_option> structure_array);
+               shared_ptr<const struct sr_option *> structure_array);
        ~Option();
        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. */
        class Deleter
        {