]>
Commit | Line | Data |
---|---|---|
be62a70f ER |
1 | From a9e60792a9c4044e29ec7bbb88419d9283044b86 Mon Sep 17 00:00:00 2001 |
2 | From: "T.C. Hollingsworth" <tchollingsworth@gmail.com> | |
3 | Date: Wed, 18 Jun 2014 23:19:19 -0700 | |
4 | Subject: [PATCH] Revert "src: replace usage of String::Utf8Value" | |
5 | ||
6 | This reverts commit 535c7777ac674ba86cf93c44824e07b0e23ea8c4. | |
7 | --- | |
8 | src/cares_wrap.cc | 8 ++--- | |
9 | src/fs_event_wrap.cc | 3 +- | |
10 | src/node.cc | 42 +++++++++++++------------- | |
11 | src/node_crypto.cc | 31 ++++++++++--------- | |
12 | src/node_dtrace.cc | 6 ++-- | |
13 | src/node_file.cc | 37 +++++++++++------------ | |
14 | src/node_stat_watcher.cc | 3 +- | |
15 | src/process_wrap.cc | 9 +++--- | |
16 | src/udp_wrap.cc | 9 +++--- | |
17 | src/util.h | 78 ------------------------------------------------ | |
18 | 10 files changed, 68 insertions(+), 158 deletions(-) | |
19 | delete mode 100644 src/util.h | |
20 | ||
21 | diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc | |
22 | index 321e144..b7ba828 100644 | |
23 | --- a/src/cares_wrap.cc | |
24 | +++ b/src/cares_wrap.cc | |
be62a70f ER |
25 | @@ -741,7 +739,7 @@ static Handle<Value> Query(const Arguments& args) { |
26 | // object reference, causing wrap->GetObject() to return undefined. | |
27 | Local<Object> object = Local<Object>::New(wrap->GetObject()); | |
28 | ||
29 | - node::Utf8Value name(args[0]); | |
30 | + String::Utf8Value name(args[0]); | |
31 | ||
32 | int r = wrap->Send(*name); | |
33 | if (r) { | |
34 | @@ -770,7 +768,7 @@ static Handle<Value> QueryWithFamily(const Arguments& args) { | |
35 | // object reference, causing wrap->GetObject() to return undefined. | |
36 | Local<Object> object = Local<Object>::New(wrap->GetObject()); | |
37 | ||
38 | - node::Utf8Value name(args[0]); | |
39 | + String::Utf8Value name(args[0]); | |
40 | int family = args[1]->Int32Value(); | |
41 | ||
42 | int r = wrap->Send(*name, family); | |
43 | @@ -900,7 +898,7 @@ static Handle<Value> IsIP(const Arguments& args) { | |
44 | static Handle<Value> GetAddrInfo(const Arguments& args) { | |
45 | HandleScope scope; | |
46 | ||
47 | - node::Utf8Value hostname(args[0]); | |
48 | + String::Utf8Value hostname(args[0]); | |
49 | ||
50 | int fam = AF_UNSPEC; | |
51 | if (args[1]->IsInt32()) { | |
52 | diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc | |
53 | index fc54283..7e3eb8c 100644 | |
54 | --- a/src/fs_event_wrap.cc | |
55 | +++ b/src/fs_event_wrap.cc | |
56 | @@ -21,7 +21,6 @@ | |
57 | ||
58 | #include "node.h" | |
59 | #include "handle_wrap.h" | |
60 | -#include "util.h" | |
61 | ||
62 | #include <stdlib.h> | |
63 | ||
64 | @@ -98,7 +97,7 @@ Handle<Value> FSEventWrap::Start(const Arguments& args) { | |
65 | return ThrowException(Exception::TypeError(String::New("Bad arguments"))); | |
66 | } | |
67 | ||
68 | - node::Utf8Value path(args[0]); | |
69 | + String::Utf8Value path(args[0]); | |
70 | ||
71 | int r = uv_fs_event_init(uv_default_loop(), &wrap->handle_, *path, OnEvent, 0); | |
72 | if (r == 0) { | |
73 | diff --git a/src/node.cc b/src/node.cc | |
74 | index e9696cd..8257604 100644 | |
75 | --- a/src/node.cc | |
76 | +++ b/src/node.cc | |
be62a70f ER |
77 | @@ -1102,7 +1100,7 @@ enum encoding ParseEncoding(Handle<Value> encoding_v, enum encoding _default) { |
78 | ||
79 | if (!encoding_v->IsString()) return _default; | |
80 | ||
81 | - node::Utf8Value encoding(encoding_v); | |
82 | + String::Utf8Value encoding(encoding_v); | |
83 | ||
84 | if (strcasecmp(*encoding, "utf8") == 0) { | |
85 | return UTF8; | |
86 | @@ -1202,12 +1200,12 @@ void DisplayExceptionLine (TryCatch &try_catch) { | |
87 | ||
88 | if (!message.IsEmpty()) { | |
89 | // Print (filename):(line number): (message). | |
90 | - node::Utf8Value filename(message->GetScriptResourceName()); | |
91 | + String::Utf8Value filename(message->GetScriptResourceName()); | |
92 | const char* filename_string = *filename; | |
93 | int linenum = message->GetLineNumber(); | |
94 | fprintf(stderr, "%s:%i\n", filename_string, linenum); | |
95 | // Print line of source code. | |
96 | - node::Utf8Value sourceline(message->GetSourceLine()); | |
97 | + String::Utf8Value sourceline(message->GetSourceLine()); | |
98 | const char* sourceline_string = *sourceline; | |
99 | ||
100 | // Because of how node modules work, all scripts are wrapped with a | |
101 | @@ -1254,7 +1252,7 @@ static void ReportException(TryCatch &try_catch, bool show_line) { | |
102 | ||
103 | if (show_line) DisplayExceptionLine(try_catch); | |
104 | ||
105 | - node::Utf8Value trace(try_catch.StackTrace()); | |
106 | + String::Utf8Value trace(try_catch.StackTrace()); | |
107 | ||
108 | // range errors have a trace member set to undefined | |
109 | if (trace.length() > 0 && !try_catch.StackTrace()->IsUndefined()) { | |
110 | @@ -1269,11 +1267,11 @@ static void ReportException(TryCatch &try_catch, bool show_line) { | |
111 | !(er->ToObject()->Get(String::New("name"))->IsUndefined()); | |
112 | ||
113 | if (isErrorObject) { | |
114 | - node::Utf8Value name(er->ToObject()->Get(String::New("name"))); | |
115 | + String::Utf8Value name(er->ToObject()->Get(String::New("name"))); | |
116 | fprintf(stderr, "%s: ", *name); | |
117 | } | |
118 | ||
119 | - node::Utf8Value msg(!isErrorObject ? er | |
120 | + String::Utf8Value msg(!isErrorObject ? er | |
121 | : er->ToObject()->Get(String::New("message"))); | |
122 | fprintf(stderr, "%s\n", *msg); | |
123 | } | |
124 | @@ -1355,7 +1353,7 @@ static Handle<Value> Chdir(const Arguments& args) { | |
125 | return ThrowException(Exception::Error(String::New("Bad argument."))); | |
126 | } | |
127 | ||
128 | - node::Utf8Value path(args[0]); | |
129 | + String::Utf8Value path(args[0]); | |
130 | ||
131 | uv_err_t r = uv_chdir(*path); | |
132 | ||
133 | @@ -1406,7 +1404,7 @@ static Handle<Value> Umask(const Arguments& args) { | |
134 | oct = args[0]->Uint32Value(); | |
135 | } else { | |
136 | oct = 0; | |
137 | - node::Utf8Value str(args[0]); | |
138 | + String::Utf8Value str(args[0]); | |
139 | ||
140 | // Parse the octal string. | |
141 | for (int i = 0; i < str.length(); i++) { | |
142 | @@ -1512,7 +1510,7 @@ static uid_t uid_by_name(Handle<Value> value) { | |
143 | if (value->IsUint32()) { | |
144 | return static_cast<uid_t>(value->Uint32Value()); | |
145 | } else { | |
146 | - node::Utf8Value name(value); | |
147 | + String::Utf8Value name(value); | |
148 | return uid_by_name(*name); | |
149 | } | |
150 | } | |
151 | @@ -1522,7 +1520,7 @@ static gid_t gid_by_name(Handle<Value> value) { | |
152 | if (value->IsUint32()) { | |
153 | return static_cast<gid_t>(value->Uint32Value()); | |
154 | } else { | |
155 | - node::Utf8Value name(value); | |
156 | + String::Utf8Value name(value); | |
157 | return gid_by_name(*name); | |
158 | } | |
159 | } | |
160 | @@ -1665,7 +1663,7 @@ static Handle<Value> InitGroups(const Arguments& args) { | |
161 | return ThrowTypeError("argument 2 must be a number or a string"); | |
162 | } | |
163 | ||
164 | - node::Utf8Value arg0(args[0]); | |
165 | + String::Utf8Value arg0(args[0]); | |
166 | gid_t extra_group; | |
167 | bool must_free; | |
168 | char* user; | |
169 | @@ -1826,7 +1824,7 @@ Handle<Value> DLOpen(const v8::Arguments& args) { | |
170 | } | |
171 | ||
172 | Local<Object> module = args[0]->ToObject(); // Cast | |
173 | - node::Utf8Value filename(args[1]); // Cast | |
174 | + String::Utf8Value filename(args[1]); // Cast | |
175 | ||
176 | if (exports_symbol.IsEmpty()) { | |
177 | exports_symbol = NODE_PSYMBOL("exports"); | |
178 | @@ -1842,7 +1840,7 @@ Handle<Value> DLOpen(const v8::Arguments& args) { | |
179 | return ThrowException(Exception::Error(errmsg)); | |
180 | } | |
181 | ||
182 | - node::Utf8Value path(args[1]); | |
183 | + String::Utf8Value path(args[1]); | |
184 | base = *path; | |
185 | ||
186 | /* Find the shared library filename within the full path. */ | |
187 | @@ -1961,7 +1959,7 @@ static Handle<Value> Binding(const Arguments& args) { | |
188 | HandleScope scope; | |
189 | ||
190 | Local<String> module = args[0]->ToString(); | |
191 | - node::Utf8Value module_v(module); | |
192 | + String::Utf8Value module_v(module); | |
193 | node_module_struct* modp; | |
194 | ||
195 | if (binding_cache.IsEmpty()) { | |
196 | @@ -2020,7 +2018,7 @@ static void ProcessTitleSetter(Local<String> property, | |
197 | Local<Value> value, | |
198 | const AccessorInfo& info) { | |
199 | HandleScope scope; | |
200 | - node::Utf8Value title(value); | |
201 | + String::Utf8Value title(value); | |
202 | // TODO: protect with a lock | |
203 | uv_set_process_title(*title); | |
204 | } | |
205 | @@ -2030,7 +2028,7 @@ static Handle<Value> EnvGetter(Local<String> property, | |
206 | const AccessorInfo& info) { | |
207 | HandleScope scope; | |
208 | #ifdef __POSIX__ | |
209 | - node::Utf8Value key(property); | |
210 | + String::Utf8Value key(property); | |
211 | const char* val = getenv(*key); | |
212 | if (val) { | |
213 | return scope.Close(String::New(val)); | |
214 | @@ -2059,8 +2057,8 @@ static Handle<Value> EnvSetter(Local<String> property, | |
215 | const AccessorInfo& info) { | |
216 | HandleScope scope; | |
217 | #ifdef __POSIX__ | |
218 | - node::Utf8Value key(property); | |
219 | - node::Utf8Value val(value); | |
220 | + String::Utf8Value key(property); | |
221 | + String::Utf8Value val(value); | |
222 | setenv(*key, *val, 1); | |
223 | #else // _WIN32 | |
224 | String::Value key(property); | |
225 | @@ -2080,7 +2078,7 @@ static Handle<Integer> EnvQuery(Local<String> property, | |
226 | const AccessorInfo& info) { | |
227 | HandleScope scope; | |
228 | #ifdef __POSIX__ | |
229 | - node::Utf8Value key(property); | |
230 | + String::Utf8Value key(property); | |
231 | if (getenv(*key)) { | |
232 | return scope.Close(Integer::New(0)); | |
233 | } | |
234 | @@ -2108,7 +2106,7 @@ static Handle<Boolean> EnvDeleter(Local<String> property, | |
235 | const AccessorInfo& info) { | |
236 | HandleScope scope; | |
237 | #ifdef __POSIX__ | |
238 | - node::Utf8Value key(property); | |
239 | + String::Utf8Value key(property); | |
240 | if (!getenv(*key)) return False(); | |
241 | unsetenv(*key); // can't check return value, it's void on some platforms | |
242 | return True(); | |
243 | diff --git a/src/node_crypto.cc b/src/node_crypto.cc | |
244 | index 46faba2..0ae1f8a 100644 | |
245 | --- a/src/node_crypto.cc | |
246 | +++ b/src/node_crypto.cc | |
be62a70f ER |
247 | @@ -242,7 +241,7 @@ Handle<Value> SecureContext::Init(const Arguments& args) { |
248 | OPENSSL_CONST SSL_METHOD *method = SSLv23_method(); | |
249 | ||
250 | if (args.Length() == 1 && args[0]->IsString()) { | |
251 | - node::Utf8Value sslmethod(args[0]); | |
252 | + String::Utf8Value sslmethod(args[0]); | |
253 | ||
254 | if (strcmp(*sslmethod, "SSLv2_method") == 0) { | |
255 | #ifndef OPENSSL_NO_SSL2 | |
256 | @@ -362,7 +361,7 @@ static BIO* LoadBIO (Handle<Value> v) { | |
257 | int r = -1; | |
258 | ||
259 | if (v->IsString()) { | |
260 | - node::Utf8Value s(v); | |
261 | + String::Utf8Value s(v); | |
262 | r = BIO_write(bio, *s, s.length()); | |
263 | } else if (Buffer::HasInstance(v)) { | |
264 | char* buffer_data = Buffer::Data(v); | |
265 | @@ -414,7 +413,7 @@ Handle<Value> SecureContext::SetKey(const Arguments& args) { | |
266 | BIO *bio = LoadBIO(args[0]); | |
267 | if (!bio) return False(); | |
268 | ||
269 | - node::Utf8Value passphrase(args[1]); | |
270 | + String::Utf8Value passphrase(args[1]); | |
271 | ||
272 | EVP_PKEY* key = PEM_read_bio_PrivateKey(bio, NULL, NULL, | |
273 | len == 1 ? NULL : *passphrase); | |
274 | @@ -644,7 +643,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) { | |
275 | return ThrowException(Exception::TypeError(String::New("Bad parameter"))); | |
276 | } | |
277 | ||
278 | - node::Utf8Value ciphers(args[0]); | |
279 | + String::Utf8Value ciphers(args[0]); | |
280 | SSL_CTX_set_cipher_list(sc->ctx_, *ciphers); | |
281 | ||
282 | return True(); | |
283 | @@ -673,7 +672,7 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) { | |
284 | return ThrowException(Exception::TypeError(String::New("Bad parameter"))); | |
285 | } | |
286 | ||
287 | - node::Utf8Value sessionIdContext(args[0]); | |
288 | + String::Utf8Value sessionIdContext(args[0]); | |
289 | const unsigned char* sid_ctx = (const unsigned char*) *sessionIdContext; | |
290 | unsigned int sid_ctx_len = sessionIdContext.length(); | |
291 | ||
292 | @@ -1281,7 +1280,7 @@ Handle<Value> Connection::New(const Arguments& args) { | |
293 | if (is_server) { | |
294 | SSL_CTX_set_tlsext_servername_callback(sc->ctx_, SelectSNIContextCallback_); | |
295 | } else { | |
296 | - node::Utf8Value servername(args[2]); | |
297 | + String::Utf8Value servername(args[2]); | |
298 | SSL_set_tlsext_host_name(p->ssl_, *servername); | |
299 | } | |
300 | #endif | |
301 | @@ -2234,7 +2233,7 @@ class Cipher : public ObjectWrap { | |
302 | ssize_t key_written = DecodeWrite(key_buf, key_buf_len, args[1], BINARY); | |
303 | assert(key_written == key_buf_len); | |
304 | ||
305 | - node::Utf8Value cipherType(args[0]); | |
306 | + String::Utf8Value cipherType(args[0]); | |
307 | ||
308 | bool r = cipher->CipherInit(*cipherType, key_buf, key_buf_len); | |
309 | ||
310 | @@ -2285,7 +2284,7 @@ class Cipher : public ObjectWrap { | |
311 | ssize_t iv_written = DecodeWrite(iv_buf, iv_len, args[2], BINARY); | |
312 | assert(iv_written == iv_len); | |
313 | ||
314 | - node::Utf8Value cipherType(args[0]); | |
315 | + String::Utf8Value cipherType(args[0]); | |
316 | ||
317 | bool r = cipher->CipherInitIv(*cipherType, key_buf,key_len,iv_buf,iv_len); | |
318 | ||
319 | @@ -2544,7 +2543,7 @@ class Decipher : public ObjectWrap { | |
320 | ssize_t key_written = DecodeWrite(key_buf, key_len, args[1], BINARY); | |
321 | assert(key_written == key_len); | |
322 | ||
323 | - node::Utf8Value cipherType(args[0]); | |
324 | + String::Utf8Value cipherType(args[0]); | |
325 | ||
326 | bool r = cipher->DecipherInit(*cipherType, key_buf,key_len); | |
327 | ||
328 | @@ -2595,7 +2594,7 @@ class Decipher : public ObjectWrap { | |
329 | ssize_t iv_written = DecodeWrite(iv_buf, iv_len, args[2], BINARY); | |
330 | assert(iv_written == iv_len); | |
331 | ||
332 | - node::Utf8Value cipherType(args[0]); | |
333 | + String::Utf8Value cipherType(args[0]); | |
334 | ||
335 | bool r = cipher->DecipherInitIv(*cipherType, key_buf,key_len,iv_buf,iv_len); | |
336 | ||
337 | @@ -2776,7 +2775,7 @@ class Hmac : public ObjectWrap { | |
338 | return ThrowException(exception); | |
339 | } | |
340 | ||
341 | - node::Utf8Value hashType(args[0]); | |
342 | + String::Utf8Value hashType(args[0]); | |
343 | ||
344 | bool r; | |
345 | ||
346 | @@ -2921,7 +2920,7 @@ class Hash : public ObjectWrap { | |
347 | "Must give hashtype string as argument"))); | |
348 | } | |
349 | ||
350 | - node::Utf8Value hashType(args[0]); | |
351 | + String::Utf8Value hashType(args[0]); | |
352 | ||
353 | Hash *hash = new Hash(); | |
354 | if (!hash->HashInit(*hashType)) { | |
355 | @@ -3095,7 +3094,7 @@ class Sign : public ObjectWrap { | |
356 | "Must give signtype string as argument"))); | |
357 | } | |
358 | ||
359 | - node::Utf8Value signType(args[0]); | |
360 | + String::Utf8Value signType(args[0]); | |
361 | ||
362 | bool r = sign->SignInit(*signType); | |
363 | ||
364 | @@ -3328,7 +3327,7 @@ class Verify : public ObjectWrap { | |
365 | "Must give verifytype string as argument"))); | |
366 | } | |
367 | ||
368 | - node::Utf8Value verifyType(args[0]); | |
369 | + String::Utf8Value verifyType(args[0]); | |
370 | ||
371 | bool r = verify->VerifyInit(*verifyType); | |
372 | ||
373 | @@ -3511,7 +3510,7 @@ class DiffieHellman : public ObjectWrap { | |
374 | String::New("No group name given"))); | |
375 | } | |
376 | ||
377 | - node::Utf8Value group_name(args[0]); | |
378 | + String::Utf8Value group_name(args[0]); | |
379 | ||
380 | modp_group* it = modp_groups; | |
381 | ||
382 | diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc | |
383 | index 0b2d0f4..4b851e3 100644 | |
384 | --- a/src/node_dtrace.cc | |
385 | +++ b/src/node_dtrace.cc | |
be62a70f ER |
386 | @@ -68,7 +66,7 @@ using namespace v8; |
387 | return (ThrowException(Exception::Error(String::New("expected " \ | |
388 | "object for " #obj " to contain string member " #member)))); \ | |
389 | } \ | |
390 | - node::Utf8Value _##member(obj->Get(String::New(#member))); \ | |
391 | + String::Utf8Value _##member(obj->Get(String::New(#member))); \ | |
392 | if ((*(const char **)valp = *_##member) == NULL) \ | |
393 | *(const char **)valp = "<unknown>"; | |
394 | ||
395 | @@ -243,7 +241,7 @@ Handle<Value> DTRACE_HTTP_SERVER_REQUEST(const Arguments& args) { | |
396 | "object for request to contain string member headers")))); | |
397 | ||
398 | Local<Value> strfwdfor = headers->Get(String::New("x-forwarded-for")); | |
399 | - node::Utf8Value fwdfor(strfwdfor); | |
400 | + String::Utf8Value fwdfor(strfwdfor); | |
401 | ||
402 | if (!strfwdfor->IsString() || (req.forwardedFor = *fwdfor) == NULL) | |
403 | req.forwardedFor = const_cast<char*>(""); | |
404 | diff --git a/src/node_file.cc b/src/node_file.cc | |
405 | index 3c35e0b..f665b19 100644 | |
406 | --- a/src/node_file.cc | |
407 | +++ b/src/node_file.cc | |
be62a70f ER |
408 | @@ -404,7 +403,7 @@ static Handle<Value> Stat(const Arguments& args) { |
409 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
410 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
411 | ||
412 | - node::Utf8Value path(args[0]); | |
413 | + String::Utf8Value path(args[0]); | |
414 | ||
415 | if (args[1]->IsFunction()) { | |
416 | ASYNC_CALL(stat, args[1], *path) | |
417 | @@ -421,7 +420,7 @@ static Handle<Value> LStat(const Arguments& args) { | |
418 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
419 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
420 | ||
421 | - node::Utf8Value path(args[0]); | |
422 | + String::Utf8Value path(args[0]); | |
423 | ||
424 | if (args[1]->IsFunction()) { | |
425 | ASYNC_CALL(lstat, args[1], *path) | |
426 | @@ -459,12 +458,12 @@ static Handle<Value> Symlink(const Arguments& args) { | |
427 | if (!args[0]->IsString()) return TYPE_ERROR("dest path must be a string"); | |
428 | if (!args[1]->IsString()) return TYPE_ERROR("src path must be a string"); | |
429 | ||
430 | - node::Utf8Value dest(args[0]); | |
431 | - node::Utf8Value path(args[1]); | |
432 | + String::Utf8Value dest(args[0]); | |
433 | + String::Utf8Value path(args[1]); | |
434 | int flags = 0; | |
435 | ||
436 | if (args[2]->IsString()) { | |
437 | - node::Utf8Value mode(args[2]); | |
438 | + String::Utf8Value mode(args[2]); | |
439 | if (strcmp(*mode, "dir") == 0) { | |
440 | flags |= UV_FS_SYMLINK_DIR; | |
441 | } else if (strcmp(*mode, "junction") == 0) { | |
442 | @@ -492,8 +491,8 @@ static Handle<Value> Link(const Arguments& args) { | |
443 | if (!args[0]->IsString()) return TYPE_ERROR("dest path must be a string"); | |
444 | if (!args[1]->IsString()) return TYPE_ERROR("src path must be a string"); | |
445 | ||
446 | - node::Utf8Value orig_path(args[0]); | |
447 | - node::Utf8Value new_path(args[1]); | |
448 | + String::Utf8Value orig_path(args[0]); | |
449 | + String::Utf8Value new_path(args[1]); | |
450 | ||
451 | if (args[2]->IsFunction()) { | |
452 | ASYNC_DEST_CALL(link, args[2], *new_path, *orig_path, *new_path) | |
453 | @@ -509,7 +508,7 @@ static Handle<Value> ReadLink(const Arguments& args) { | |
454 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
455 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
456 | ||
457 | - node::Utf8Value path(args[0]); | |
458 | + String::Utf8Value path(args[0]); | |
459 | ||
460 | if (args[1]->IsFunction()) { | |
461 | ASYNC_CALL(readlink, args[1], *path) | |
462 | @@ -528,8 +527,8 @@ static Handle<Value> Rename(const Arguments& args) { | |
463 | if (!args[0]->IsString()) return TYPE_ERROR("old path must be a string"); | |
464 | if (!args[1]->IsString()) return TYPE_ERROR("new path must be a string"); | |
465 | ||
466 | - node::Utf8Value old_path(args[0]); | |
467 | - node::Utf8Value new_path(args[1]); | |
468 | + String::Utf8Value old_path(args[0]); | |
469 | + String::Utf8Value new_path(args[1]); | |
470 | ||
471 | if (args[2]->IsFunction()) { | |
472 | ASYNC_DEST_CALL(rename, args[2], *new_path, *old_path, *new_path) | |
473 | @@ -599,7 +598,7 @@ static Handle<Value> Unlink(const Arguments& args) { | |
474 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
475 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
476 | ||
477 | - node::Utf8Value path(args[0]); | |
478 | + String::Utf8Value path(args[0]); | |
479 | ||
480 | if (args[1]->IsFunction()) { | |
481 | ASYNC_CALL(unlink, args[1], *path) | |
482 | @@ -615,7 +614,7 @@ static Handle<Value> RMDir(const Arguments& args) { | |
483 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
484 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
485 | ||
486 | - node::Utf8Value path(args[0]); | |
487 | + String::Utf8Value path(args[0]); | |
488 | ||
489 | if (args[1]->IsFunction()) { | |
490 | ASYNC_CALL(rmdir, args[1], *path) | |
491 | @@ -632,7 +631,7 @@ static Handle<Value> MKDir(const Arguments& args) { | |
492 | return THROW_BAD_ARGS; | |
493 | } | |
494 | ||
495 | - node::Utf8Value path(args[0]); | |
496 | + String::Utf8Value path(args[0]); | |
497 | int mode = static_cast<int>(args[1]->Int32Value()); | |
498 | ||
499 | if (args[2]->IsFunction()) { | |
500 | @@ -649,7 +648,7 @@ static Handle<Value> ReadDir(const Arguments& args) { | |
501 | if (args.Length() < 1) return TYPE_ERROR("path required"); | |
502 | if (!args[0]->IsString()) return TYPE_ERROR("path must be a string"); | |
503 | ||
504 | - node::Utf8Value path(args[0]); | |
505 | + String::Utf8Value path(args[0]); | |
506 | ||
507 | if (args[1]->IsFunction()) { | |
508 | ASYNC_CALL(readdir, args[1], *path, 0 /*flags*/) | |
509 | @@ -687,7 +686,7 @@ static Handle<Value> Open(const Arguments& args) { | |
510 | if (!args[1]->IsInt32()) return TYPE_ERROR("flags must be an int"); | |
511 | if (!args[2]->IsInt32()) return TYPE_ERROR("mode must be an int"); | |
512 | ||
513 | - node::Utf8Value path(args[0]); | |
514 | + String::Utf8Value path(args[0]); | |
515 | int flags = args[1]->Int32Value(); | |
516 | int mode = static_cast<int>(args[2]->Int32Value()); | |
517 | ||
518 | @@ -827,7 +826,7 @@ static Handle<Value> Chmod(const Arguments& args) { | |
519 | if(args.Length() < 2 || !args[0]->IsString() || !args[1]->IsInt32()) { | |
520 | return THROW_BAD_ARGS; | |
521 | } | |
522 | - node::Utf8Value path(args[0]); | |
523 | + String::Utf8Value path(args[0]); | |
524 | int mode = static_cast<int>(args[1]->Int32Value()); | |
525 | ||
526 | if(args[2]->IsFunction()) { | |
527 | @@ -874,7 +873,7 @@ static Handle<Value> Chown(const Arguments& args) { | |
528 | if (!args[1]->IsUint32()) return TYPE_ERROR("uid must be an unsigned int"); | |
529 | if (!args[2]->IsUint32()) return TYPE_ERROR("gid must be an unsigned int"); | |
530 | ||
531 | - node::Utf8Value path(args[0]); | |
532 | + String::Utf8Value path(args[0]); | |
533 | uv_uid_t uid = static_cast<uv_uid_t>(args[1]->Uint32Value()); | |
534 | uv_gid_t gid = static_cast<uv_gid_t>(args[2]->Uint32Value()); | |
535 | ||
536 | @@ -925,7 +924,7 @@ static Handle<Value> UTimes(const Arguments& args) { | |
537 | if (!args[1]->IsNumber()) return TYPE_ERROR("atime must be a number"); | |
538 | if (!args[2]->IsNumber()) return TYPE_ERROR("mtime must be a number"); | |
539 | ||
540 | - const node::Utf8Value path(args[0]); | |
541 | + const String::Utf8Value path(args[0]); | |
542 | const double atime = static_cast<double>(args[1]->NumberValue()); | |
543 | const double mtime = static_cast<double>(args[2]->NumberValue()); | |
544 | ||
545 | diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc | |
546 | index fd3e5d1..c3f668c 100644 | |
547 | --- a/src/node_stat_watcher.cc | |
548 | +++ b/src/node_stat_watcher.cc | |
be62a70f ER |
549 | @@ -105,7 +104,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) { |
550 | HandleScope scope; | |
551 | ||
552 | StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.Holder()); | |
553 | - node::Utf8Value path(args[0]); | |
554 | + String::Utf8Value path(args[0]); | |
555 | const bool persistent = args[1]->BooleanValue(); | |
556 | const uint32_t interval = args[2]->Uint32Value(); | |
557 | ||
558 | diff --git a/src/process_wrap.cc b/src/process_wrap.cc | |
559 | index ac63e4b..784300f 100644 | |
560 | --- a/src/process_wrap.cc | |
561 | +++ b/src/process_wrap.cc | |
be62a70f ER |
562 | @@ -188,7 +187,7 @@ class ProcessWrap : public HandleWrap { |
563 | ||
564 | // options.file | |
565 | Local<Value> file_v = js_options->Get(String::NewSymbol("file")); | |
566 | - node::Utf8Value file(file_v->IsString() ? file_v : Local<Value>()); | |
567 | + String::Utf8Value file(file_v->IsString() ? file_v : Local<Value>()); | |
568 | if (file.length() > 0) { | |
569 | options.file = *file; | |
570 | } else { | |
571 | @@ -203,7 +202,7 @@ class ProcessWrap : public HandleWrap { | |
572 | // Heap allocate to detect errors. +1 is for NULL. | |
573 | options.args = new char*[argc + 1]; | |
574 | for (int i = 0; i < argc; i++) { | |
575 | - node::Utf8Value arg(js_argv->Get(i)); | |
576 | + String::Utf8Value arg(js_argv->Get(i)); | |
577 | options.args[i] = strdup(*arg); | |
578 | } | |
579 | options.args[argc] = NULL; | |
580 | @@ -211,7 +210,7 @@ class ProcessWrap : public HandleWrap { | |
581 | ||
582 | // options.cwd | |
583 | Local<Value> cwd_v = js_options->Get(String::NewSymbol("cwd")); | |
584 | - node::Utf8Value cwd(cwd_v->IsString() ? cwd_v : Local<Value>()); | |
585 | + String::Utf8Value cwd(cwd_v->IsString() ? cwd_v : Local<Value>()); | |
586 | if (cwd.length() > 0) { | |
587 | options.cwd = *cwd; | |
588 | } | |
589 | @@ -223,7 +222,7 @@ class ProcessWrap : public HandleWrap { | |
590 | int envc = env->Length(); | |
591 | options.env = new char*[envc + 1]; // Heap allocated to detect errors. | |
592 | for (int i = 0; i < envc; i++) { | |
593 | - node::Utf8Value pair(env->Get(i)); | |
594 | + String::Utf8Value pair(env->Get(i)); | |
595 | options.env[i] = strdup(*pair); | |
596 | } | |
597 | options.env[envc] = NULL; | |
598 | diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc | |
599 | index 31a4e78..b33f4e8 100644 | |
600 | --- a/src/udp_wrap.cc | |
601 | +++ b/src/udp_wrap.cc | |
be62a70f ER |
602 | @@ -161,7 +160,7 @@ Handle<Value> UDPWrap::DoBind(const Arguments& args, int family) { |
603 | // bind(ip, port, flags) | |
604 | assert(args.Length() == 3); | |
605 | ||
606 | - node::Utf8Value address(args[0]); | |
607 | + String::Utf8Value address(args[0]); | |
608 | const int port = args[1]->Uint32Value(); | |
609 | const int flags = args[2]->Uint32Value(); | |
610 | ||
611 | @@ -220,8 +219,8 @@ Handle<Value> UDPWrap::SetMembership(const Arguments& args, | |
612 | ||
613 | assert(args.Length() == 2); | |
614 | ||
615 | - node::Utf8Value address(args[0]); | |
616 | - node::Utf8Value iface(args[1]); | |
617 | + String::Utf8Value address(args[0]); | |
618 | + String::Utf8Value iface(args[1]); | |
619 | ||
620 | const char* iface_cstr = *iface; | |
621 | if (args[1]->IsUndefined() || args[1]->IsNull()) { | |
622 | @@ -272,7 +271,7 @@ Handle<Value> UDPWrap::DoSend(const Arguments& args, int family) { | |
623 | length); | |
624 | ||
625 | const unsigned short port = args[3]->Uint32Value(); | |
626 | - node::Utf8Value address(args[4]); | |
627 | + String::Utf8Value address(args[4]); | |
628 | ||
629 | switch (family) { | |
630 | case AF_INET: | |
631 | diff --git a/src/util.h b/src/util.h | |
be62a70f | 632 | --- a/src/util.h |
295463b0 ER |
633 | +++ b/src/util.h |
634 | @@ -41,52 +41,6 @@ | |
635 | obj->Set(domain_symbol, domain); | |
636 | } | |
637 | ||
be62a70f ER |
638 | -class Utf8Value { |
639 | - public: | |
640 | - explicit Utf8Value(v8::Handle<v8::Value> value) | |
641 | - : length_(0), str_(NULL) { | |
642 | - if (value.IsEmpty()) | |
643 | - return; | |
644 | - | |
645 | - v8::Local<v8::String> val_ = value->ToString(); | |
646 | - | |
647 | - // Allocate enough space to include the null terminator | |
648 | - size_t len = StringBytes::StorageSize(val_, UTF8) + 1; | |
649 | - | |
650 | - char* str = static_cast<char*>(calloc(1, len)); | |
651 | - | |
652 | - int flags = WRITE_UTF8_FLAGS; | |
653 | - flags |= ~v8::String::NO_NULL_TERMINATION; | |
654 | - | |
655 | - length_ = val_->WriteUtf8(str, | |
656 | - len, | |
657 | - 0, | |
658 | - flags); | |
659 | - | |
660 | - str_ = reinterpret_cast<char*>(str); | |
661 | - } | |
662 | - | |
663 | - ~Utf8Value() { | |
664 | - free(str_); | |
665 | - } | |
666 | - | |
667 | - char* operator*() { | |
668 | - return str_; | |
669 | - }; | |
670 | - | |
671 | - const char* operator*() const { | |
672 | - return str_; | |
673 | - }; | |
674 | - | |
675 | - size_t length() const { | |
676 | - return length_; | |
677 | - }; | |
678 | - | |
679 | - private: | |
680 | - size_t length_; | |
681 | - char* str_; | |
682 | -}; | |
683 | - | |
295463b0 ER |
684 | } // namespace node |
685 | ||
686 | #endif // SRC_UTIL_H_ | |
be62a70f ER |
687 | -- |
688 | 1.9.3 | |
689 |