Pārlūkot izejas kodu

Collective fix for typos and minor bugs (#4369)

TianlongLiang 6 mēneši atpakaļ
vecāks
revīzija
8e60feb181

+ 1 - 1
RELEASE_NOTES.md

@@ -497,7 +497,7 @@
 - wasm loader: Fix handling if block without op else (#3404)
 - ref-types: Correct default value for function local variables (#3397)
 - aot compiler: Fix the length type passed to aot_memmove/aot_memset (#3378)
-- Fix loader and mini-loader select potiential error (#3374)
+- Fix loader and mini-loader select potential error (#3374)
 - Fix aot debugger compilation error on windows (#3370)
 - A few native stack detection fixes for macOS/arm64 (#3368)
 - Fix ESP32-S3 compiling error (#3359)

+ 1 - 1
core/iwasm/common/gc/gc_type.c

@@ -1145,7 +1145,7 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1,
                 return true;
             else {
                 int32 heap_type = ref_type1->ref_ht_common.heap_type;
-                // We dont care whether type2 is nullable or not. So
+                // We don't care whether type2 is nullable or not. So
                 // we normalize it into its related one-byte type.
                 if (type2 == REF_TYPE_HT_NULLABLE
                     || type2 == REF_TYPE_HT_NON_NULLABLE) {

+ 1 - 1
core/iwasm/interpreter/wasm_loader.c

@@ -3712,7 +3712,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
              * we shall make a copy of code body [p_code, p_code + code_size]
              * when we are worrying about inappropriate releasing behaviour.
              * all code bodies are actually in a buffer which user allocates in
-             * his embedding environment and we don't have power on them.
+             * their embedding environment and we don't have power over them.
              * it will be like:
              * code_body_cp = malloc(code_size);
              * memcpy(code_body_cp, p_code, code_size);

+ 1 - 1
core/iwasm/interpreter/wasm_mini_loader.c

@@ -1226,7 +1226,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
              * we shall make a copy of code body [p_code, p_code + code_size]
              * when we are worrying about inappropriate releasing behaviour.
              * all code bodies are actually in a buffer which user allocates in
-             * his embedding environment and we don't have power on them.
+             * their embedding environment and we don't have power over them.
              * it will be like:
              * code_body_cp = malloc(code_size);
              * memcpy(code_body_cp, p_code, code_size);

+ 3 - 3
core/iwasm/libraries/debug-engine/debug_engine.c

@@ -743,7 +743,7 @@ wasm_debug_instance_get_obj_mem(WASMDebugInstance *instance, uint64 offset,
     module_inst = (WASMModuleInstance *)exec_env->module_inst;
 
     if (offset + *size > module_inst->module->load_size) {
-        LOG_VERBOSE("wasm_debug_instance_get_data_mem size over flow!\n");
+        LOG_VERBOSE("wasm_debug_instance_get_data_mem size overflow!\n");
         *size = module_inst->module->load_size >= offset
                     ? module_inst->module->load_size - offset
                     : 0;
@@ -797,7 +797,7 @@ wasm_debug_instance_get_linear_mem(WASMDebugInstance *instance, uint64 offset,
         num_bytes_per_page = memory->num_bytes_per_page;
         linear_mem_size = num_bytes_per_page * memory->cur_page_count;
         if (offset + *size > linear_mem_size) {
-            LOG_VERBOSE("wasm_debug_instance_get_linear_mem size over flow!\n");
+            LOG_VERBOSE("wasm_debug_instance_get_linear_mem size overflow!\n");
             *size = linear_mem_size >= offset ? linear_mem_size - offset : 0;
         }
         bh_memcpy_s(buf, (uint32)*size, memory->memory_data + offset,
@@ -830,7 +830,7 @@ wasm_debug_instance_set_linear_mem(WASMDebugInstance *instance, uint64 offset,
         num_bytes_per_page = memory->num_bytes_per_page;
         linear_mem_size = num_bytes_per_page * memory->cur_page_count;
         if (offset + *size > linear_mem_size) {
-            LOG_VERBOSE("wasm_debug_instance_get_linear_mem size over flow!\n");
+            LOG_VERBOSE("wasm_debug_instance_get_linear_mem size overflow!\n");
             *size = linear_mem_size >= offset ? linear_mem_size - offset : 0;
         }
         bh_memcpy_s(memory->memory_data + offset, (uint32)*size, buf,

+ 12 - 2
core/shared/platform/esp-idf/espidf_platform.c

@@ -201,10 +201,20 @@ openat(int fd, const char *pathname, int flags, ...)
     int ret;
     char dir_path[DIR_PATH_LEN];
     char *full_path;
+    mode_t mode = 0;
+    bool has_mode = false;
+
+    if (flags & O_CREAT) {
+        va_list ap;
+        va_start(ap, flags);
+        mode = (mode_t)va_arg(ap, int);
+        va_end(ap);
+        has_mode = true;
+    }
 
     ret = fcntl(fd, F_GETPATH, dir_path);
     if (ret != 0) {
-        errno = -EINVAL;
+        errno = EINVAL;
         return -1;
     }
 
@@ -214,7 +224,7 @@ openat(int fd, const char *pathname, int flags, ...)
         return -1;
     }
 
-    new_fd = open(full_path, flags);
+    new_fd = has_mode ? open(full_path, flags, mode) : open(full_path, flags);
     free(full_path);
 
     return new_fd;

+ 1 - 1
language-bindings/python/wamr-api/README.md

@@ -6,7 +6,7 @@
 
 ### Pre-requisites
 #### Install requirements
-Before proceeding it is necessary to make sure your Python environment is correctly configured. To do ths open a terminal session in this directory and perfom the following:
+Before proceeding it is necessary to make sure your Python environment is correctly configured. To do this open a terminal session in this directory and perform the following:
 
 
 ```shell

+ 3 - 3
language-bindings/python/wasm-c-api/docs/design.md

@@ -353,12 +353,12 @@ writable and needs to be copied into a ctype array.
 
 #### variable arguments
 
-A function with _variable arugments_ makes it hard to specify the required
+A function with _variable arguments_ makes it hard to specify the required
 argument types for the function prototype. It leaves us one way to call it
 directly without any arguments type checking.
 
 ```python
-libc.printf(b"Hello, an int %d, a float %f, a string %s\n", c_int(1), c_doulbe(3.14), "World!")
+libc.printf(b"Hello, an int %d, a float %f, a string %s\n", c_int(1), c_double(3.14), "World!")
 ```
 
 #### Use `c_bool` to represent `wasm_mutability_t `
@@ -373,7 +373,7 @@ libc.printf(b"Hello, an int %d, a float %f, a string %s\n", c_int(1), c_doulbe(3
 
 ### bindgen.py
 
-`bindge.py` is a tool to create WAMR python binding automatically. `binding.py`
+`bindgen.py` is a tool to create WAMR python binding automatically. `binding.py`
 is generated. We should avoid modification on it. Additional helpers should go
 to `ffi.py`.
 

+ 1 - 1
product-mini/platforms/linux-sgx/enclave-sample/App/pal_api.h

@@ -79,7 +79,7 @@ struct wamr_pal_create_process_args {
     // Untrusted environment variable array pass to new process.
     //
     // The untrusted env vars to the command. And the last element of the array
-    // must be NULL to indicate the length of array.
+    // must be NULL to indicate the end of the array.
     //
     // Optional field.
     const char **env;

+ 4 - 4
tests/unit/memory64/memory64_atomic_test.cc

@@ -60,7 +60,7 @@ class memory64_atomic_test_suite : public testing::TestWithParam<RunningMode>
         return false;
     }
 
-    void destory_exec_env()
+    void destroy_exec_env()
     {
         wasm_runtime_destroy_exec_env(exec_env);
         wasm_runtime_deinstantiate(module_inst);
@@ -109,7 +109,7 @@ class memory64_atomic_test_suite : public testing::TestWithParam<RunningMode>
     virtual void TearDown()
     {
         if (cleanup) {
-            destory_exec_env();
+            destroy_exec_env();
             wasm_runtime_destroy();
             cleanup = false;
         }
@@ -339,8 +339,8 @@ TEST_P(memory64_atomic_test_suite, atomic_opcodes_i64_rmw_cmpxchg)
     PUT_I64_TO_ADDR(wasm_argv + 2, 0x100F0E0D0C0B0A09);
     // new
     PUT_I64_TO_ADDR(wasm_argv + 4, 0xdeadcafebeefdead);
-    ASSERT_TRUE(wasm_runtime_call_wasm(exec_env, func_map["i64_atomic_rmw_cmpxchg"],
-                                       6, wasm_argv));
+    ASSERT_TRUE(wasm_runtime_call_wasm(
+        exec_env, func_map["i64_atomic_rmw_cmpxchg"], 6, wasm_argv));
     i64 = 0x100F0E0D0C0B0A09;
     ASSERT_EQ(i64, GET_U64_FROM_ADDR(wasm_argv));