forked from cory/tildefriends
Create a util.js.{h,c} from some common things.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3681 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "task.h"
|
||||
#include "tls.h"
|
||||
#include "tlscontext.js.h"
|
||||
#include "util.js.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@ -773,7 +774,7 @@ int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(so
|
||||
result = callback(socket, promise, stringValue, length);
|
||||
JS_FreeCString(context, stringValue);
|
||||
}
|
||||
else if ((array = tf_try_get_array_buffer(context, &length, value)) != 0)
|
||||
else if ((array = tf_util_try_get_array_buffer(context, &length, value)) != 0)
|
||||
{
|
||||
result = callback(socket, promise, (const char*)array, length);
|
||||
}
|
||||
@ -781,9 +782,9 @@ int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(so
|
||||
{
|
||||
size_t offset;
|
||||
size_t element_size;
|
||||
JSValue buffer = tf_try_get_typed_array_buffer(context, value, &offset, &length, &element_size);
|
||||
JSValue buffer = tf_util_try_get_typed_array_buffer(context, value, &offset, &length, &element_size);
|
||||
size_t size;
|
||||
if ((array = tf_try_get_array_buffer(context, &size, buffer)) != 0)
|
||||
if ((array = tf_util_try_get_array_buffer(context, &size, buffer)) != 0)
|
||||
{
|
||||
result = callback(socket, promise, (const char*)array, length);
|
||||
}
|
||||
|
Reference in New Issue
Block a user