Skip to content

Commit

Permalink
Merge branch 'subversion'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsafari committed Oct 31, 2018
2 parents 322e8ec + c25bc29 commit 0f3e48a
Show file tree
Hide file tree
Showing 21 changed files with 267 additions and 117 deletions.
18 changes: 5 additions & 13 deletions audio_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,19 +521,11 @@ static float *resample_sound (struct audio_conversion *conv, const float *buf,
resample_data.output_frames = resample_data.input_frames
* resample_data.src_ratio;

if (conv->resample_buf) {
conv->resample_buf = (float *)xrealloc (conv->resample_buf,
sizeof(float) * resample_data.input_frames
* nchannels);
new_input_start = conv->resample_buf
+ conv->resample_buf_nsamples;
}
else {
conv->resample_buf = (float *)xmalloc (sizeof(float)
* resample_data.input_frames
* nchannels);
new_input_start = conv->resample_buf;
}
assert (conv->resample_buf || conv->resample_buf_nsamples == 0);
conv->resample_buf = xrealloc (conv->resample_buf,
sizeof(float) * nchannels *
resample_data.input_frames);
new_input_start = conv->resample_buf + conv->resample_buf_nsamples;

output = (float *)xmalloc (sizeof(float) * resample_data.output_frames
* nchannels);
Expand Down
11 changes: 7 additions & 4 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ void *xrealloc (void *ptr, const size_t size)
{
void *p;

if ((p = realloc(ptr, size)) == NULL && size != 0)
p = realloc (ptr, size);
if (!p && size != 0)
fatal ("Can't allocate memory!");

return p;
}

Expand Down Expand Up @@ -378,7 +380,8 @@ int get_realtime (struct timespec *ts)
return result;
}

/* Convert time in second to min:sec text format. buff must be 6 chars long. */
/* Convert time in second to min:sec text format.
'buff' must be at least 32 chars long. */
void sec_to_min (char *buff, const int seconds)
{
assert (seconds >= 0);
Expand All @@ -391,12 +394,12 @@ void sec_to_min (char *buff, const int seconds)
min = seconds / 60;
sec = seconds % 60;

snprintf (buff, 6, "%02d:%02d", min, sec);
snprintf (buff, 32, "%02d:%02d", min, sec);
}
else if (seconds < 10000 * 60)

/* the time is less than 9999 minutes */
snprintf (buff, 6, "%4dm", seconds/60);
snprintf (buff, 32, "%4dm", seconds/60);
else
strcpy (buff, "!!!!!");
}
Expand Down
13 changes: 13 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@

#include "compat.h"

/* Suppress overly-enthusiastic GNU variadic macro extensions warning. */
#if defined(__clang__) && HAVE_VARIADIC_MACRO_WARNING
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif

struct timespec;

#ifdef HAVE_FUNC_ATTRIBUTE_FORMAT
Expand Down Expand Up @@ -61,6 +66,14 @@ struct timespec;
# define GCC_DIAG_ON(x)
#endif

#ifdef HAVE_FORMAT_TRUNCATION_WARNING
# define SUPPRESS_FORMAT_TRUNCATION_WARNING GCC_DIAG_OFF(format-truncation)
# define UNSUPPRESS_FORMAT_TRUNCATION_WARNING GCC_DIAG_ON(format-truncation)
#else
# define SUPPRESS_FORMAT_TRUNCATION_WARNING
# define UNSUPPRESS_FORMAT_TRUNCATION_WARNING
#endif

#define CONFIG_DIR ".moc"
#define LOCK(mutex) pthread_mutex_lock (&mutex)
#define UNLOCK(mutex) pthread_mutex_unlock (&mutex)
Expand Down
13 changes: 12 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,18 @@ AC_C_BIGENDIAN
AC_C_CONST
AC_TYPE_INTPTR_T
AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-W)
AX_CFLAGS_GCC_OPTION(-Wextra)

dnl Overly-enthusiastic warning suppression.
save_CFLAGS="$CFLAGS"
AX_CFLAGS_GCC_OPTION([-Wgnu-zero-variadic-macro-arguments], ,
AC_DEFINE([HAVE_VARIADIC_MACRO_WARNING], 1,
[Define if compiler recognises warning option]))
AX_CFLAGS_GCC_OPTION([-Werror=unknown-warning-option])
AX_CFLAGS_GCC_OPTION([-Wformat-truncation], ,
AC_DEFINE([HAVE_FORMAT_TRUNCATION_WARNING], 1,
[Define if compiler recognises warning option]))
CFLAGS="$save_CFLAGS"

PKG_PROG_PKG_CONFIG([0.20])

Expand Down
11 changes: 4 additions & 7 deletions decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,12 @@ char *file_type_name (const char *file)
size_t len;

len = strlen (ext);
switch (len) {
default:
for (size_t ix = 0; ix < len; ix += 1) {
if (ix > 1) {
buf[2] = toupper (ext[len - 1]);
case 2:
buf[1] = toupper (ext[1]);
case 1:
buf[0] = toupper (ext[0]);
case 0:
break;
}
buf[ix] = toupper (ext[ix]);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions decoder_plugins/aac/aac.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ static void *aac_open_internal (struct io_stream *stream, const char *fname)
int n;

/* init private struct */
data = (struct aac_data *)xmalloc (sizeof(struct aac_data));
memset (data, 0, sizeof(struct aac_data));
data->ok = 0;
data = xcalloc (1, sizeof *data);
data->decoder = NeAACDecOpen();

/* set decoder config */
Expand Down
Loading

0 comments on commit 0f3e48a

Please sign in to comment.