summaryrefslogtreecommitdiff
path: root/0097-code-improve.patch
blob: cb8d41dcbdbd644991543c0420ed17dfb1cb45c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From 2aa26649f20ae5992ace7bb8cb62a5ee9c3f7a81 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Thu, 30 May 2024 21:30:43 +1400
Subject: [PATCH 097/108] code improve

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 src/cmd/isula/volume/prune.c                             | 2 +-
 src/cmd/options/opt_log.c                                | 2 +-
 src/daemon/executor/container_cb/execution_extend.c      | 3 ++-
 src/daemon/executor/container_cb/execution_information.c | 2 +-
 src/daemon/modules/image/oci/registry_type.c             | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/cmd/isula/volume/prune.c b/src/cmd/isula/volume/prune.c
index c8d632ed..3b5bfbf1 100644
--- a/src/cmd/isula/volume/prune.c
+++ b/src/cmd/isula/volume/prune.c
@@ -79,7 +79,7 @@ out:
 
 int cmd_volume_prune_main(int argc, const char **argv)
 {
-    int i = 0;
+    size_t i = 0;
     struct isula_libutils_log_config lconf = { 0 };
     int exit_code = 1;
     command_t cmd;
diff --git a/src/cmd/options/opt_log.c b/src/cmd/options/opt_log.c
index b1abcfaf..8ffb9966 100644
--- a/src/cmd/options/opt_log.c
+++ b/src/cmd/options/opt_log.c
@@ -67,7 +67,7 @@ static int log_opt_syslog_facility(const char *key, const char *value, char **pa
                                       "authpriv", "ftp",    "local0", "local1", "local2",
                                       "local3",   "local4", "local5", "local6", "local7"
                                     };
-    int i;
+    size_t i;
     size_t f_len = sizeof(facility_values) / sizeof(const char *);
 
     for (i = 0; i < f_len; i++) {
diff --git a/src/daemon/executor/container_cb/execution_extend.c b/src/daemon/executor/container_cb/execution_extend.c
index 52401633..ed072848 100644
--- a/src/daemon/executor/container_cb/execution_extend.c
+++ b/src/daemon/executor/container_cb/execution_extend.c
@@ -990,7 +990,8 @@ out:
 
 static int update_container_unified(const char *id, const host_config *hostconfig, host_config *chostconfig)
 {
-    int i, cgroup_version;
+    int cgroup_version;
+    size_t i;
 
     if (hostconfig->unified == NULL || hostconfig->unified->len == 0) {
         return 0;
diff --git a/src/daemon/executor/container_cb/execution_information.c b/src/daemon/executor/container_cb/execution_information.c
index 58924257..4aee3aef 100644
--- a/src/daemon/executor/container_cb/execution_information.c
+++ b/src/daemon/executor/container_cb/execution_information.c
@@ -244,7 +244,7 @@ static int get_proxy_env(char **proxy, const char *type)
     }
     *col_pos = '\0';
     nret = snprintf(*proxy, proxy_len, "%s:%s%s", tmp_proxy, mask_str, at_pos);
-    if (nret < 0 || nret >= proxy_len) {
+    if (nret < 0 || (size_t)nret >= proxy_len) {
         ret = -1;
         free(*proxy);
         *proxy = NULL;
diff --git a/src/daemon/modules/image/oci/registry_type.c b/src/daemon/modules/image/oci/registry_type.c
index 6c9ff747..7a2c25ed 100644
--- a/src/daemon/modules/image/oci/registry_type.c
+++ b/src/daemon/modules/image/oci/registry_type.c
@@ -59,7 +59,7 @@ void free_layer_blob(layer_blob *layer)
 
 void free_pull_desc(pull_descriptor *desc)
 {
-    int i = 0;
+    size_t i = 0;
 
     if (desc == NULL) {
         return;
-- 
2.25.1