From: Martin Ling Date: Mon, 20 Apr 2015 09:02:34 +0000 (+0100) Subject: C++: Change arguments of Input::send() from std::string to data+length. X-Git-Tag: libsigrok-0.4.0~521 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2b51d48b386a2050d0ab34f242161617877d8e5f;p=libsigrok.git C++: Change arguments of Input::send() from std::string to data+length. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 19b4f8f0..a08def8e 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -1438,9 +1438,9 @@ shared_ptr 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); diff --git a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp index 324cd01e..54be95df 100644 --- a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp +++ b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp @@ -888,8 +888,9 @@ public: /** Virtual device associated with this input. */ shared_ptr 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: