Skip to content

Commit aac51a5

Browse files
JamieDriverjgriffiths
authored andcommitted
treat (void*,size_t) as a buffer - improved export of 'wally_bzero()
1 parent ee98e26 commit aac51a5

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

include/wally.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ inline int bip340_tagged_hash(const BYTES& bytes, const TAG& tag, BYTES_OUT& byt
512512
}
513513

514514
template <class BYTES>
515-
inline int bzero(const BYTES& bytes, size_t bytes_len) {
516-
int ret = ::wally_bzero(detail::get_p(bytes), bytes_len);
515+
inline int bzero(BYTES& bytes) {
516+
int ret = ::wally_bzero(bytes.data(), bytes.size());
517517
return detail::check_ret(__FUNCTION__, ret);
518518
}
519519

src/swig_java/swig.i

+1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ static jobjectArray create_jstringArray(JNIEnv *jenv, char **p, size_t len) {
328328
%apply(char *STRING, size_t LENGTH) { (unsigned char* s2c_opening_out, size_t s2c_opening_out_len) };
329329
%apply(char *STRING, size_t LENGTH) { (unsigned char* scalar, size_t scalar_len) };
330330
%apply(char *STRING, size_t LENGTH) { (unsigned char* vbf_out, size_t vbf_out_len) };
331+
%apply(char *STRING, size_t LENGTH) { (void* bytes, size_t bytes_len) };
331332
%ignore bip32_key_from_base58;
332333
%ignore bip32_key_from_base58_n;
333334
%ignore bip32_key_from_parent;

src/swig_python/swig.i

+1
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ static void destroy_words(PyObject *obj) { (void)obj; }
395395
%pybuffer_nullable_binary(const unsigned char* vbf, size_t vbf_len);
396396
%pybuffer_nullable_binary(const unsigned char* whitelistproof, size_t whitelistproof_len);
397397
%pybuffer_nullable_binary(const unsigned char* witness, size_t witness_len);
398+
%pybuffer_nullable_binary(void* bytes, size_t bytes_len);
398399
%pybuffer_output_binary(unsigned char* abf_out, size_t abf_out_len);
399400
%pybuffer_output_binary(unsigned char* asset_out, size_t asset_out_len);
400401
%pybuffer_output_binary(unsigned char* bytes_out, size_t len);

tools/build_wrappers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def is_array(func, arg, n, num_args, types):
149149

150150

151151
def is_buffer(func, arg, n, num_args):
152-
return is_array(func, arg, n, num_args, [u'const unsigned char*', u'unsigned char*'])
152+
return is_array(func, arg, n, num_args, [u'const unsigned char*', u'unsigned char*', u'void*'])
153153

154154

155155
def is_int_buffer(func, arg, n, num_args):

0 commit comments

Comments
 (0)