Browse Source

upgrade libuv to 82cf0b38c0

fixes #2004
v0.7.4-release
Igor Zinkovsky 13 years ago
parent
commit
5496e67f83
  1. 7
      deps/uv/src/uv-common.c
  2. 11
      deps/uv/src/win/fs.c
  3. 20
      deps/uv/src/win/process.c
  4. 66
      deps/uv/test/test-fs.c
  5. 2
      deps/uv/test/test-list.h

7
deps/uv/src/uv-common.c

@ -75,6 +75,7 @@ const char* uv_err_name(uv_err_t err) {
case UV_EINVAL: return "EINVAL";
case UV_EISCONN: return "EISCONN";
case UV_EMFILE: return "EMFILE";
case UV_EMSGSIZE: return "EMSGSIZE";
case UV_ENETDOWN: return "ENETDOWN";
case UV_ENETUNREACH: return "ENETUNREACH";
case UV_ENFILE: return "ENFILE";
@ -93,6 +94,12 @@ const char* uv_err_name(uv_err_t err) {
case UV_EPROTONOSUPPORT: return "EPROTONOSUPPORT";
case UV_EPROTOTYPE: return "EPROTOTYPE";
case UV_ETIMEDOUT: return "ETIMEDOUT";
case UV_ECHARSET: return "ECHARSET";
case UV_EAIFAMNOSUPPORT: return "EAIFAMNOSUPPORT";
case UV_EAINONAME: return "EAINONAME";
case UV_EAISERVICE: return "EAISERVICE";
case UV_EAISOCKTYPE: return "EAISOCKTYPE";
case UV_ESHUTDOWN: return "ESHUTDOWN";
case UV_EEXIST: return "EEXIST";
default:
assert(0);

11
deps/uv/src/win/fs.c

@ -173,19 +173,24 @@ void fs__open(uv_fs_t* req, const wchar_t* path, int flags, int mode) {
/* convert flags and mode to CreateFile parameters */
switch (flags & (_O_RDONLY | _O_WRONLY | _O_RDWR)) {
case _O_RDONLY:
access = GENERIC_READ;
access = FILE_GENERIC_READ;
break;
case _O_WRONLY:
access = GENERIC_WRITE;
access = FILE_GENERIC_WRITE;
break;
case _O_RDWR:
access = GENERIC_READ | GENERIC_WRITE;
access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
break;
default:
result = -1;
goto end;
}
if (flags & _O_APPEND) {
access &= ~FILE_WRITE_DATA;
access |= FILE_APPEND_DATA;
}
/*
* Here is where we deviate significantly from what CRT's _open()
* does. We indiscriminately use all the sharing modes, to match

20
deps/uv/src/win/process.c

@ -268,6 +268,8 @@ static wchar_t* search_path(const wchar_t *file,
wchar_t* result = NULL;
wchar_t *file_name_start;
wchar_t *dot;
const wchar_t *dir_start, *dir_end, *dir_path;
int dir_len;
int name_has_ext;
int file_len = wcslen(file);
@ -305,8 +307,7 @@ static wchar_t* search_path(const wchar_t *file,
name_has_ext);
} else {
const wchar_t *dir_start,
*dir_end = path;
dir_end = path;
/* The file is really only a name; look in cwd first, then scan path */
result = path_search_walk_ext(L"", 0,
@ -338,7 +339,20 @@ static wchar_t* search_path(const wchar_t *file,
continue;
}
result = path_search_walk_ext(dir_start, dir_end - dir_start,
dir_path = dir_start;
dir_len = dir_end - dir_start;
/* Adjust if the path is quoted. */
if (dir_path[0] == '"' || dir_path[0] == '\'') {
++dir_path;
--dir_len;
}
if (dir_path[dir_len - 1] == '"' || dir_path[dir_len - 1] == '\'') {
--dir_len;
}
result = path_search_walk_ext(dir_path, dir_len,
file, file_len,
cwd, cwd_len,
name_has_ext);

66
deps/uv/test/test-fs.c

@ -1408,3 +1408,69 @@ TEST_IMPL(fs_open_dir) {
return 0;
}
TEST_IMPL(fs_file_open_append) {
int r;
/* Setup. */
unlink("test_file");
loop = uv_default_loop();
r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
S_IWRITE | S_IREAD, NULL);
ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_write(loop, &write_req, open_req1.result, test_buf,
sizeof(test_buf), -1, NULL);
ASSERT(r != -1);
ASSERT(write_req.result != -1);
uv_fs_req_cleanup(&write_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(loop, &open_req1, "test_file", _O_RDWR | O_APPEND, 0, NULL);
ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_write(loop, &write_req, open_req1.result, test_buf,
sizeof(test_buf), -1, NULL);
ASSERT(r != -1);
ASSERT(write_req.result != -1);
uv_fs_req_cleanup(&write_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(loop, &open_req1, "test_file", O_RDONLY, S_IREAD, NULL);
ASSERT(r != -1);
ASSERT(open_req1.result != -1);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_read(loop, &read_req, open_req1.result, buf, sizeof(buf), -1,
NULL);
printf("read = %d\n", r);
ASSERT(r == 26);
ASSERT(read_req.result == 26);
ASSERT(memcmp(buf, "test-buffer\n\0test-buffer\n\0", sizeof(buf)) == 0);
uv_fs_req_cleanup(&read_req);
r = uv_fs_close(loop, &close_req, open_req1.result, NULL);
ASSERT(r != -1);
ASSERT(close_req.result != -1);
uv_fs_req_cleanup(&close_req);
/* Cleanup */
unlink("test_file");
return 0;
}

2
deps/uv/test/test-list.h

@ -103,6 +103,7 @@ TEST_DECLARE (fs_link)
TEST_DECLARE (fs_symlink)
TEST_DECLARE (fs_utime)
TEST_DECLARE (fs_futime)
TEST_DECLARE (fs_file_open_append)
TEST_DECLARE (fs_stat_missing_path)
TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
@ -253,6 +254,7 @@ TASK_LIST_START
TEST_ENTRY (fs_futime)
TEST_ENTRY (fs_symlink)
TEST_ENTRY (fs_stat_missing_path)
TEST_ENTRY (fs_file_open_append)
TEST_ENTRY (fs_event_watch_dir)
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_current_dir)

Loading…
Cancel
Save