[FFmpeg-cvslog] testprogs: Mark some tables as static const

Diego Biurrun git at videolan.org
Tue Jun 21 13:01:16 CEST 2016


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Thu Apr  7 18:52:10 2016 +0200| [f2422b58756ba97e3cbadc190f1ed950aa201ec7] | committer: Diego Biurrun

testprogs: Mark some tables as static const

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2422b58756ba97e3cbadc190f1ed950aa201ec7
---

 libavutil/aes-test.c      |    8 ++++----
 libavutil/avstring-test.c |    2 +-
 libavutil/crc-test.c      |    2 +-
 libavutil/hmac-test.c     |   16 ++++++++--------
 libavutil/opt-test.c      |    2 +-
 libavutil/sha-test.c      |    2 +-
 libavutil/xtea-test.c     |    2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavutil/aes-test.c b/libavutil/aes-test.c
index 92404e4..afb5ad3 100644
--- a/libavutil/aes-test.c
+++ b/libavutil/aes-test.c
@@ -27,23 +27,23 @@ int main(int argc, char **argv)
 {
     int i, j;
     AVAES b;
-    uint8_t rkey[2][16] = {
+    static const uint8_t rkey[2][16] = {
         { 0 },
         { 0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3,
           0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59 }
     };
-    uint8_t pt[16], rpt[2][16] = {
+    static const uint8_t rpt[2][16] = {
         { 0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad,
           0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3 },
         { 0 }
     };
-    uint8_t rct[2][16] = {
+    static const uint8_t rct[2][16] = {
         { 0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7,
           0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf },
         { 0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0,
           0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65 }
     };
-    uint8_t temp[16];
+    uint8_t pt[16], temp[16];
     int err = 0;
 
     av_log_set_level(AV_LOG_DEBUG);
diff --git a/libavutil/avstring-test.c b/libavutil/avstring-test.c
index 7732c22..fc4f0a4 100644
--- a/libavutil/avstring-test.c
+++ b/libavutil/avstring-test.c
@@ -25,7 +25,7 @@
 int main(void)
 {
     int i;
-    const char *strings[] = {
+    static const char *strings[] = {
         "''",
         "",
         ":",
diff --git a/libavutil/crc-test.c b/libavutil/crc-test.c
index 41601c5..ef15fb5 100644
--- a/libavutil/crc-test.c
+++ b/libavutil/crc-test.c
@@ -25,7 +25,7 @@ int main(void)
 {
     uint8_t buf[1999];
     int i;
-    int p[5][3] = {
+    static const int p[5][3] = {
         { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 },
         { AV_CRC_32_IEEE,    0x04C11DB7, 0xC0F5BAE0 },
         { AV_CRC_16_ANSI_LE,     0xA001,     0xBFD8 },
diff --git a/libavutil/hmac-test.c b/libavutil/hmac-test.c
index fb6bf87..f97c8a6 100644
--- a/libavutil/hmac-test.c
+++ b/libavutil/hmac-test.c
@@ -42,14 +42,14 @@ int main(void)
 {
     uint8_t key1[20], key3[131], data3[50];
     enum AVHMACType i = AV_HMAC_SHA224;
-    const uint8_t key2[]  = "Jefe";
-    const uint8_t data1[] = "Hi There";
-    const uint8_t data2[] = "what do ya want for nothing?";
-    const uint8_t data4[] = "Test Using Larger Than Block-Size Key - Hash Key First";
-    const uint8_t data5[] = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data";
-    const uint8_t data6[] = "This is a test using a larger than block-size key and a larger "
-                            "than block-size data. The key needs to be hashed before being used"
-                            " by the HMAC algorithm.";
+    static const uint8_t key2[]  = "Jefe";
+    static const uint8_t data1[] = "Hi There";
+    static const uint8_t data2[] = "what do ya want for nothing?";
+    static const uint8_t data4[] = "Test Using Larger Than Block-Size Key - Hash Key First";
+    static const uint8_t data5[] = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data";
+    static const uint8_t data6[] = "This is a test using a larger than block-size key and a larger "
+                                   "than block-size data. The key needs to be hashed before being used"
+                                   " by the HMAC algorithm.";
     AVHMAC *hmac = av_hmac_alloc(AV_HMAC_MD5);
     if (!hmac)
         return 1;
diff --git a/libavutil/opt-test.c b/libavutil/opt-test.c
index 14a144c..6262b77 100644
--- a/libavutil/opt-test.c
+++ b/libavutil/opt-test.c
@@ -68,7 +68,7 @@ int main(void)
 {
     int i;
     TestContext test_ctx = { .class = &test_class };
-    const char *options[] = {
+    static const char *options[] = {
         "",
         ":",
         "=",
diff --git a/libavutil/sha-test.c b/libavutil/sha-test.c
index e43a5a5..5f62a98 100644
--- a/libavutil/sha-test.c
+++ b/libavutil/sha-test.c
@@ -25,7 +25,7 @@ int main(void)
     int i, j, k;
     AVSHA ctx;
     unsigned char digest[32];
-    const int lengths[3] = { 160, 224, 256 };
+    static const int lengths[3] = { 160, 224, 256 };
 
     for (j = 0; j < 3; j++) {
         printf("Testing SHA-%d\n", lengths[j]);
diff --git a/libavutil/xtea-test.c b/libavutil/xtea-test.c
index f81cfdc..9844576 100644
--- a/libavutil/xtea-test.c
+++ b/libavutil/xtea-test.c
@@ -83,7 +83,7 @@ int main(void)
     AVXTEA ctx;
     uint8_t buf[16], iv[8];
     int i, j;
-    const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
+    static const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
     uint8_t ct[32];
     uint8_t pl[32];
 



More information about the ffmpeg-cvslog mailing list