Package: bladerf / 0.2017.12~rc1-2

0014-host-test-fix-compile-errors-on-test_config_file-551.patch Patch series | download
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
84
85
86
87
88
89
90
91
92
93
94
From cff2c21ce26a10f71e481e28d174be0273f51240 Mon Sep 17 00:00:00 2001
From: Rey Tucker <git@reytucker.us>
Date: Tue, 27 Mar 2018 18:23:33 -0400
Subject: [PATCH 14/15] host: test: fix compile errors on test_config_file
 (#551)

On older compilers, 'for' loop initial declarations are not allowed by
default. So, use the old style for maximum compatibility.

h/t Christophe Devine
---
 .../libbladeRF_test/test_config_file/src/main.c         | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/host/libraries/libbladeRF_test/test_config_file/src/main.c b/host/libraries/libbladeRF_test/test_config_file/src/main.c
index e15b2316..69335a3d 100644
--- a/host/libraries/libbladeRF_test/test_config_file/src/main.c
+++ b/host/libraries/libbladeRF_test/test_config_file/src/main.c
@@ -62,7 +62,7 @@ static char const DIR_DELIM[] = "/";
 typedef struct {
     struct bladerf_devinfo ident; /**< devinfo struct for this test */
     bladerf_fpga_size fpga_size;  /**< FPGA size */
-    uint64_t frequency;       /**< Expected frequency */
+    uint64_t frequency;           /**< Expected frequency */
 } test_state;
 
 /**
@@ -140,13 +140,15 @@ static test_state HISTORY[ARRAY_SIZE(states)];
  */
 int create_config(char const *filename, char const **config, size_t len)
 {
+    size_t i;
+
     FILE *f = fopen(filename, "w");
     if (NULL == f) {
         perror("fopen failed");
         return BLADERF_ERR_IO;
     }
 
-    for (size_t i = 0; i < len; ++i) {
+    for (i = 0; i < len; ++i) {
         fprintf(f, "%s\n", config[i]);
     }
 
@@ -212,11 +214,13 @@ int create_test_device(struct bladerf **device,
  */
 int update_test_state(struct bladerf *dev, char const *key, uint64_t value)
 {
+    size_t i;
+
     if (NULL == dev || NULL == key) {
         return BLADERF_ERR_INVAL;
     }
 
-    for (size_t i = 0; i < ARRAY_SIZE(states); ++i) {
+    for (i = 0; i < ARRAY_SIZE(states); ++i) {
         test_state const *t = &states[i];
 
         if (bladerf_devinfo_matches(&dev->ident, &t->ident)) {
@@ -243,11 +247,13 @@ int update_test_state(struct bladerf *dev, char const *key, uint64_t value)
  */
 bool check_test_state(struct bladerf *dev, char const *key)
 {
+    size_t i;
+
     if (NULL == dev || NULL == key) {
         return false;
     }
 
-    for (size_t i = 0; i < ARRAY_SIZE(states); ++i) {
+    for (i = 0; i < ARRAY_SIZE(states); ++i) {
         test_state const *t = &states[i];
 
         if (bladerf_devinfo_matches(&dev->ident, &t->ident)) {
@@ -302,6 +308,7 @@ int main(int argc, char *argv[])
     char *tmpbase     = NULL;
     bool result       = true;
     int rv;
+    size_t i;
 
     /* Get the TEMP variable from the environment, if it exists */
     tmpbase = getenv("TEMP");
@@ -359,7 +366,7 @@ int main(int argc, char *argv[])
     bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_DEBUG);
 
     /* Iterate through the test cases */
-    for (size_t i = 0; i < ARRAY_SIZE(states); ++i) {
+    for (i = 0; i < ARRAY_SIZE(states); ++i) {
         test_state const *t = &states[i];
         struct bladerf *dev = NULL;
         bool check          = false;
-- 
2.11.0