22#include <stdio.h>
33#include <stdlib.h>
44#include <string.h>
5- // #include "../../js-native-api/common.h"
65
76#define NODE_API_RETVAL_NOTHING // Intentionally blank #define
87
@@ -156,29 +155,6 @@ static napi_value newBuffer(napi_env env, napi_callback_info info) {
156155 memcpy (theCopy , theText , kBufferSize );
157156
158157 return theBuffer ;
159-
160- // napi_value theBuffer, result;
161- // char* theCopy;
162- // const unsigned int kBufferSize = sizeof(theText);
163-
164- // napi_status status =
165- // napi_create_arraybuffer(env, kBufferSize, (void**)(&theCopy),
166- // &theBuffer);
167- // if (status != napi_ok) {
168- // printf("Failed to create arraybuffer\n");
169- // return NULL;
170- // }
171-
172- // memcpy(theCopy, theText, kBufferSize);
173-
174- // napi_typedarray_type arrayType = napi_uint8_array;
175- // status = napi_create_typedarray(
176- // env, arrayType, kBufferSize, theBuffer, 0, &result);
177- // if (status != napi_ok) {
178- // printf("Failed to create typedarray\n");
179- // return NULL;
180- // }
181- // return result;
182158}
183159
184160static napi_value newExternalBuffer (napi_env env , napi_callback_info info ) {
@@ -278,33 +254,6 @@ static napi_value invalidObjectAsBuffer(napi_env env, napi_callback_info info) {
278254 return notTheBuffer ;
279255}
280256
281- static napi_value bufferFromArrayBuffer (napi_env env , napi_callback_info info ) {
282- napi_status status ;
283- napi_value arraybuffer ;
284- napi_value buffer ;
285- size_t byte_length = 1024 ;
286- void * data = NULL ;
287- size_t buffer_length = 0 ;
288- void * buffer_data = NULL ;
289-
290- status = napi_create_arraybuffer (env , byte_length , & data , & arraybuffer );
291- NODE_API_ASSERT (env , status == napi_ok , "Failed to create arraybuffer" );
292-
293- #if NAPI_VERSION >= 10
294- status = node_api_create_buffer_from_arraybuffer (
295- env , arraybuffer , 0 , byte_length , & buffer );
296- NODE_API_ASSERT (
297- env , status == napi_ok , "Failed to create buffer from arraybuffer" );
298- #endif
299-
300- status = napi_get_buffer_info (env , buffer , & buffer_data , & buffer_length );
301- NODE_API_ASSERT (env , status == napi_ok , "Failed to get buffer info" );
302-
303- NODE_API_ASSERT (env , buffer_length == byte_length , "Buffer length mismatch" );
304-
305- return buffer ;
306- }
307-
308257static napi_value Init (napi_env env , napi_value exports ) {
309258 napi_value theValue ;
310259
@@ -322,7 +271,6 @@ static napi_value Init(napi_env env, napi_value exports) {
322271 DECLARE_NODE_API_PROPERTY ("bufferInfo" , bufferInfo ),
323272 DECLARE_NODE_API_PROPERTY ("staticBuffer" , staticBuffer ),
324273 DECLARE_NODE_API_PROPERTY ("invalidObjectAsBuffer" , invalidObjectAsBuffer ),
325- DECLARE_NODE_API_PROPERTY ("bufferFromArrayBuffer" , bufferFromArrayBuffer ),
326274 };
327275
328276 NODE_API_CALL (env ,
0 commit comments