Changeset 19140
- Timestamp:
- 09/10/08 22:36:21 (5 years ago)
- Files:
-
- 1 modified
-
lang/cplusplus/fcgi-v8/trunk/src/file.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/fcgi-v8/trunk/src/file.cc
r19138 r19140 7 7 8 8 using namespace v8; 9 10 static FILE *_get_fh(const v8::Arguments &args) { 11 Local<Value> field = args.This()->GetInternalField(0); 12 if (!field->IsExternal()) { 13 ThrowException(v8::String::New("Exception: file handle")); 14 } 15 FILE *fh = reinterpret_cast<FILE *>(v8::Handle<v8::External>::Cast(field)->Value()); 16 if (!fh) { 17 ThrowException(v8::String::New("Exception: file handle")); 18 } 19 return fh; 20 } 9 21 10 22 v8::Handle<v8::Value> _open(const v8::Arguments& args) { … … 31 43 } 32 44 v8::HandleScope handle_scope; 33 v8::Local<v8::Value> field = args.This()->GetInternalField(0); 34 if (!field->IsExternal()) { 35 return v8::ThrowException(v8::String::New("Exception: file handle")); 36 } 37 FILE *fh = reinterpret_cast<FILE *>(v8::Handle<v8::External>::Cast(field)->Value()); 38 if (!fh) { 39 return v8::ThrowException(v8::String::New("Exception: file handle")); 40 } 45 FILE *fh = _get_fh(args); 41 46 int size = args[0]->Int32Value(); 42 47 if (size < 0) { … … 55 60 } 56 61 v8::HandleScope handle_scope; 57 v8::Local<v8::Value> field = args.This()->GetInternalField(0); 58 if (!field->IsExternal()) { 59 return v8::ThrowException(v8::String::New("Exception: file handle")); 60 } 61 FILE *fh = reinterpret_cast<FILE *>(v8::Handle<v8::External>::Cast(field)->Value()); 62 if (!fh) { 63 return v8::ThrowException(v8::String::New("Exception: file handle")); 64 } 62 FILE *fh = _get_fh(args); 65 63 v8::String::AsciiValue str(args[0]); 66 64 size_t wrote = fwrite(*str, sizeof(char), args[0]->ToString()->Length(), fh); … … 73 71 } 74 72 v8::HandleScope handle_scope; 75 v8::Local<v8::Value> field = args.This()->GetInternalField(0); 76 if (!field->IsExternal()) { 77 return v8::ThrowException(v8::String::New("Exception: file handle")); 78 } 79 FILE *fh = reinterpret_cast<FILE *>(v8::Handle<v8::External>::Cast(field)->Value()); 80 if (!fh) { 81 return v8::ThrowException(v8::String::New("Exception: file handle")); 82 } 73 FILE *fh = _get_fh(args); 83 74 int retval = fclose(fh); 84 75 if (retval) {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)