Browse Source

node: replace NODE_STAT_STRUCT with uv_statbuf_t

v0.9.1-release
Ben Noordhuis 13 years ago
parent
commit
09150b0616
  1. 14
      src/node.h
  2. 16
      src/node_file.cc

14
src/node.h

@ -144,19 +144,7 @@ ssize_t DecodeWrite(char *buf,
v8::Handle<v8::Value>,
enum encoding encoding = BINARY);
// Use different stat structs & calls on windows and posix;
// on windows, _stati64 is utf-8 and big file aware.
#if __POSIX__
# define NODE_STAT stat
# define NODE_FSTAT fstat
# define NODE_STAT_STRUCT struct stat
#else // _WIN32
# define NODE_STAT _stati64
# define NODE_FSTAT _fstati64
# define NODE_STAT_STRUCT struct _stati64
#endif
v8::Local<v8::Object> BuildStatsObject(NODE_STAT_STRUCT *s);
v8::Local<v8::Object> BuildStatsObject(const uv_statbuf_t* s);
/**

16
src/node_file.cc

@ -158,10 +158,7 @@ static void After(uv_fs_t *req) {
case UV_FS_STAT:
case UV_FS_LSTAT:
case UV_FS_FSTAT:
{
NODE_STAT_STRUCT *s = reinterpret_cast<NODE_STAT_STRUCT*>(req->ptr);
argv[1] = BuildStatsObject(s);
}
argv[1] = BuildStatsObject(static_cast<const uv_statbuf_t*>(req->ptr));
break;
case UV_FS_READLINK:
@ -284,7 +281,7 @@ static Persistent<String> atime_symbol;
static Persistent<String> mtime_symbol;
static Persistent<String> ctime_symbol;
Local<Object> BuildStatsObject(NODE_STAT_STRUCT *s) {
Local<Object> BuildStatsObject(const uv_statbuf_t* s) {
HandleScope scope;
if (dev_symbol.IsEmpty()) {
@ -362,7 +359,8 @@ static Handle<Value> Stat(const Arguments& args) {
ASYNC_CALL(stat, args[1], *path)
} else {
SYNC_CALL(stat, *path, *path)
return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
return scope.Close(
BuildStatsObject(static_cast<const uv_statbuf_t*>(SYNC_REQ.ptr)));
}
}
@ -378,7 +376,8 @@ static Handle<Value> LStat(const Arguments& args) {
ASYNC_CALL(lstat, args[1], *path)
} else {
SYNC_CALL(lstat, *path, *path)
return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
return scope.Close(
BuildStatsObject(static_cast<const uv_statbuf_t*>(SYNC_REQ.ptr)));
}
}
@ -395,7 +394,8 @@ static Handle<Value> FStat(const Arguments& args) {
ASYNC_CALL(fstat, args[1], fd)
} else {
SYNC_CALL(fstat, 0, fd)
return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
return scope.Close(
BuildStatsObject(static_cast<const uv_statbuf_t*>(SYNC_REQ.ptr)));
}
}

Loading…
Cancel
Save