@@ -59,76 +59,76 @@ using v8::Object;
59
59
using v8::String;
60
60
using v8::Value;
61
61
62
- #define SLURP_STRING (obj, member, valp ) \
63
- if (!(obj)->IsObject ()) { \
64
- return env->ThrowError ( \
62
+ #define SLURP_STRING (obj, member, valp ) \
63
+ if (!(obj)->IsObject ()) { \
64
+ return env->ThrowError ( \
65
65
" expected object for " #obj " to contain string member " #member); \
66
- } \
67
- node::Utf8Value _##member(env->isolate (), \
68
- obj->Get(OneByteString(env->isolate (), #member))); \
69
- if ((*(const char **)valp = *_##member) == nullptr ) \
66
+ } \
67
+ node::Utf8Value _##member(env->isolate (), \
68
+ obj->Get(OneByteString(env->isolate (), #member))); \
69
+ if ((*(const char **)valp = *_##member) == nullptr ) \
70
70
*(const char **)valp = " <unknown>" ;
71
71
72
- #define SLURP_INT (obj, member, valp ) \
73
- if (!(obj)->IsObject ()) { \
74
- return env->ThrowError ( \
75
- " expected object for " #obj " to contain integer member " #member); \
76
- } \
77
- *valp = obj->Get (OneByteString(env->isolate (), #member)) \
72
+ #define SLURP_INT (obj, member, valp ) \
73
+ if (!(obj)->IsObject ()) { \
74
+ return env->ThrowError ( \
75
+ " expected object for " #obj " to contain integer member " #member); \
76
+ } \
77
+ *valp = obj->Get (OneByteString(env->isolate (), #member)) \
78
78
->Int32Value();
79
79
80
- #define SLURP_OBJECT (obj, member, valp ) \
81
- if (!(obj)->IsObject ()) { \
82
- return env->ThrowError ( \
83
- " expected object for " #obj " to contain object member " #member); \
84
- } \
80
+ #define SLURP_OBJECT (obj, member, valp ) \
81
+ if (!(obj)->IsObject ()) { \
82
+ return env->ThrowError ( \
83
+ " expected object for " #obj " to contain object member " #member); \
84
+ } \
85
85
*valp = Local<Object>::Cast(obj->Get (OneByteString(env->isolate (), #member)));
86
86
87
- #define SLURP_CONNECTION (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
- Local<Value> _handle = \
95
- (_##conn)->Get (FIXED_ONE_BYTE_STRING(env->isolate (), "_handle")); \
96
- if (_handle->IsObject ()) { \
97
- SLURP_INT (_handle.As <Object>(), fd, &conn.fd ); \
98
- } else { \
99
- conn.fd = -1 ; \
100
- } \
101
- SLURP_STRING (_##conn, remoteAddress, &conn.remote); \
102
- SLURP_INT (_##conn, remotePort, &conn.port); \
87
+ #define SLURP_CONNECTION (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
+ Local<Value> _handle = \
95
+ (_##conn)->Get (FIXED_ONE_BYTE_STRING(env->isolate (), "_handle")); \
96
+ if (_handle->IsObject ()) { \
97
+ SLURP_INT (_handle.As <Object>(), fd, &conn.fd ); \
98
+ } else { \
99
+ conn.fd = -1 ; \
100
+ } \
101
+ SLURP_STRING (_##conn, remoteAddress, &conn.remote); \
102
+ SLURP_INT (_##conn, remotePort, &conn.port); \
103
103
SLURP_INT (_##conn, bufferSize, &conn.buffered);
104
104
105
- #define SLURP_CONNECTION_HTTP_CLIENT (arg, conn ) \
106
- if (!(arg)->IsObject()) { \
107
- return env->ThrowError ( \
108
- " expected argument " #arg " to be a connection object" ); \
109
- } \
110
- node_dtrace_connection_t conn; \
111
- Local<Object> _##conn = Local<Object>::Cast(arg); \
112
- SLURP_INT (_##conn, fd, &conn.fd); \
113
- SLURP_STRING (_##conn, host, &conn.remote); \
114
- SLURP_INT (_##conn, port, &conn.port); \
105
+ #define SLURP_CONNECTION_HTTP_CLIENT (arg, conn ) \
106
+ if (!(arg)->IsObject()) { \
107
+ return env->ThrowError ( \
108
+ " expected argument " #arg " to be a connection object" ); \
109
+ } \
110
+ node_dtrace_connection_t conn; \
111
+ Local<Object> _##conn = Local<Object>::Cast(arg); \
112
+ SLURP_INT (_##conn, fd, &conn.fd); \
113
+ SLURP_STRING (_##conn, host, &conn.remote); \
114
+ SLURP_INT (_##conn, port, &conn.port); \
115
115
SLURP_INT (_##conn, bufferSize, &conn.buffered);
116
116
117
- #define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE (arg0, arg1, conn ) \
118
- if (!(arg0)->IsObject ()) { \
119
- return env->ThrowError ( \
120
- " expected argument " #arg0 " to be a connection object" ); \
121
- } \
122
- if (!(arg1)->IsObject ()) { \
123
- return env->ThrowError ( \
124
- " expected argument " #arg1 " to be a connection object" ); \
125
- } \
126
- node_dtrace_connection_t conn; \
127
- Local<Object> _##conn = Local<Object>::Cast(arg0); \
128
- SLURP_INT (_##conn, fd, &conn.fd); \
129
- SLURP_INT (_##conn, bufferSize, &conn.buffered); \
130
- _##conn = Local<Object>::Cast(arg1); \
131
- SLURP_STRING (_##conn, host, &conn.remote); \
117
+ #define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE (arg0, arg1, conn ) \
118
+ if (!(arg0)->IsObject ()) { \
119
+ return env->ThrowError ( \
120
+ " expected argument " #arg0 " to be a connection object" ); \
121
+ } \
122
+ if (!(arg1)->IsObject ()) { \
123
+ return env->ThrowError ( \
124
+ " expected argument " #arg1 " to be a connection object" ); \
125
+ } \
126
+ node_dtrace_connection_t conn; \
127
+ Local<Object> _##conn = Local<Object>::Cast(arg0); \
128
+ SLURP_INT (_##conn, fd, &conn.fd); \
129
+ SLURP_INT (_##conn, bufferSize, &conn.buffered); \
130
+ _##conn = Local<Object>::Cast(arg1); \
131
+ SLURP_STRING (_##conn, host, &conn.remote); \
132
132
SLURP_INT (_##conn, port, &conn.port);
133
133
134
134
0 commit comments