]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix a few clang nitpicks (#2447)
authorGraham Percival <gperciva@tarsnap.com>
Tue, 24 Dec 2024 19:50:19 +0000 (11:50 -0800)
committerGitHub <noreply@github.com>
Tue, 24 Dec 2024 19:50:19 +0000 (11:50 -0800)
Fixes warnings found by:
```
-Wformat-non-iso
-Wnewline-eof
-Wmissing-variable-declarations
```

libarchive/archive_read_open_filename.c
libarchive/archive_write_open_filename.c
libarchive/test/test_7zip_filename_encoding.c
libarchive/test/test_acl_text.c
libarchive/test/test_read_format_gtar_sparse.c
libarchive/test/test_read_position.c

index 8def020fff389af782da15a8b85a3528f27a9149..05f0ffbd9413649c2d1622362d846f45f36e2e74 100644 (file)
@@ -303,7 +303,7 @@ file_open(struct archive *a, void *client_data)
                }
                if (fd < 0) {
                        archive_set_error(a, errno,
-                           "Failed to open '%S'", wfilename);
+                           "Failed to open '%ls'", wfilename);
                        return (ARCHIVE_FATAL);
                }
 #else
@@ -315,7 +315,7 @@ file_open(struct archive *a, void *client_data)
        if (fstat(fd, &st) != 0) {
 #if defined(_WIN32) && !defined(__CYGWIN__)
                if (mine->filename_type == FNT_WCS)
-                       archive_set_error(a, errno, "Can't stat '%S'",
+                       archive_set_error(a, errno, "Can't stat '%ls'",
                            wfilename);
                else
 #endif
@@ -447,7 +447,7 @@ file_read(struct archive *a, void *client_data, const void **buff)
                                    "Error reading '%s'", mine->filename.m);
                        else
                                archive_set_error(a, errno,
-                                   "Error reading '%S'", mine->filename.w);
+                                   "Error reading '%ls'", mine->filename.w);
                }
                return (bytes_read);
        }
@@ -509,7 +509,7 @@ file_skip_lseek(struct archive *a, void *client_data, int64_t request)
                archive_set_error(a, errno, "Error seeking in '%s'",
                    mine->filename.m);
        else
-               archive_set_error(a, errno, "Error seeking in '%S'",
+               archive_set_error(a, errno, "Error seeking in '%ls'",
                    mine->filename.w);
        return (-1);
 }
@@ -555,7 +555,7 @@ file_seek(struct archive *a, void *client_data, int64_t request, int whence)
                archive_set_error(a, errno, "Error seeking in '%s'",
                    mine->filename.m);
        else
-               archive_set_error(a, errno, "Error seeking in '%S'",
+               archive_set_error(a, errno, "Error seeking in '%ls'",
                    mine->filename.w);
        return (ARCHIVE_FATAL);
 }
index 6842b98d2f07c15a6b8c09bf062ccb9a830f8542..34209426558cf7b4207f58be2085086b1fab0355 100644 (file)
@@ -118,7 +118,7 @@ open_filename(struct archive *a, int mbs_fn, const void *filename)
                            (const char *)filename);
                else
                        archive_set_error(a, ARCHIVE_ERRNO_MISC,
-                           "Can't convert '%S' to MBS",
+                           "Can't convert '%ls' to MBS",
                            (const wchar_t *)filename);
                return (ARCHIVE_FAILED);
        }
@@ -170,7 +170,7 @@ file_open(struct archive *a, void *client_data)
                else {
                        archive_mstring_get_wcs(a, &mine->filename, &wcs);
                        archive_set_error(a, errno,
-                           "Can't convert '%S' to MBS", wcs);
+                           "Can't convert '%ls' to MBS", wcs);
                }
                return (ARCHIVE_FATAL);
        }
@@ -181,7 +181,7 @@ file_open(struct archive *a, void *client_data)
                if (mbs != NULL)
                        archive_set_error(a, errno, "Failed to open '%s'", mbs);
                else
-                       archive_set_error(a, errno, "Failed to open '%S'", wcs);
+                       archive_set_error(a, errno, "Failed to open '%ls'", wcs);
                return (ARCHIVE_FATAL);
        }
 
@@ -189,7 +189,7 @@ file_open(struct archive *a, void *client_data)
                if (mbs != NULL)
                        archive_set_error(a, errno, "Couldn't stat '%s'", mbs);
                else
-                       archive_set_error(a, errno, "Couldn't stat '%S'", wcs);
+                       archive_set_error(a, errno, "Couldn't stat '%ls'", wcs);
                return (ARCHIVE_FATAL);
        }
 
index cf562d39fda74c83d6d3e45402d56ebd965a5dd9..b423e0eccadf2832538adf704bfd49d0ae4f688f 100644 (file)
@@ -97,4 +97,4 @@ DEFINE_TEST(test_7zip_filename_encoding_UTF16_win)
 \r
        archive_read_free(a);\r
 #endif\r
-}
\ No newline at end of file
+}\r
index f0931adc8adcee61980d08c6fb353dd68a907226..c2904649a3ba4db7e0f3c485bbd8fc4c1c9065bc 100644 (file)
@@ -132,7 +132,7 @@ static struct archive_test_acl_t acls1[] = {
          ARCHIVE_ENTRY_ACL_EVERYONE, 0, "" },
 };
 
-const char* acltext[] = {
+static const char* acltext[] = {
        "user::rwx\n"
        "group::r-x\n"
        "other::r-x\n"
index 6a2e3650c5a824b97df8a6719c508865ab33e4ef..fdb4be31a17033b480aec3e98f848cf2b0052fbb 100644 (file)
@@ -30,13 +30,13 @@ struct contents {
        const char *d;
 };
 
-struct contents archive_contents_sparse[] = {
+static struct contents archive_contents_sparse[] = {
        { 1000000, 1, "a" },
        { 2000000, 1, "a" },
        { 3145728, 0, NULL }
 };
 
-struct contents archive_contents_sparse2[] = {
+static struct contents archive_contents_sparse2[] = {
        { 1000000, 1, "a" },
        { 2000000, 1, "a" },
        { 3000000, 1, "a" },
@@ -139,7 +139,7 @@ struct contents archive_contents_sparse2[] = {
        { 99000001, 0, NULL }
 };
 
-struct contents archive_contents_nonsparse[] = {
+static struct contents archive_contents_nonsparse[] = {
        { 0, 1, "a" },
        { 1, 0, NULL }
 };
@@ -159,7 +159,7 @@ struct contents archive_contents_nonsparse[] = {
  *   * contains a single byte 'a'
  */
 
-struct archive_contents {
+static struct archive_contents {
        const char *filename;
        struct contents *contents;
 } files[] = {
index e404c066e5168c3402009c30d1e177f93b3686ad..92a3c42db345fc71c50d1f1d47f2f86bcc975f54 100644 (file)
@@ -27,7 +27,7 @@
 static unsigned char nulls[1000];
 static unsigned char tmp[1000];
 static unsigned char  buff[10000];
-size_t data_sizes[] = {0, 5, 511, 512, 513};
+static size_t data_sizes[] = {0, 5, 511, 512, 513};
 
 static void verify_read_positions(struct archive *a);