From 096a6bb0289d4c7a5270da817bfa9889878cdedc Mon Sep 17 00:00:00 2001 From: fenghaolin Date: Sat, 26 Jun 2021 11:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8B=B1=E6=96=87=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fenghaolin --- en/application-dev/js-reference/app-js.md | 2 +- en/contribute/OpenHarmony-Java-secure-coding-guide.md | 4 ++-- en/contribute/OpenHarmony-JavaScript-coding-style-guide.md | 2 +- en/contribute/OpenHarmony-c-coding-style-guide.md | 2 +- en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md | 6 +++--- en/contribute/OpenHarmony-cpp-coding-style-guide.md | 2 +- en/device-dev/driver/driver-service-management.md | 2 +- en/device-dev/driver/watchdogusage-example.md | 4 ++-- en/device-dev/guide/faqs.md | 2 +- en/readme/liteipc_driver.md | 2 +- zh-cn/application-dev/js-reference/app-js.md | 2 +- .../js-reference/\345\215\207\347\272\247.md" | 6 +++--- zh-cn/contribute/OpenHarmony-Java-secure-coding-guide.md | 4 ++-- .../contribute/OpenHarmony-JavaScript-coding-style-guide.md | 2 +- ...\227\344\275\277\347\224\250\345\256\236\344\276\213.md" | 4 ++-- .../\345\270\270\350\247\201\351\227\256\351\242\230.md" | 2 +- ...\272\344\275\277\347\224\250\346\214\207\345\257\274.md" | 2 +- ...\207\344\273\266\345\255\220\347\263\273\347\273\237.md" | 2 +- zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md | 2 +- 19 files changed, 27 insertions(+), 27 deletions(-) diff --git a/en/application-dev/js-reference/app-js.md b/en/application-dev/js-reference/app-js.md index aaf73378ace..11600f86a74 100755 --- a/en/application-dev/js-reference/app-js.md +++ b/en/application-dev/js-reference/app-js.md @@ -3,7 +3,7 @@ You can implement lifecycle logic specific to your application in the **app.js** file. Available application lifecycle functions are as follows: - **onCreate\(\)**: called when an application is created -- **onDestory\(\)**: called when an application is destroyed +- **onDestroy\(\)**: called when an application is destroyed In the following example, logs are printed only in the lifecycle functions . diff --git a/en/contribute/OpenHarmony-Java-secure-coding-guide.md b/en/contribute/OpenHarmony-Java-secure-coding-guide.md index 79a5726cc11..c9f95c18e08 100644 --- a/en/contribute/OpenHarmony-Java-secure-coding-guide.md +++ b/en/contribute/OpenHarmony-Java-secure-coding-guide.md @@ -507,7 +507,7 @@ public void unzip(FileInputStream zipFileInputStream, String dir) throws IOExcep entryFile = new File(entryFilePath); if (entry.isDirectory()) { - creatDir(entryFile); + createDir(entryFile); continue; } @@ -536,7 +536,7 @@ private String sanitizeFileName(String fileName, String dir) throws IOException throw new IOException("Path Traversal vulnerability: ..."); } -private void creatDir(File dirPath) throws IOException { +private void createDir(File dirPath) throws IOException { boolean result = dirPath.mkdirs(); if (!result) { throw new IOException("Create dir failed, path is : " + dirPath.getPath()); diff --git a/en/contribute/OpenHarmony-JavaScript-coding-style-guide.md b/en/contribute/OpenHarmony-JavaScript-coding-style-guide.md index 2bc5234ca6a..39d6945ec21 100755 --- a/en/contribute/OpenHarmony-JavaScript-coding-style-guide.md +++ b/en/contribute/OpenHarmony-JavaScript-coding-style-guide.md @@ -329,7 +329,7 @@ console.log(`${username}'s birthday is ${birthday}`); **Example:** ```javascript -let message = 'wolrd'; +let message = 'world'; console.log(message); ``` diff --git a/en/contribute/OpenHarmony-c-coding-style-guide.md b/en/contribute/OpenHarmony-c-coding-style-guide.md index 62313191942..781b0a169b7 100755 --- a/en/contribute/OpenHarmony-c-coding-style-guide.md +++ b/en/contribute/OpenHarmony-c-coding-style-guide.md @@ -1966,7 +1966,7 @@ The value is limited by the name, for example, `#define XX_TIMER_INTERVAL_300MS ### Rec 8.1 When comparing expressions, follow the principle that the left side tends to change and the right side tends to remain unchanged. -When a variable is compared with a constant, placing the constant on the left, for example, `if (MAX == v)` does not read naturally, and `if (MAX > v)` is more difficult to understand. +When a variable is compared with a constant, placing the constant on the left, for example, `if (MAX == v)` does not read naturally, and `if (MAX > v)` is more difficult to understand. The constant should be placed on the right according to the normal reading order and habit. The expression is written as follows: ```c diff --git a/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md b/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md index 621953b338c..31114039d57 100644 --- a/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md +++ b/en/contribute/OpenHarmony-c-cpp-secure-coding-guide.md @@ -36,8 +36,8 @@ Input validation includes but is not limited to: **External Data Validation Principles 1. Trust boundary** - External data is untrusted. Therefore, if data is transmitted and processed across different trust boundaries during system operation, validity check must be performed on data from modules outside the trust boundaries to prevent attacks from spreading. (a) Different so (or dll) modules - As an independent third-party module, the so or dll module is used to export common API functions for other modules to call. The so/dll module is unable to determine whether the caller passes on valid arguments. Therefore, the common function of the so/dll module needs to check the validity of the arguments provided by the caller. The so/dll module should be designed in low coupling and high reusability. Although the so/dll module is designed to be used only in this software in certain cases, different so/dll modules should still be regarded as different trust boundaries. (b) Different processes + External data is untrusted. Therefore, if data is transmitted and processed across different trust boundaries during system operation, validity check must be performed on data from modules outside the trust boundaries to prevent attacks from spreading. (a) Different so (or dll) modules + As an independent third-party module, the so or dll module is used to export common API functions for other modules to call. The so/dll module is unable to determine whether the caller passes on valid arguments. Therefore, the common function of the so/dll module needs to check the validity of the arguments provided by the caller. The so/dll module should be designed in low coupling and high reusability. Although the so/dll module is designed to be used only in this software in certain cases, different so/dll modules should still be regarded as different trust boundaries. (b) Different processes To prevent privilege escalation through processes with high permissions, the IPC communications between processes (including IPC communications between boards and network communications between hosts) should be regarded as communications across different trust boundaries. (c) Application layer processes and operating system kernel The operating system kernel has higher permissions than the application layer. The interface provided by the kernel for the application layer should process the data from the application layer as untrusted data. (d) Internal and external environments of TEE To prevent attacks from spreading to the TEE, the interfaces provided by the TEE and SGX for external systems should process external data as untrusted data. @@ -2072,7 +2072,7 @@ memset(buffer, 0, SIZE); // Use the requested buffer size. ## Do not directly use external data to concatenate SQL statements **\[Description]** -An SQL injection vulnerability arises when an SQL query is dynamically altered to form an altogether different query. Execution of this altered query may result in information leaks or data tampering. The root cause of SQL injection is the use of external data to concatenate SQL statements. In C/C++, external data is used to concatenate SQL statements in the following scenarios (but not limited to): +An SQL injection vulnerability arises when an SQL query is dynamically altered to form an altogether different query. Execution of this altered query may result in information leaks or data tampering. The root cause of SQL injection is the use of external data to concatenate SQL statements. In C/C++, external data is used to concatenate SQL statements in the following scenarios (but not limited to): - Argument for calling **mysql\_query()** and **Execute()** when connecting to MySQL - Argument for calling **dbsqlexec()** of the db-library driver when connecting to the SQL server diff --git a/en/contribute/OpenHarmony-cpp-coding-style-guide.md b/en/contribute/OpenHarmony-cpp-coding-style-guide.md index 8a7ecbad0ca..9471318f4b2 100755 --- a/en/contribute/OpenHarmony-cpp-coding-style-guide.md +++ b/en/contribute/OpenHarmony-cpp-coding-style-guide.md @@ -2321,7 +2321,7 @@ The default constructor, destructor, `swap` function, and `move` operator should Template programming allows for extremely flexible interfaces that are type safe and high performance, enabling reuse of code of different types but with the same behavior. -The disadvantages of template proramming are as follows: +The disadvantages of template programming are as follows: 1. The techniques used in template programming are often obscure to anyone but language experts. Code that uses templates in complicated ways is often unreadable, and is hard to debug or maintain. 2. Template programming often leads to extremely poor compiler time error messages: even if an interface is simple, complicated implementation details become visible when the user does something wrong. diff --git a/en/device-dev/driver/driver-service-management.md b/en/device-dev/driver/driver-service-management.md index 961fceb1181..833d233b672 100644 --- a/en/device-dev/driver/driver-service-management.md +++ b/en/device-dev/driver/driver-service-management.md @@ -128,7 +128,7 @@ The development of driver service management includes compiling, binding, obtain - Using the subscription mechanism - If the kernel sapce unaware of the time for loading drivers \(on the same host\), use the subscription mechanism provided by the HDF to subscribe to the drivers. After the drivers are loaded, the HDF releases the driver services to you. The implementation is as follows: + If the kernel space unaware of the time for loading drivers \(on the same host\), use the subscription mechanism provided by the HDF to subscribe to the drivers. After the drivers are loaded, the HDF releases the driver services to you. The implementation is as follows: ``` // Subscription callback function. After the subscribed drivers are loaded, the HDF releases the driver services to you using this function. diff --git a/en/device-dev/driver/watchdogusage-example.md b/en/device-dev/driver/watchdogusage-example.md index 98f6acfa0e3..43943a038ad 100644 --- a/en/device-dev/driver/watchdogusage-example.md +++ b/en/device-dev/driver/watchdogusage-example.md @@ -52,7 +52,7 @@ static int32_t TestCaseWatchdog(void) /* Start the watchdog. The timer starts. */ ret = WatchdogStart(handle); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); + HDF_LOGE("%s: start fail! ret:%d\n", __func__, ret); WatchdogClose(handle); return ret; } @@ -73,7 +73,7 @@ static int32_t TestCaseWatchdog(void) /* Enable the timer to expire by stopping feeding the watchdog. */ for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); + HDF_LOGE("%s: waiting dog buck %d times... \n", __func__, i); OsalSleep(1); } diff --git a/en/device-dev/guide/faqs.md b/en/device-dev/guide/faqs.md index 1a8fa2eae8d..14afd9f8ecc 100644 --- a/en/device-dev/guide/faqs.md +++ b/en/device-dev/guide/faqs.md @@ -12,7 +12,7 @@
. - +
/* index.js */ diff --git a/en/readme/liteipc_driver.md b/en/readme/liteipc_driver.md index c2afc7b4f63..efc5d255dbd 100644 --- a/en/readme/liteipc_driver.md +++ b/en/readme/liteipc_driver.md @@ -56,7 +56,7 @@ IpcContent - The **SEND** flag indicates a request to send outMsg. Returns with error **EINVAL** if any member of the message has been given an invalid value. - Sending a message with type **MT_REQUEST** returns with error **EACCES** if the task doesn't have access rights to the recipient, and **EINVAL** for an invalid recipient. All tasks have access rights to the CMS (see IPC_SET_CMS), and to their own process' IPC services. - - Sending a message with type **MT_REPLY** or **MT_FAILED_REPLY** returns with error **EINVAL** if any of the following are not satisifed: + - Sending a message with type **MT_REPLY** or **MT_FAILED_REPLY** returns with error **EINVAL** if any of the following are not satisfied: - buffToFree must point at the message being replied to and the **BUFF_FREE** flag must be set. - The outMsg recipient (target.handle) must match the buffToFree sender (taskID). - The outMsg and buffToFree timestamps must match. diff --git a/zh-cn/application-dev/js-reference/app-js.md b/zh-cn/application-dev/js-reference/app-js.md index b9354823eab..73c29c9c246 100755 --- a/zh-cn/application-dev/js-reference/app-js.md +++ b/zh-cn/application-dev/js-reference/app-js.md @@ -3,7 +3,7 @@ 每个应用可以在app.js自定义应用级生命周期的实现逻辑,包括: - onCreate:在应用生成时被调用的生命周期函数。 -- onDestory:在应用销毁时被调用的生命周期函数。 +- onDestroy:在应用销毁时被调用的生命周期函数。 以下示例仅在生命周期函数中打印对应日志: diff --git "a/zh-cn/application-dev/js-reference/\345\215\207\347\272\247.md" "b/zh-cn/application-dev/js-reference/\345\215\207\347\272\247.md" index 6dfc0396682..63dafac299e 100644 --- "a/zh-cn/application-dev/js-reference/\345\215\207\347\272\247.md" +++ "b/zh-cn/application-dev/js-reference/\345\215\207\347\272\247.md" @@ -73,7 +73,7 @@ import client from 'libupdateclient.z.so' ``` updater.getNewVersionInfo(info => { -console.log("getNewVersionInfo sucess " + info.status); +console.log("getNewVersionInfo success " + info.status); console.log(`info versionName = ` + info.result[0].versionName); console.log(`info versionCode = ` + info.result[0].versionCode); console.log(`info verifyInfo = ` + info.result[0].verifyInfo); @@ -134,7 +134,7 @@ console.log(`info verifyInfo = ` + info.result[0].verifyInfo); ``` updater.checkNewVersion(info => { -console.log("checkNewVersion sucess " + info.status); +console.log("checkNewVersion success " + info.status); console.log(`info versionName = ` + info.result[0].versionName); console.log(`info versionCode = ` + info.result[0].versionCode); console.log(`info verifyInfo = ` + info.result[0].verifyInfo); @@ -316,7 +316,7 @@ console.log("setUpdatePolicy ", result) ``` updater.getUpdatePolicy(policy => { -console.log("getUpdatePolicy sucess", policy) +console.log("getUpdatePolicy success", policy) }); ``` diff --git a/zh-cn/contribute/OpenHarmony-Java-secure-coding-guide.md b/zh-cn/contribute/OpenHarmony-Java-secure-coding-guide.md index f5aa6246492..11c240029ab 100644 --- a/zh-cn/contribute/OpenHarmony-Java-secure-coding-guide.md +++ b/zh-cn/contribute/OpenHarmony-Java-secure-coding-guide.md @@ -507,7 +507,7 @@ public void unzip(FileInputStream zipFileInputStream, String dir) throws IOExcep entryFile = new File(entryFilePath); if (entry.isDirectory()) { - creatDir(entryFile); + createDir(entryFile); continue; } @@ -536,7 +536,7 @@ private String sanitizeFileName(String fileName, String dir) throws IOException throw new IOException("Path Traversal vulnerability: ..."); } -private void creatDir(File dirPath) throws IOException { +private void createDir(File dirPath) throws IOException { boolean result = dirPath.mkdirs(); if (!result) { throw new IOException("Create dir failed, path is : " + dirPath.getPath()); diff --git a/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md b/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md index 74dffa62081..51f6af5f189 100755 --- a/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md +++ b/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md @@ -330,7 +330,7 @@ console.log(`${username}'s birthday is ${birthday}`); **正例:** ```javascript -let message = 'wolrd'; +let message = 'world'; console.log(message); ``` diff --git "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" index b8d64e53b75..a723e3739bc 100755 --- "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ "b/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" @@ -52,7 +52,7 @@ static int32_t TestCaseWatchdog(void) /* 启动看门狗,开始计时 */ ret = WatchdogStart(handle); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); + HDF_LOGE("%s: start fail! ret:%d\n", __func__, ret); WatchdogClose(handle); return ret; } @@ -73,7 +73,7 @@ static int32_t TestCaseWatchdog(void) /* 接下来持续不喂狗,使得看门狗计时器超时 */ for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); + HDF_LOGE("%s: waiting dog buck %d times... \n", __func__, i); OsalSleep(1); } diff --git "a/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" index e595cc85c3a..56d892fc1d9 100755 --- "a/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ "b/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" @@ -12,7 +12,7 @@
- +
/* index.js */ diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" index 8d5f2768177..2d690e7594c 100755 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" @@ -154,7 +154,7 @@ hb是OpenHarmony的命令行工具,用来执行编译命令。以下对hb的 3. 将组件配置到产品。 - 产品的配置文件config.json位于位于vendor/company/product/下,产品配置文件需包含产品名称、OpenHarmony版本号、device厂商、开发板、内核类型、内核版本号,以及配置的子系统和组件。以将hello\_world组件加入产品配置文件my\_product.json中为例,加入hello\_wolrd对象: + 产品的配置文件config.json位于位于vendor/company/product/下,产品配置文件需包含产品名称、OpenHarmony版本号、device厂商、开发板、内核类型、内核版本号,以及配置的子系统和组件。以将hello\_world组件加入产品配置文件my\_product.json中为例,加入hello\_world对象: ``` { diff --git "a/zh-cn/readme/\345\210\206\345\270\203\345\274\217\346\226\207\344\273\266\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\346\226\207\344\273\266\345\255\220\347\263\273\347\273\237.md" index 1ae22c7b5e1..c93e750534b 100644 --- "a/zh-cn/readme/\345\210\206\345\270\203\345\274\217\346\226\207\344\273\266\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\346\226\207\344\273\266\345\255\220\347\263\273\347\273\237.md" @@ -182,7 +182,7 @@ foundation/distributeddatamgr/distributedfile - 异步编程模型:Promise - @OHOS.distributedfile.fileio 模块中,名称不含 Sync 的接口,在不提供最后一个函数型参数 callback 的时候,即实现为 Promsie 异步模型。Promise 异步模型是 OHOS 标准异步模型之一。用户在调用这些接口的时候,接口实现将异步执行任务,同时返回一个 promise 对象,其代表异步操作的结果。在返回的结果的个数超过一个时,其以对象属性的形式返回。 + @OHOS.distributedfile.fileio 模块中,名称不含 Sync 的接口,在不提供最后一个函数型参数 callback 的时候,即实现为 Promise 异步模型。Promise 异步模型是 OHOS 标准异步模型之一。用户在调用这些接口的时候,接口实现将异步执行任务,同时返回一个 promise 对象,其代表异步操作的结果。在返回的结果的个数超过一个时,其以对象属性的形式返回。 下例通过 Promise 链依次完成:以只读方式打开文件流、尝试读取文件前 4096 个字节、显示读取内容的长度,最后关闭文件。 diff --git a/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md b/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md index 539767d0970..c74ba1be8e5 100755 --- a/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md @@ -1154,7 +1154,7 @@ repo sync -c

I3D71U

-

【驱动】反复reset,启动到hmac_main_init SUCCESSULLY后,高概率出现系统挂死问题

+

【驱动】反复reset,启动到hmac_main_init SUCCESSFULLY后,高概率出现系统挂死问题

I3EGUX

-- Gitee