aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Soulier <asoulier@google.com>2023-01-16 13:12:24 -0800
committerAntoine Soulier <asoulier@google.com>2023-01-16 13:12:24 -0800
commitba7d0617bd126316c43864233ec9d4c383f0a298 (patch)
treeef2ae62e5f2dabc5d0a5b85c2def683491ca2e65
parent03a22bf502c4f929dec1b25bd6e3663f4510a1f2 (diff)
downloadliblc3-ba7d0617bd126316c43864233ec9d4c383f0a298.tar.gz
fix: Remove zero-size arrays
-rw-r--r--include/lc3_private.h8
-rw-r--r--src/lc3.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/include/lc3_private.h b/include/lc3_private.h
index 467d028..90bae7b 100644
--- a/include/lc3_private.h
+++ b/include/lc3_private.h
@@ -108,7 +108,7 @@ struct lc3_encoder {
lc3_spec_analysis_t spec;
int16_t *xt;
- float *xs, *xd, s[0];
+ float *xs, *xd, s[1];
};
#define LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz) \
@@ -118,7 +118,7 @@ struct lc3_encoder {
#define LC3_ENCODER_MEM_T(dt_us, sr_hz) \
struct { \
struct lc3_encoder __e; \
- float __s[LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz)]; \
+ float __s[LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz)-1]; \
}
@@ -145,7 +145,7 @@ struct lc3_decoder {
lc3_ltpf_synthesis_t ltpf;
lc3_plc_state_t plc;
- float *xh, *xs, *xd, *xg, s[0];
+ float *xh, *xs, *xd, *xg, s[1];
};
#define LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz) \
@@ -155,7 +155,7 @@ struct lc3_decoder {
#define LC3_DECODER_MEM_T(dt_us, sr_hz) \
struct { \
struct lc3_decoder __d; \
- float __s[LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz)]; \
+ float __s[LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz)-1]; \
}
diff --git a/src/lc3.c b/src/lc3.c
index 0e5066e..c2e0297 100644
--- a/src/lc3.c
+++ b/src/lc3.c
@@ -336,7 +336,7 @@ unsigned lc3_encoder_size(int dt_us, int sr_hz)
return 0;
return sizeof(struct lc3_encoder) +
- LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz) * sizeof(float);
+ (LC3_ENCODER_BUFFER_COUNT(dt_us, sr_hz)-1) * sizeof(float);
}
/**
@@ -622,7 +622,7 @@ unsigned lc3_decoder_size(int dt_us, int sr_hz)
return 0;
return sizeof(struct lc3_decoder) +
- LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz) * sizeof(float);
+ (LC3_DECODER_BUFFER_COUNT(dt_us, sr_hz)-1) * sizeof(float);
}
/**