Merge pull request #20 from google/zero_size_array

fix: Remove zero-size arrays
This commit is contained in:
Antoine SOULIER
2023-01-17 14:15:22 -08:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -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]; \
}

View File

@@ -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);
}
/**