upgrade-apply-deltafs: Fix build warning 76/285276/4
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 4 Jan 2023 11:03:09 +0000 (20:03 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 4 Jan 2023 11:03:09 +0000 (20:03 +0900)
There are some warning message.
To clean codes, fix the build warning.

Change-Id: I0c7f79e12636dd4d8724ac169248448e0ff99cd0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
src/upgrade-apply-deltafs/engine/SS_Common.c
src/upgrade-apply-deltafs/engine/SS_Common.h
src/upgrade-apply-deltafs/engine/SS_PatchDelta.c
src/upgrade-apply-deltafs/engine/SS_UPI.c
src/upgrade-apply-deltafs/ua.c
src/upgrade-apply/main.c
src/upgrade-apply/patch/patch.c
src/upgrade-apply/sha1/sha1.c
src/upgrade-apply/sha1/sha1.h

index 605481e..90a11f2 100755 (executable)
@@ -34,9 +34,9 @@
 #include "fota_common.h"
 #include "sha1.h"
 
-void hex_digest(char * sha1, char *buffer, int size)
+void hex_digest(unsigned char *sha1, unsigned char *buffer, int size)
 {
        for (int i = 0; i < size; i++) {
-               snprintf(&buffer[i * 2], (size * 2) - (i * 2) + 1, "%02x", sha1[i]);
+               snprintf((char *)&buffer[i * 2], (size * 2) - (i * 2) + 1, "%02x", sha1[i]);
        }
 }
index 20aae77..288dea0 100755 (executable)
@@ -35,4 +35,4 @@ typedef enum {
 
 void SS_unicode_to_char(const char *src, char *dest, int size);
 
-void hex_digest(char * sha1, char *buffer, int size);
+void hex_digest(unsigned char *sha1, unsigned char *buffer, int size);
index b2801a3..57f5d28 100755 (executable)
@@ -217,8 +217,6 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
                // source_filename, (long)patch_data_size, (long)free_space, enough_space);
                //LOGL(LOG_SSENGINE,"Generate Target Space availabitiy [%d]\n", enough_space);
 
-               SinkFn sink = NULL;
-               void *token = NULL;
                output = -1;
                outname = NULL;
 
@@ -251,8 +249,6 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
                                        }
                                }
                        }
-                       sink = ss_fileSink;
-                       token = &output;
                }
                result = apply_patch_brotli((char *)source_filename, outname, tar_file, -1);
                if (output >= 0) {
@@ -283,7 +279,7 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
                LOGE("cannot open %s to verify SHA1\n", outname);
                return E_SS_FAILURE;
        }
-       char buff[4096];
+       unsigned char buff[4096];
        for (;;) {
                int res = read(fd, buff, 4096);
                if (res == -1) {
index b001407..a2b6829 100755 (executable)
@@ -1796,6 +1796,8 @@ int brotli_close(__attribute__((unused)) int fd)
                free(brotli_file);
                brotli_file = NULL;
        }
+
+       return 0;
 }
 
 ssize_t brotli_write(__attribute__((unused)) int fd,
index 763a40f..e579224 100755 (executable)
@@ -62,7 +62,9 @@ static char fota_cause[MAX_FILE_PATH];
 static char delta_folder[MAX_FOLDER_PATH];
 static char delta_path[MAX_FILE_PATH];
 static char result_folder[MAX_FOLDER_PATH];
+#ifndef DEBUG_STDOUT
 static char log_path[MAX_FILE_PATH];
+#endif
 static char mnt_point[MAX_FILE_PATH];
 
 static ua_part_info_t s_part_info;
index 8799520..26a1337 100644 (file)
@@ -49,7 +49,6 @@ void tar_cleanup(TAR **tar)
 enum archive_kind {
        KIND_RAW,
        KIND_BROTLI_PATCH,
-       KIND_LZMA_PATCH
 };
 
 struct parse_result {
@@ -176,7 +175,7 @@ struct parse_result parse_args(int argc, char **argv)
        if (kind == -1)
                return (struct parse_result) { .result = PARSE_MISSING_ARGUMENT };
 
-       if (patch_orig == NULL && (kind == KIND_BROTLI_PATCH || kind == KIND_LZMA_PATCH))
+       if (patch_orig == NULL && kind == KIND_BROTLI_PATCH)
                return (struct parse_result) { .result = PARSE_PATCH_MISTAKE };
        if (patch_orig != NULL && kind == KIND_RAW)
                return (struct parse_result) { .result = PARSE_PATCH_MISTAKE };
index 43f609d..40697ad 100644 (file)
@@ -321,7 +321,7 @@ int read_header(struct dec_funcs *funcs, struct bs_data *data, uint8_t **buff_ou
             return PF_ERROR_OPEN_FILE;
         }
     } else if (target_size != data->dest.len) {
-        fprintf(stderr, "Declared target size differs from that read from the patch (%ld [patch] != %ld [declared])\n", target_size, data->dest.len);
+        fprintf(stderr, "Declared target size differs from that read from the patch (%zu [patch] != %zu [declared])\n", target_size, data->dest.len);
         return PF_ERROR_INVALID_PATCH_FILE;
     }
 
index fe8da83..f126474 100644 (file)
@@ -280,8 +280,8 @@ void SHA1Final(
 }
 
 void SHA1(
-    char *hash_out,
-    const char *str,
+    unsigned char *hash_out,
+    const unsigned char *str,
     int len)
 {
     SHA1_CTX ctx;
index 96bb008..678ac3b 100644 (file)
@@ -37,8 +37,8 @@ void SHA1Final(
     );
 
 void SHA1(
-    char *hash_out,
-    const char *str,
+    unsigned char *hash_out,
+    const unsigned char *str,
     int len);
 
 #endif /* SHA1_H */