| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4c47b01 commit b46184d
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ extern "C" { | |||
| 10 | 10 | ||
| 11 | 11 | #define UVWASI_VERSION_MAJOR 0 | |
| 12 | 12 | #define UVWASI_VERSION_MINOR 0 | |
| 13 | - #define UVWASI_VERSION_PATCH 11 | ||
| 13 | + #define UVWASI_VERSION_PATCH 12 | ||
| 14 | 14 | #define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \ | |
| 15 | 15 | (UVWASI_VERSION_MINOR << 8) | \ | |
| 16 | 16 | (UVWASI_VERSION_PATCH)) | |
@@ -68,7 +68,7 @@ typedef struct uvwasi_options_s { | |||
| 68 | 68 | } uvwasi_options_t; | |
| 69 | 69 | ||
| 70 | 70 | /* Embedder API. */ | |
| 71 | - uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options); | ||
| 71 | + uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options); | ||
| 72 | 72 | void uvwasi_destroy(uvwasi_t* uvwasi); | |
| 73 | 73 | void uvwasi_options_init(uvwasi_options_t* options); | |
| 74 | 74 | /* Use int instead of uv_file to avoid needing uv.h */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | #include <stddef.h> | |
| 5 | 5 | #include <stdint.h> | |
| 6 | 6 | ||
| 7 | - /* API: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md */ | ||
| 7 | + /* API: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md */ | ||
| 8 | 8 | ||
| 9 | 9 | typedef uint32_t uvwasi_size_t; | |
| 10 | 10 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,12 +37,12 @@ | |||
| 37 | 37 | ); \ | |
| 38 | 38 | } \ | |
| 39 | 39 | \ | |
| 40 | - (time) = (((sys_system.wHour * 3600) + (sys_system.wMinute * 60) + \ | ||
| 41 | - sys_system.wSecond) * NANOS_PER_SEC) + \ | ||
| 42 | - (sys_system.wMilliseconds * 1000000) + \ | ||
| 43 | - (((sys_user.wHour * 3600) + (sys_user.wMinute * 60) + \ | ||
| 44 | - sys_user.wSecond) * NANOS_PER_SEC) + \ | ||
| 45 | - (sys_user.wMilliseconds * 1000000); \ | ||
| 40 | + (time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \ | ||
| 41 | + (sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \ | ||
| 42 | + ((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \ | ||
| 43 | + (((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \ | ||
| 44 | + (sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \ | ||
| 45 | + ((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \ | ||
| 46 | 46 | return UVWASI_ESUCCESS; \ | |
| 47 | 47 | } while (0) | |
| 48 | 48 | ||
@@ -52,7 +52,7 @@ | |||
| 52 | 52 | struct timespec ts; \ | |
| 53 | 53 | if (0 != clock_gettime((clk), &ts)) \ | |
| 54 | 54 | return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \ | |
| 55 | - (time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \ | ||
| 55 | + (time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \ | ||
| 56 | 56 | return UVWASI_ESUCCESS; \ | |
| 57 | 57 | } while (0) | |
| 58 | 58 | ||
@@ -62,9 +62,9 @@ | |||
| 62 | 62 | struct rusage ru; \ | |
| 63 | 63 | if (0 != getrusage((who), &ru)) \ | |
| 64 | 64 | return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \ | |
| 65 | - (time) = (ru.ru_utime.tv_sec * NANOS_PER_SEC) + \ | ||
| 65 | + (time) = ((uvwasi_timestamp_t)(ru.ru_utime.tv_sec) * NANOS_PER_SEC) + \ | ||
| 66 | 66 | (ru.ru_utime.tv_usec * 1000) + \ | |
| 67 | - (ru.ru_stime.tv_sec * NANOS_PER_SEC) + \ | ||
| 67 | + ((uvwasi_timestamp_t)(ru.ru_stime.tv_sec) * NANOS_PER_SEC) + \ | ||
| 68 | 68 | (ru.ru_stime.tv_usec * 1000); \ | |
| 69 | 69 | return UVWASI_ESUCCESS; \ | |
| 70 | 70 | } while (0) | |
@@ -83,9 +83,9 @@ | |||
| 83 | 83 | &count)) { \ | |
| 84 | 84 | return UVWASI_ENOSYS; \ | |
| 85 | 85 | } \ | |
| 86 | - (time) = (info.user_time.seconds * NANOS_PER_SEC) + \ | ||
| 86 | + (time) = ((uvwasi_timestamp_t)(info.user_time.seconds) * NANOS_PER_SEC) + \ | ||
| 87 | 87 | (info.user_time.microseconds * 1000) + \ | |
| 88 | - (info.system_time.seconds * NANOS_PER_SEC) + \ | ||
| 88 | + ((uvwasi_timestamp_t)(info.system_time.seconds) * NANOS_PER_SEC) + \ | ||
| 89 | 89 | (info.system_time.microseconds * 1000); \ | |
| 90 | 90 | return UVWASI_ESUCCESS; \ | |
| 91 | 91 | } while (0) | |
@@ -109,7 +109,7 @@ | |||
| 109 | 109 | if (0 != clock_getres((clk), &ts)) \ | |
| 110 | 110 | (time) = 1000000; \ | |
| 111 | 111 | else \ | |
| 112 | - (time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \ | ||
| 112 | + (time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \ | ||
| 113 | 113 | return UVWASI_ESUCCESS; \ | |
| 114 | 114 | } while (0) | |
| 115 | 115 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,7 +172,7 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi, | |||
| 172 | 172 | ||
| 173 | 173 | ||
| 174 | 174 | uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi, | |
| 175 | - uvwasi_options_t* options) { | ||
| 175 | + const uvwasi_options_t* options) { | ||
| 176 | 176 | struct uvwasi_fd_table_t* table; | |
| 177 | 177 | uvwasi_errno_t err; | |
| 178 | 178 | int r; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ struct uvwasi_fd_table_t { | |||
| 29 | 29 | }; | |
| 30 | 30 | ||
| 31 | 31 | uvwasi_errno_t uvwasi_fd_table_init(struct uvwasi_s* uvwasi, | |
| 32 | - struct uvwasi_options_s* options); | ||
| 32 | + const struct uvwasi_options_s* options); | ||
| 33 | 33 | void uvwasi_fd_table_free(struct uvwasi_s* uvwasi, | |
| 34 | 34 | struct uvwasi_fd_table_t* table); | |
| 35 | 35 | uvwasi_errno_t uvwasi_fd_table_insert(struct uvwasi_s* uvwasi, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,6 +127,9 @@ void* uvwasi__malloc(const uvwasi_t* uvwasi, size_t size) { | |||
| 127 | 127 | } | |
| 128 | 128 | ||
| 129 | 129 | void uvwasi__free(const uvwasi_t* uvwasi, void* ptr) { | |
| 130 | + if (ptr == NULL) | ||
| 131 | + return; | ||
| 132 | + | ||
| 130 | 133 | uvwasi->allocator->free(ptr, uvwasi->allocator->mem_user_data); | |
| 131 | 134 | } | |
| 132 | 135 | ||
@@ -229,7 +232,7 @@ static uvwasi_errno_t uvwasi__setup_ciovs(const uvwasi_t* uvwasi, | |||
| 229 | 232 | } | |
| 230 | 233 | ||
| 231 | 234 | ||
| 232 | - uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) { | ||
| 235 | + uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options) { | ||
| 233 | 236 | uv_fs_t realpath_req; | |
| 234 | 237 | uv_fs_t open_req; | |
| 235 | 238 | uvwasi_errno_t err; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments