New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return string/buffer data for both plain values and boxed values #167

Open
svaarala opened this Issue Apr 6, 2015 · 3 comments

Comments

Projects
None yet
1 participant
@svaarala
Copy link
Owner

svaarala commented Apr 6, 2015

Currently e.g. duk_get_string() and duk_get_buffer() only operate on plain string/buffer values. If they're used with a String or Duktape.Buffer object they'll return NULL and zero length.

It might be more useful if the calls accepted String and Duktape.Buffer objects like plain values.

With Node.js Buffer and TypedArray bindings, they should similarly return pointers and lengths for Node.js Buffer, ArrayBuffer, and TypedArray/DataView values. Same boxed/unboxed issue also affects Number and Boolean types (e.g. duk_get_number() and duk_get_boolean()).

@svaarala svaarala added the api label Apr 6, 2015

@svaarala svaarala added this to the v1.3.0 milestone Apr 6, 2015

@svaarala

This comment has been minimized.

Copy link
Owner Author

svaarala commented May 6, 2015

A non-breaking change would be to add separate calls to get string/buffer data, with the calls accepting both plain and boxed strings/buffers, e.g.:

char *buf;
duk_size_t sz;

buf = (char *) duk_get_buffer_data(ctx, idx_mybuf, &sz);

The obvious question then is whether to deprecate duk_get_buffer() etc in Duktape 2.x.

@svaarala

This comment has been minimized.

Copy link
Owner Author

svaarala commented May 8, 2015

Related issue: #190.

@svaarala svaarala modified the milestones: v2.0.0, v1.3.0 Jun 7, 2015

@svaarala svaarala modified the milestones: v1.4.0, v2.0.0 Sep 5, 2015

@svaarala

This comment has been minimized.

Copy link
Owner Author

svaarala commented Sep 5, 2015

A solution for Duktape 1.4.0 would also be nice, but not mandatory.

@svaarala svaarala modified the milestones: v2.0.0, v1.4.0 Nov 15, 2015

@svaarala svaarala added the buffer label May 17, 2016

@svaarala svaarala removed this from the v2.0.0 milestone Dec 9, 2016

@svaarala svaarala referenced this issue Dec 18, 2016

Open

Misc improvements to internal data structures #1196

2 of 20 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment