*data = reinterpret_cast<const unsigned char*>("");
*len = 0;
} else {
- *data = reinterpret_cast<const unsigned char*>(Buffer::Data(p->npnProtos_));
- *len = Buffer::Length(p->npnProtos_);
+ Local<Object> obj = PersistentToLocal(p->npnProtos_);
+ *data = reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
+ *len = Buffer::Length(obj);
}
return SSL_TLSEXT_ERR_OK;
return SSL_TLSEXT_ERR_OK;
}
+ Local<Object> obj = PersistentToLocal(p->npnProtos_);
const unsigned char* npnProtos =
- reinterpret_cast<const unsigned char*>(Buffer::Data(p->npnProtos_));
+ reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
int status = SSL_select_next_proto(out, outlen, in, inlen, npnProtos,
- Buffer::Length(p->npnProtos_));
+ Buffer::Length(obj));
switch (status) {
case OPENSSL_NPN_UNSUPPORTED:
namespace node {
-// Forward declarations from node_buffer.h. We can't include node_buffer.h
-// in this file because:
-//
-// a) we're included early on in node.h, and
-// b) node_buffer.h depends on the definition of the |encoding| enum that's
-// defined further down in node.h...
-namespace Buffer {
-
-NODE_EXTERN char* Data(v8::Handle<v8::Value>);
-NODE_EXTERN char* Data(v8::Handle<v8::Object>);
-NODE_EXTERN size_t Length(v8::Handle<v8::Value>);
-NODE_EXTERN size_t Length(v8::Handle<v8::Object>);
-
-} // namespace Buffer
-
// Defined in node.cc
extern v8::Isolate* node_isolate;
int argc = 0,
v8::Handle<v8::Value>* argv = NULL);
-// TODO(bnoordhuis) Move to src/node_buffer.h once it's been established
-// that the current approach to dealing with Persistent is working out.
-namespace Buffer {
-
-template <typename TypeName>
-inline char* Data(v8::Persistent<TypeName>& val);
-
-template <typename TypeName>
-inline size_t Length(v8::Persistent<TypeName>& val);
-
-} // namespace Buffer
-
#ifdef _WIN32
// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer
// on overflow...
return constructor_handle->NewInstance(argc, argv);
}
-namespace Buffer {
-
-template <typename TypeName>
-inline char* Data(v8::Persistent<TypeName>& val) {
- return Data(PersistentToLocal(val));
-}
-
-template <typename TypeName>
-inline size_t Length(v8::Persistent<TypeName>& val) {
- return Length(PersistentToLocal(val));
-}
-
-} // namespace Buffer
-
} // namespace node
#endif // SRC_NODE_INTERNALS_H_
*data = reinterpret_cast<const unsigned char*>("");
*len = 0;
} else {
- *data = reinterpret_cast<const unsigned char*>(
- Buffer::Data(p->npn_protos_));
- *len = Buffer::Length(p->npn_protos_);
+ Local<Object> obj = PersistentToLocal(p->npn_protos_);
+ *data = reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
+ *len = Buffer::Length(obj);
}
return SSL_TLSEXT_ERR_OK;
return SSL_TLSEXT_ERR_OK;
}
+ Local<Object> obj = PersistentToLocal(p->npn_protos_);
const unsigned char* npn_protos =
- reinterpret_cast<const unsigned char*>(Buffer::Data(p->npn_protos_));
- size_t len = Buffer::Length(p->npn_protos_);
+ reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
+ size_t len = Buffer::Length(obj);
int status = SSL_select_next_proto(out, outlen, in, inlen, npn_protos, len);
Handle<Value> result;