tags 320270 + patch

On 05/07/27 07:58 -0700, Matt Kraai said ...
> 
> brutefir fails to build because it contains invalid lvalues in
> assignments:

The attached patch fixes this.  The variables in structure declarations
have been marked as the right type and the type-cast in the lvalue has
been removed in this patch.

Giridhar

-- 
Y Giridhar Appaji Nag | http://www.appaji.net/
diff -Nur brutefir-1.0c.orig/bfio_jack.c brutefir-1.0c/bfio_jack.c
--- brutefir-1.0c.orig/bfio_jack.c      2005-01-04 13:52:41.000000000 +0530
+++ brutefir-1.0c/bfio_jack.c   2005-08-07 07:19:52.000000000 +0530
@@ -30,7 +30,7 @@
 #define DEFAULT_CLIENTNAME "brutefir"
 
 static bool_t debug;
-static bool_t stopped = false;
+static volatile bool_t stopped = false;
 static bool_t has_started = false;
 static struct jack_state *handles[2][BF_MAXCHANNELS];
 static void **states[2];
@@ -102,13 +102,13 @@
                        sizeof(jack_default_audio_sample_t));
             }
         }
-        (volatile bool_t)stopped = true;
+        stopped = true;
         return -1;
     }
     frames_left = process_cb(states, n_handles, iobufs, n_frames,
                              BF_CALLBACK_EVENT_NORMAL);
     if (frames_left == -1) {
-        (volatile bool_t)stopped = true;
+        stopped = true;
         return -1;
     }
     
@@ -454,7 +454,7 @@
 bfio_synch_stop(void)
 {
     if (!(volatile bool_t)stopped) {
-        (volatile bool_t)stopped = true;
+        stopped = true;
         jack_client_close(client);
     }
 }    
diff -Nur brutefir-1.0c.orig/bflogic_eq.c brutefir-1.0c/bflogic_eq.c
--- brutefir-1.0c.orig/bflogic_eq.c     2005-01-04 13:52:41.000000000 +0530
+++ brutefir-1.0c/bflogic_eq.c  2005-08-07 07:29:15.000000000 +0530
@@ -39,8 +39,8 @@
     int band_count;
     int taps;
     int coeff[2];
-    int active_coeff;
-    bool_t not_changed;
+    volatile int active_coeff;
+    volatile bool_t not_changed;
     double *freq;
     double *mag;
     double *phase;
@@ -113,7 +113,7 @@
         active = c[(volatile int)equalisers[n].active_coeff];
         if (*coeff == c[0] || *coeff == c[1]) {
             *coeff = active;
-            (volatile bool_t)equalisers[n].not_changed = false;
+            equalisers[n].not_changed = false;
         }
     }
 }
diff -Nur brutefir-1.0c.orig/bfrun.c brutefir-1.0c/bfrun.c
--- brutefir-1.0c.orig/bfrun.c  2005-01-04 13:52:41.000000000 +0530
+++ brutefir-1.0c/bfrun.c       2005-08-07 07:25:39.000000000 +0530
@@ -96,19 +96,19 @@
 
 
 struct intercomm_area {
-    bool_t doreset_overflow;
+    volatile bool_t doreset_overflow;
     int sync[BF_MAXPROCESSES];
-    uint32_t period_us[BF_MAXPROCESSES];
-    double realtime_index;
+    volatile uint32_t period_us[BF_MAXPROCESSES];
+    volatile double realtime_index;
     struct bffilter_control fctrl[BF_MAXFILTERS];
     struct bfoverflow overflow[BF_MAXCHANNELS];
     uint32_t ismuted[2][BF_MAXCHANNELS/32];
-    int delay[2][BF_MAXCHANNELS];
-    int n_pids;
-    pid_t pids[BF_MAXPROCESSES];
-    int exit_status;
-    bool_t full_proc[BF_MAXPROCESSES];
-    bool_t ignore_rtprio;
+    volatile int delay[2][BF_MAXCHANNELS];
+    volatile int n_pids;
+    volatile pid_t pids[BF_MAXPROCESSES];
+    volatile int exit_status;
+    volatile bool_t full_proc[BF_MAXPROCESSES];
+    volatile bool_t ignore_rtprio;
 
     struct {
         uint64_t ts_start;
@@ -496,7 +496,7 @@
     if (delay < 0 || delay > bfconf->maxdelay[io][channel]) {
        return -1;
     }
-    (volatile int)icomm->delay[io][channel] = delay;
+    icomm->delay[io][channel] = delay;
 
     if (bfconf->n_virtperphys[io][physch] == 1) {
        return dai_change_delay(io, physch, delay);
@@ -601,7 +601,7 @@
     }
     
     if ((volatile bool_t)icomm->doreset_overflow) {
-        (volatile bool_t)icomm->doreset_overflow = false;
+        icomm->doreset_overflow = false;
         memset(overflow, 0, sizeof(struct bfoverflow) *
                bfconf->n_channels[OUT]);    
     }
@@ -631,7 +631,7 @@
                 pinfo("rti: not full processing - no rti update\n");
             }
         }
-        (volatile double)icomm->realtime_index = max_rti;
+        icomm->realtime_index = max_rti;
         check_overflows(overflow);
         lastprinttime = tt;
     }
@@ -1324,10 +1324,10 @@
         if (bit_find(partial_proc, 0, n_filters - 1) == -1) {
             timersub(&period_end, &period_start, &tv);
             period_length = tv.tv_sec * 1000000 + tv.tv_usec;
-            (volatile uint32_t)icomm->period_us[process_index] = period_length;
-            (volatile bool_t)icomm->full_proc[process_index] = true;
+            icomm->period_us[process_index] = period_length;
+            icomm->full_proc[process_index] = true;
         } else {
-            (volatile bool_t)icomm->full_proc[process_index] = false;
+            icomm->full_proc[process_index] = false;
         }
         gettimeofday(&period_start, NULL);
 
@@ -2078,9 +2078,9 @@
     memset(&icomm->debug, 0xFF, sizeof(icomm->debug));
     memcpy(icomm->fctrl, bfconf->initfctrl, bfconf->n_filters *
           sizeof(struct bffilter_control));
-    (volatile pid_t)icomm->pids[0] = getpid();
-    (volatile int)icomm->n_pids = 1;
-    (volatile int)icomm->exit_status = BF_EXIT_OK;
+    icomm->pids[0] = getpid();
+    icomm->n_pids = 1;
+    icomm->exit_status = BF_EXIT_OK;
     FOR_IN_AND_OUT {
        memcpy(icomm->delay[IO], bfconf->delay[IO], bfconf->n_channels[IO] *
               sizeof(int));
@@ -2266,8 +2266,8 @@
            return;
            
        default:
-           (volatile pid_t)icomm->pids[icomm->n_pids] = pid;
-           (volatile int)icomm->n_pids += 1;
+           icomm->pids[icomm->n_pids] = pid;
+           icomm->n_pids += 1;
             break;
        }
     }
@@ -2336,8 +2336,8 @@
                return;
                
            default:
-               (volatile pid_t)icomm->pids[icomm->n_pids] = pid;
-               (volatile int)icomm->n_pids += 1;
+               icomm->pids[icomm->n_pids] = pid;
+               icomm->n_pids += 1;
                 close(synch_pipe[1]);
                 if (!readfd(synch_pipe[0], dummydata, 1)) {
                     bf_exit(BF_EXIT_OTHER);
@@ -2382,7 +2382,7 @@
         dai_trigger_callback_io();
         for (n = 0; n < icomm->n_pids; n++) {
             if ((volatile pid_t)icomm->pids[n] == getpid()) {
-                (volatile pid_t)icomm->pids[n] = 0;
+                icomm->pids[n] = 0;
                 break;
             }
         }
@@ -2462,8 +2462,8 @@
             /* never reached */
             return;
         } else {
-            (volatile pid_t)icomm->pids[icomm->n_pids] = pid;  
-            (volatile int)icomm->n_pids += 1;
+            icomm->pids[icomm->n_pids] = pid;  
+            icomm->n_pids += 1;
         }
     }
 
@@ -2512,7 +2512,7 @@
 void
 bf_reset_peak(void)
 {
-    (volatile bool_t)icomm->doreset_overflow = true;
+    icomm->doreset_overflow = true;
     memcpy(icomm->overflow, reset_overflow, sizeof(struct bfoverflow) *
           bfconf->n_channels[OUT]);
 }
@@ -2611,8 +2611,8 @@
 void
 bf_register_process(pid_t pid)
 {
-    (volatile pid_t)icomm->pids[icomm->n_pids] = pid;  
-    (volatile int)icomm->n_pids += 1;
+    icomm->pids[icomm->n_pids] = pid;  
+    icomm->n_pids += 1;
 }
 
 void
@@ -2634,7 +2634,7 @@
             pinfo("Warning: not allowed to set realtime priority. Will run "
                   "with default priority\n  instead, which is less "
                   "reliable (underflow may occur).\n");
-            (volatile bool_t)icomm->ignore_rtprio = true;
+            icomm->ignore_rtprio = true;
             return;
         } else {
             if (name != NULL) {
@@ -2679,10 +2679,10 @@
     self = getpid();
     
     if (icomm != NULL) {
-        (volatile int)icomm->exit_status = status;
+        icomm->exit_status = status;
         for (n = 0; n < icomm->n_pids; n++) {
             if ((volatile pid_t)icomm->pids[n] == self) {
-                (volatile pid_t)icomm->pids[n] = 0;
+                icomm->pids[n] = 0;
                 self_pos = n;
             }
         }
diff -Nur brutefir-1.0c.orig/dai.c brutefir-1.0c/dai.c
--- brutefir-1.0c.orig/dai.c    2005-01-04 13:52:42.000000000 +0530
+++ brutefir-1.0c/dai.c 2005-08-07 07:28:19.000000000 +0530
@@ -43,7 +43,7 @@
 #define CB_MSG_STOP 2
 
 struct subdev {
-    bool_t finished;
+    volatile bool_t finished;
     bool_t uses_callback;
     bool_t uses_clock;
     bool_t isinterleaved;
@@ -61,18 +61,18 @@
     struct {
         int iodelay_fill;
         int curbuf;
-        int frames_left;
+        volatile int frames_left;
     } cb;
 };
 
 struct comarea {
-    bool_t blocking_stopped;
+    volatile bool_t blocking_stopped;
     int lastbuf_index;
     int frames_left;
-    int cb_lastbuf_index;
-    int cb_frames_left;
-    bool_t is_muted[2][BF_MAXCHANNELS];
-    int delay[2][BF_MAXCHANNELS];
+    volatile int cb_lastbuf_index;
+    volatile int cb_frames_left;
+    volatile bool_t is_muted[2][BF_MAXCHANNELS];
+    volatile int delay[2][BF_MAXCHANNELS];
     pid_t pid[2];
     pid_t callback_pid;
     struct subdev dev[2][BF_MAXCHANNELS];
@@ -104,7 +104,7 @@
 static int cbpipe_s[2], cbpipe_r[2];
 static int cbmutex_pipe[2][2];
 static int cbreadywait_pipe[2][2];
-static int callback_ready_waiting[2] = { 0, 0 };
+static volatile int callback_ready_waiting[2] = { 0, 0 };
 
 static int
 process_callback(void **state[2],
@@ -974,8 +974,8 @@
     if ((io != IN && io != OUT) || channel < 0 || channel >= BF_MAXCHANNELS) {
        return;
     }
-    (volatile bool_t)ca->is_muted[io][channel] =
-       (volatile bool_t)!ca->is_muted[io][channel];
+    ca->is_muted[io][channel] =
+       !ca->is_muted[io][channel];
 }
 
 int
@@ -992,7 +992,7 @@
     {
        return -1;
     }
-    (volatile int)ca->delay[io][channel] = delay;      
+    ca->delay[io][channel] = delay;    
     return 0;
 }
 
@@ -1322,9 +1322,9 @@
                if ((volatile int)ca->frames_left == -1 ||
                    frames_left < (volatile int)ca->frames_left)
                {
-                   (volatile int)ca->frames_left = frames_left;
+                   ca->frames_left = frames_left;
                }
-               (volatile int)ca->lastbuf_index = buf_index;
+               ca->lastbuf_index = buf_index;
                break;
                
            default:
@@ -1583,11 +1583,11 @@
                 bfconf->iomods[n].stop(OUT);
             }
        }
-       (volatile bool_t)ca->blocking_stopped = true;
+       ca->blocking_stopped = true;
         for (n = 0; n < n_devs[OUT]; n++) {
             sd = dev[OUT][n];
             if (!sd->uses_callback) {
-                (volatile bool_t)sd->finished = true;
+                sd->finished = true;
             }
         }
         if (output_finish()) {
@@ -1696,7 +1696,7 @@
         {
             bf_exit(BF_EXIT_OTHER);
         }
-        (volatile int)callback_ready_waiting[io] = 0;
+        callback_ready_waiting[io] = 0;
     }
     cbmutex(io, false);    
 }
@@ -1729,14 +1729,14 @@
         if ((volatile int)ca->cb_frames_left == -1 ||
             frame_count < (volatile int)ca->cb_frames_left)
         {
-            (volatile int)ca->cb_frames_left = frame_count;
+            ca->cb_frames_left = frame_count;
         }
-        (volatile int)ca->cb_lastbuf_index = (volatile 
int)ca->cb_buf_index[IN];
+        ca->cb_lastbuf_index = ca->cb_buf_index[IN];
         return 0;
     case BF_CALLBACK_EVENT_FINISHED:
         for (n = 0; n < state_count[OUT]; n++) {
             sd = (struct subdev *)states[OUT][n];
-            (volatile bool_t)sd->finished = true;
+            sd->finished = true;
         }
         cbmutex(IN, true);
         trigger_callback_ready(IN);
@@ -1894,7 +1894,7 @@
 
         if (sd->cb.frames_left != -1) {
             if (sd->cb.frames_left > sd->block_size_frames) {
-                (volatile int)sd->cb.frames_left -= sd->block_size_frames;
+                sd->cb.frames_left -= sd->block_size_frames;
                 return 0;
             }
             if (sd->cb.frames_left == 0) {
diff -Nur brutefir-1.0c.orig/rendereq.h brutefir-1.0c/rendereq.h
--- brutefir-1.0c.orig/rendereq.h       2005-01-04 13:52:42.000000000 +0530
+++ brutefir-1.0c/rendereq.h    2005-08-07 07:01:32.000000000 +0530
@@ -91,8 +91,8 @@
     }
     gettimeofday(&tv2, NULL);
     timersub(&tv2, &tv1, &tv1);
-    (volatile int)eq->active_coeff = !eq->active_coeff;
-    (volatile bool_t)eq->not_changed = true;
+    eq->active_coeff = !eq->active_coeff;
+    eq->not_changed = true;
 
     if (debug) {
         fprintf(stderr, "EQ: rendering coefficient set %d took %.2f ms\n",

Reply via email to