]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue 176: Const-ify several static arrays.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 1 Sep 2011 08:25:09 +0000 (04:25 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 1 Sep 2011 08:25:09 +0000 (04:25 -0400)
SVN-Revision: 3666

cpio/test/test_owner_parse.c
libarchive/archive_read_support_format_cab.c
libarchive/archive_read_support_format_lha.c
libarchive/archive_string.c
libarchive/archive_write_add_filter_compress.c
libarchive/test/main.c

index 8f9343ab9cb59f348deb09d4afd93eebd9088551..a9f605398e362fc1cd4066e8875a04429c2bf191 100644 (file)
@@ -30,8 +30,8 @@ __FBSDID("$FreeBSD$");
 
 #if !defined(_WIN32)
 #define ROOT "root"
-static int root_uids[] = { 0 };
-static int root_gids[] = { 0, 1 };
+static const int root_uids[] = { 0 };
+static const int root_gids[] = { 0, 1 };
 #elif defined(__CYGWIN__)
 /* On cygwin, the Administrator user most likely exists (unless
  * it has been renamed or is in a non-English localization), but
@@ -42,13 +42,13 @@ static int root_gids[] = { 0, 1 };
  *       Use CreateWellKnownSID() and LookupAccountName()?
  */
 #define ROOT "Administrator"
-static int root_uids[] = { 500 };
-static int root_gids[] = { 513, 545, 544 };
+static const int root_uids[] = { 500 };
+static const int root_gids[] = { 513, 545, 544 };
 #endif
 
 #if defined(ROOT)
 static int
-int_in_list(int i, int *l, size_t n)
+int_in_list(int i, const int *l, size_t n)
 {
        while (n-- > 0)
                if (*l++ == i)
index 67bc71275143950323738b224d4bc26246fecc9e..715dd04776cb0561113e3e393df18d884482088c 100644 (file)
@@ -138,7 +138,7 @@ struct lzx_dec {
        int                      error;
 };
 
-static int slots[] = {
+static const int slots[] = {
        30, 32, 34, 36, 38, 42, 50, 66, 98, 162, 290
 };
 #define SLOT_BASE      15
@@ -190,7 +190,7 @@ struct lzx_stream {
 #define CFDATA_cbData          4
 #define CFDATA_cbUncomp                6
 
-static char *compression_name[] = {
+static const char *compression_name[] = {
        "NONE",
        "MSZIP",
        "Quantum",
index 400b8e22f78e097b72f2fa69cd164c991d61b5c0..3dc87c5854cab0bd7902a12e3acdb3211d71d641 100644 (file)
@@ -1209,7 +1209,7 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
                        if (datasize >= 2) {
                                lha->header_crc = archive_le16dec(extdheader);
                                if (crc != NULL) {
-                                       static char zeros[2] = {0, 0};
+                                       static const char zeros[2] = {0, 0};
                                        *crc = lha_crc16(*crc, h,
                                            extdsize - datasize);
                                        /* CRC value itself as zero */
index 44196f4c2d6b4d0f2eff5b6736ab3ee72d970e22..4c1828c118b864e065d58dd9c48714872139297e 100644 (file)
@@ -2326,7 +2326,7 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p,
 static int
 _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
 {
-       static char utf8_count[256] = {
+       static const char utf8_count[256] = {
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */
index 32b0658283d6aba5b9549117a3427c6b087ef1bf..465ff0e77bd19cfd49bc787b67e118b1a8ab8039 100644 (file)
@@ -215,7 +215,7 @@ archive_compressor_compress_open(struct archive_write_filter *f)
  * code in turn.  When the buffer fills up empty it and start over.
  */
 
-static unsigned char rmask[9] =
+static const unsigned char rmask[9] =
        {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
 
 static int
index 6fa54ded7eae63fe13e61e8cdf5cdf8b5b2ce552..81abe3e5fe01660101677fc35ae31b0cf7d5d304 100644 (file)
@@ -441,7 +441,7 @@ assertion_equal_int(const char *file, int line,
 static int
 _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
 {
-       static char utf8_count[256] = {
+       static const char utf8_count[256] = {
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */