@@ -41,76 +41,76 @@ using v8::Object;
41
41
using v8::String;
42
42
using v8::Value;
43
43
44
- #define SLURP_STRING (obj, member, valp ) \
45
- if (!(obj)->IsObject ()) { \
46
- return env->ThrowError ( \
44
+ #define SLURP_STRING (obj, member, valp ) \
45
+ if (!(obj)->IsObject ()) { \
46
+ return env->ThrowError ( \
47
47
" expected object for " #obj " to contain string member " #member); \
48
- } \
49
- node::Utf8Value _##member(env->isolate (), \
50
- obj->Get(OneByteString(env->isolate (), #member))); \
51
- if ((*(const char **)valp = *_##member) == nullptr ) \
48
+ } \
49
+ node::Utf8Value _##member(env->isolate (), \
50
+ obj->Get(OneByteString(env->isolate (), #member))); \
51
+ if ((*(const char **)valp = *_##member) == nullptr ) \
52
52
*(const char **)valp = " <unknown>" ;
53
53
54
- #define SLURP_INT (obj, member, valp ) \
55
- if (!(obj)->IsObject ()) { \
56
- return env->ThrowError ( \
57
- " expected object for " #obj " to contain integer member " #member); \
58
- } \
59
- *valp = obj->Get (OneByteString(env->isolate (), #member)) \
54
+ #define SLURP_INT (obj, member, valp ) \
55
+ if (!(obj)->IsObject ()) { \
56
+ return env->ThrowError ( \
57
+ " expected object for " #obj " to contain integer member " #member); \
58
+ } \
59
+ *valp = obj->Get (OneByteString(env->isolate (), #member)) \
60
60
->Int32Value();
61
61
62
- #define SLURP_OBJECT (obj, member, valp ) \
63
- if (!(obj)->IsObject ()) { \
64
- return env->ThrowError ( \
65
- " expected object for " #obj " to contain object member " #member); \
66
- } \
62
+ #define SLURP_OBJECT (obj, member, valp ) \
63
+ if (!(obj)->IsObject ()) { \
64
+ return env->ThrowError ( \
65
+ " expected object for " #obj " to contain object member " #member); \
66
+ } \
67
67
*valp = Local<Object>::Cast(obj->Get (OneByteString(env->isolate (), #member)));
68
68
69
- #define SLURP_CONNECTION (arg, conn ) \
70
- if (!(arg)->IsObject ()) { \
71
- return env->ThrowError ( \
72
- " expected argument " #arg " to be a connection object" ); \
73
- } \
74
- node_dtrace_connection_t conn; \
75
- Local<Object> _##conn = Local<Object>::Cast(arg); \
76
- Local<Value> _handle = \
77
- (_##conn)->Get (FIXED_ONE_BYTE_STRING(env->isolate (), "_handle")); \
78
- if (_handle->IsObject ()) { \
79
- SLURP_INT (_handle.As <Object>(), fd, &conn.fd ); \
80
- } else { \
81
- conn.fd = -1 ; \
82
- } \
83
- SLURP_STRING (_##conn, remoteAddress, &conn.remote); \
84
- SLURP_INT (_##conn, remotePort, &conn.port); \
69
+ #define SLURP_CONNECTION (arg, conn ) \
70
+ if (!(arg)->IsObject ()) { \
71
+ return env->ThrowError ( \
72
+ " expected argument " #arg " to be a connection object" ); \
73
+ } \
74
+ node_dtrace_connection_t conn; \
75
+ Local<Object> _##conn = Local<Object>::Cast(arg); \
76
+ Local<Value> _handle = \
77
+ (_##conn)->Get (FIXED_ONE_BYTE_STRING(env->isolate (), "_handle")); \
78
+ if (_handle->IsObject ()) { \
79
+ SLURP_INT (_handle.As <Object>(), fd, &conn.fd ); \
80
+ } else { \
81
+ conn.fd = -1 ; \
82
+ } \
83
+ SLURP_STRING (_##conn, remoteAddress, &conn.remote); \
84
+ SLURP_INT (_##conn, remotePort, &conn.port); \
85
85
SLURP_INT (_##conn, bufferSize, &conn.buffered);
86
86
87
- #define SLURP_CONNECTION_HTTP_CLIENT (arg, conn ) \
88
- if (!(arg)->IsObject()) { \
89
- return env->ThrowError ( \
90
- " expected argument " #arg " to be a connection object" ); \
91
- } \
92
- node_dtrace_connection_t conn; \
93
- Local<Object> _##conn = Local<Object>::Cast(arg); \
94
- SLURP_INT (_##conn, fd, &conn.fd); \
95
- SLURP_STRING (_##conn, host, &conn.remote); \
96
- SLURP_INT (_##conn, port, &conn.port); \
87
+ #define SLURP_CONNECTION_HTTP_CLIENT (arg, conn ) \
88
+ if (!(arg)->IsObject()) { \
89
+ return env->ThrowError ( \
90
+ " expected argument " #arg " to be a connection object" ); \
91
+ } \
92
+ node_dtrace_connection_t conn; \
93
+ Local<Object> _##conn = Local<Object>::Cast(arg); \
94
+ SLURP_INT (_##conn, fd, &conn.fd); \
95
+ SLURP_STRING (_##conn, host, &conn.remote); \
96
+ SLURP_INT (_##conn, port, &conn.port); \
97
97
SLURP_INT (_##conn, bufferSize, &conn.buffered);
98
98
99
- #define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE (arg0, arg1, conn ) \
100
- if (!(arg0)->IsObject ()) { \
101
- return env->ThrowError ( \
102
- " expected argument " #arg0 " to be a connection object" ); \
103
- } \
104
- if (!(arg1)->IsObject ()) { \
105
- return env->ThrowError ( \
106
- " expected argument " #arg1 " to be a connection object" ); \
107
- } \
108
- node_dtrace_connection_t conn; \
109
- Local<Object> _##conn = Local<Object>::Cast(arg0); \
110
- SLURP_INT (_##conn, fd, &conn.fd); \
111
- SLURP_INT (_##conn, bufferSize, &conn.buffered); \
112
- _##conn = Local<Object>::Cast(arg1); \
113
- SLURP_STRING (_##conn, host, &conn.remote); \
99
+ #define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE (arg0, arg1, conn ) \
100
+ if (!(arg0)->IsObject ()) { \
101
+ return env->ThrowError ( \
102
+ " expected argument " #arg0 " to be a connection object" ); \
103
+ } \
104
+ if (!(arg1)->IsObject ()) { \
105
+ return env->ThrowError ( \
106
+ " expected argument " #arg1 " to be a connection object" ); \
107
+ } \
108
+ node_dtrace_connection_t conn; \
109
+ Local<Object> _##conn = Local<Object>::Cast(arg0); \
110
+ SLURP_INT (_##conn, fd, &conn.fd); \
111
+ SLURP_INT (_##conn, bufferSize, &conn.buffered); \
112
+ _##conn = Local<Object>::Cast(arg1); \
113
+ SLURP_STRING (_##conn, host, &conn.remote); \
114
114
SLURP_INT (_##conn, port, &conn.port);
115
115
116
116
0 commit comments