From 3af05b54eef05bee545c3400c007ff4a7e087579 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 25 Feb 2022 10:04:30 +0100
Subject: gcc2 build fix


diff --git a/ebur128/ebur128.c b/ebur128/ebur128.c
index 6550e89..d721c28 100644
--- a/ebur128/ebur128.c
+++ b/ebur128/ebur128.c
@@ -895,6 +895,8 @@ exit:
 int ebur128_set_max_window(ebur128_state* st, unsigned long window) {
   int errcode = EBUR128_SUCCESS;
   size_t j;
+  size_t new_audio_data_frames;
+  size_t new_audio_data_size;
 
   if ((st->mode & EBUR128_MODE_S) == EBUR128_MODE_S && window < 3000) {
     window = 3000;
@@ -906,7 +908,6 @@ int ebur128_set_max_window(ebur128_state* st, unsigned long window) {
     return EBUR128_ERROR_NO_CHANGE;
   }
 
-  size_t new_audio_data_frames;
   if (safe_size_mul(st->samplerate, window, &new_audio_data_frames) != 0 ||
       new_audio_data_frames > ((size_t) -1) - st->d->samples_in_100ms) {
     return EBUR128_ERROR_NOMEM;
@@ -917,12 +918,12 @@ int ebur128_set_max_window(ebur128_state* st, unsigned long window) {
                             (new_audio_data_frames % st->d->samples_in_100ms);
   }
 
-  size_t new_audio_data_size;
   if (safe_size_mul(new_audio_data_frames, st->channels * sizeof(double),
                     &new_audio_data_size) != 0) {
     return EBUR128_ERROR_NOMEM;
   }
 
+{
   double* new_audio_data = (double*) malloc(new_audio_data_size);
   CHECK_ERROR(!new_audio_data, EBUR128_ERROR_NOMEM, exit)
 
@@ -944,6 +945,7 @@ int ebur128_set_max_window(ebur128_state* st, unsigned long window) {
 exit:
   return errcode;
 }
+}
 
 int ebur128_set_max_history(ebur128_state* st, unsigned long history) {
   if ((st->mode & EBUR128_MODE_LRA) == EBUR128_MODE_LRA && history < 3000) {
-- 
2.30.2

