]> sigrok.org Git - libsigrok.git/commitdiff
C++: Change arguments of Input::send() from std::string to data+length.
authorMartin Ling <redacted>
Mon, 20 Apr 2015 09:02:34 +0000 (10:02 +0100)
committerMartin Ling <redacted>
Mon, 20 Apr 2015 09:12:39 +0000 (10:12 +0100)
bindings/cxx/classes.cpp
bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp

index 19b4f8f0c3c5c53ac5472d2faded5b2dc3043b75..a08def8eebaed63d6482ffc17c5d6970da3bf2c5 100644 (file)
@@ -1438,9 +1438,9 @@ shared_ptr<InputDevice> Input::device()
        return _device->get_shared_pointer(shared_from_this());
 }
 
-void Input::send(string data)
+void Input::send(void *data, size_t length)
 {
-       auto gstr = g_string_new(data.c_str());
+       auto gstr = g_string_new_len((gchar *)data, length);
        auto ret = sr_input_send(_structure, gstr);
        g_string_free(gstr, false);
        check(ret);
index 324cd01e33896b0c91ed6883f0f1d2609cf42f94..54be95df2d3f180ce36fe53178208ac882695aa2 100644 (file)
@@ -888,8 +888,9 @@ public:
        /** Virtual device associated with this input. */
        shared_ptr<InputDevice> device();
        /** Send next stream data.
-        * @param data Next stream data. */
-       void send(string data);
+        * @param data Next stream data.
+        * @param length Length of data. */
+       void send(void *data, size_t length);
        /** Signal end of input data. */
        void end();
 protected: