clang-tidy: don't assign in ifmain
authorRosen Penev <[email protected]>
Thu, 27 Jun 2024 20:55:51 +0000 (27 13:55 -0700)
committerAvery King <[email protected]>
Wed, 27 Nov 2024 06:04:49 +0000 (27 06:04 +0000)
Found with bugprone-assignment-in-if-condition

Signed-off-by: Rosen Penev <[email protected]>
src/layer12.c

index a334a27..2265569 100644 (file)
@@ -218,7 +218,8 @@ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame)
     }
 
     for (sb = bound; sb < 32; ++sb) {
-      if ((nb = allocation[0][sb])) {
+      nb = allocation[0][sb];
+      if (nb) {
        mad_fixed_t sample;
 
        if (mad_bit_length(&stream->ptr, &frameend_ptr) < nb) {
@@ -321,7 +322,8 @@ void II_samples(struct mad_bitptr *ptr,
 
   mad_bit_init(&frameend_ptr, stream->next_frame);
 
-  if ((nb = quantclass->group)) {
+  nb = quantclass->group;
+  if (nb) {
     unsigned int c, nlevels;
 
     if (mad_bit_length(ptr, &frameend_ptr) < quantclass->bits) {
@@ -567,8 +569,9 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame)
   for (gr = 0; gr < 12; ++gr) {
     for (sb = 0; sb < bound; ++sb) {
       for (ch = 0; ch < nch; ++ch) {
-       if ((index = allocation[ch][sb])) {
-         index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+        index = allocation[ch][sb];
+        if (index) {
+          index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
 
          II_samples(&stream->ptr, &qc_table[index], samples, stream);
          if (stream->error != 0)
@@ -587,7 +590,8 @@ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame)
     }
 
     for (sb = bound; sb < sblimit; ++sb) {
-      if ((index = allocation[0][sb])) {
+      index = allocation[0][sb];
+      if (index) {
        index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
 
        II_samples(&stream->ptr, &qc_table[index], samples, stream);