未验证 提交 d8af6583 编写于 作者: O openharmony_ci 提交者: Gitee

!1379 修复目标系统为64位时 printf size_t 格式编译报错问题

Merge pull request !1379 from TagoreWu/master
...@@ -100,7 +100,7 @@ static void HandleParamChange2(const char *key, const char *value, void *context ...@@ -100,7 +100,7 @@ static void HandleParamChange2(const char *key, const char *value, void *context
index = 5; // 5 add context index = 5; // 5 add context
ret = SystemWatchParameter(key, HandleParamChange2, (void *)index); ret = SystemWatchParameter(key, HandleParamChange2, (void *)index);
if (ret != 0) { if (ret != 0) {
printf("Add watcher %s fail %d \n", key, index); printf("Add watcher %s fail %zu \n", key, index);
} }
addWatcher = 1; addWatcher = 1;
return; return;
...@@ -109,21 +109,21 @@ static void HandleParamChange2(const char *key, const char *value, void *context ...@@ -109,21 +109,21 @@ static void HandleParamChange2(const char *key, const char *value, void *context
index = 3; // 3 delete context index = 3; // 3 delete context
RemoveParameterWatcher(key, HandleParamChange2, (void *)index); RemoveParameterWatcher(key, HandleParamChange2, (void *)index);
if (ret != 0) { if (ret != 0) {
printf("Remove watcher fail %d \n", index); printf("Remove watcher fail %zu \n", index);
} }
return; return;
} }
if (index == 1) { // 1 when context == 1 delete 1 if (index == 1) { // 1 when context == 1 delete 1
RemoveParameterWatcher(key, HandleParamChange2, (void *)index); RemoveParameterWatcher(key, HandleParamChange2, (void *)index);
if (ret != 0) { if (ret != 0) {
printf("Remove watcher fail %d \n", index); printf("Remove watcher fail %zu \n", index);
} }
return; return;
} }
if ((index == 5) && (addWatcher == 1)) { // 5 when context == 5 delete 5 if ((index == 5) && (addWatcher == 1)) { // 5 when context == 5 delete 5
RemoveParameterWatcher(key, HandleParamChange2, (void *)index); RemoveParameterWatcher(key, HandleParamChange2, (void *)index);
if (ret != 0) { if (ret != 0) {
printf("Remove watcher fail %d \n", index); printf("Remove watcher fail %zu \n", index);
} }
addWatcher = 0; addWatcher = 0;
} }
...@@ -143,18 +143,18 @@ static void *CmdThreadWatcher(void *args) ...@@ -143,18 +143,18 @@ static void *CmdThreadWatcher(void *args)
for (size_t i = 1; i <= MAX_NUMBER; i++) { for (size_t i = 1; i <= MAX_NUMBER; i++) {
int ret = SystemWatchParameter(context->name, HandleParamChange2, (void *)i); int ret = SystemWatchParameter(context->name, HandleParamChange2, (void *)i);
if (ret != 0) { if (ret != 0) {
printf("Add watcher %s fail %d \n", context->name, i); printf("Add watcher %s fail %zu \n", context->name, i);
} }
ret = SetParameter(context->name, context->name); ret = SetParameter(context->name, context->name);
if (ret != 0) { if (ret != 0) {
printf("Set parameter %s fail %d \n", context->name, i); printf("Set parameter %s fail %zu \n", context->name, i);
} }
} }
sleep(1); sleep(1);
for (size_t i = 1; i <= MAX_NUMBER; i++) { for (size_t i = 1; i <= MAX_NUMBER; i++) {
int ret = RemoveParameterWatcher(context->name, HandleParamChange2, (void *)i); int ret = RemoveParameterWatcher(context->name, HandleParamChange2, (void *)i);
if (ret != 0) { if (ret != 0) {
printf("Remove watcher %s fail %d \n", context->name, i); printf("Remove watcher %s fail %zu \n", context->name, i);
} }
} }
free(context); free(context);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册