ref: a0b181ca844d919be7de26137ddedb0aec69b4b6
parent: ba6f8da569c6807cd921aaf9877be44c323d249e
author: Mark Harris <[email protected]>
date: Thu Feb 1 16:28:58 EST 2018
C preprocessor formatting cleanup
--- a/src/audio-in.c
+++ b/src/audio-in.c
@@ -57,17 +57,17 @@
#endif
#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(X) gettext(X)
+# include <libintl.h>
+# define _(X) gettext(X)
#else
-#define _(X) (X)
-#define textdomain(X)
-#define bindtextdomain(X, Y)
+# define _(X) (X)
+# define textdomain(X)
+# define bindtextdomain(X, Y)
#endif
#ifdef gettext_noop
-#define N_(X) gettext_noop(X)
+# define N_(X) gettext_noop(X)
#else
-#define N_(X) (X)
+# define N_(X) (X)
#endif
#include <ogg/ogg.h>
--- a/src/encoder.h
+++ b/src/encoder.h
@@ -5,17 +5,17 @@
#include <opusenc.h>
#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(X) gettext(X)
+# include <libintl.h>
+# define _(X) gettext(X)
#else
-#define _(X) (X)
-#define textdomain(X)
-#define bindtextdomain(X, Y)
+# define _(X) (X)
+# define textdomain(X)
+# define bindtextdomain(X, Y)
#endif
#ifdef gettext_noop
-#define N_(X) gettext_noop(X)
+# define N_(X) gettext_noop(X)
#else
-#define N_(X) (X)
+# define N_(X) (X)
#endif
typedef long (*audio_read_func)(void *src, float *buffer, int samples);
--- a/src/info_opus.c
+++ b/src/info_opus.c
@@ -26,7 +26,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <stdlib.h>
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -33,7 +33,7 @@
#include <stdio.h>
#if !defined WIN32 && !defined _WIN32
-#include <unistd.h>
+# include <unistd.h>
#endif
#include <getopt.h>
@@ -49,18 +49,16 @@
provides a better mechanism.*/
#if defined(OPUS_GET_EXPERT_FRAME_DURATION_REQUEST)
/*Enable soft clipping prevention.*/
-#define HAVE_SOFT_CLIP (1)
+# define HAVE_SOFT_CLIP (1)
#endif
-#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32
# include "unicode_support.h"
# include "wave_out.h"
/* We need the following two to set stdout to binary */
# include <io.h>
# include <fcntl.h>
-# define I64FORMAT "I64d"
#else
-# define I64FORMAT "lld"
# define fopen_utf8(_x,_y) fopen((_x),(_y))
# define argc_utf8 argc
# define argv_utf8 argv
@@ -377,9 +375,9 @@
}
AUDIO_INITINFO(&info);
-#ifdef AUMODE_PLAY /* NetBSD/OpenBSD */
+# ifdef AUMODE_PLAY /* NetBSD/OpenBSD */
info.mode = AUMODE_PLAY;
-#endif
+# endif
info.play.encoding = AUDIO_ENCODING_SLINEAR;
info.play.precision = 16;
info.play.input_sample_rate = rate;
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -37,16 +37,16 @@
#include <stdlib.h>
#include <string.h>
#if (!defined WIN32 && !defined _WIN32) || defined(__MINGW32__)
-#include <unistd.h>
-#include <time.h>
+# include <unistd.h>
+# include <time.h>
#endif
#include <math.h>
#ifdef _MSC_VER
-#define snprintf _snprintf
+# define snprintf _snprintf
#endif
-#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32
# include "unicode_support.h"
/* We need the following two to set stdout to binary */
# include <io.h>
@@ -70,12 +70,12 @@
#include <opusenc.h>
#ifdef VALGRIND
-#include <valgrind/memcheck.h>
-#define VG_UNDEF(x,y) VALGRIND_MAKE_MEM_UNDEFINED((x),(y))
-#define VG_CHECK(x,y) VALGRIND_CHECK_MEM_IS_DEFINED((x),(y))
+# include <valgrind/memcheck.h>
+# define VG_UNDEF(x,y) VALGRIND_MAKE_MEM_UNDEFINED((x),(y))
+# define VG_CHECK(x,y) VALGRIND_CHECK_MEM_IS_DEFINED((x),(y))
#else
-#define VG_UNDEF(x,y)
-#define VG_CHECK(x,y)
+# define VG_UNDEF(x,y)
+# define VG_CHECK(x,y)
#endif
#define IMIN(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum int value. */
@@ -362,20 +362,20 @@
int nb_streams;
int nb_coupled;
#ifdef WIN_UNICODE
- int argc_utf8;
- char **argv_utf8;
+ int argc_utf8;
+ char **argv_utf8;
#endif
- if(query_cpu_support()){
- fprintf(stderr,"\n\n** WARNING: This program was compiled with SSE%s\n",query_cpu_support()>1?"2":"");
- fprintf(stderr," but this CPU claims to lack these instructions. **\n\n");
- }
+ if(query_cpu_support()){
+ fprintf(stderr,"\n\n** WARNING: This program was compiled with SSE%s\n",query_cpu_support()>1?"2":"");
+ fprintf(stderr," but this CPU claims to lack these instructions. **\n\n");
+ }
#ifdef WIN_UNICODE
- (void)argc;
- (void)argv;
+ (void)argc;
+ (void)argv;
- init_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
+ init_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
#endif
opt_ctls_ctlval=NULL;
@@ -997,7 +997,7 @@
if(fin)fclose(fin);
if(data.frange)fclose(data.frange);
#ifdef WIN_UNICODE
- free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
+ free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
#endif
return 0;
}
--- a/src/opusinfo.c
+++ b/src/opusinfo.c
@@ -11,7 +11,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <stdio.h>
@@ -32,7 +32,7 @@
#include "info_opus.h"
#include "picture.h"
-#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32
# include "unicode_support.h"
#else
# define fopen_utf8(_x,_y) fopen((_x),(_y))
@@ -1012,8 +1012,8 @@
}
#ifdef WIN_UNICODE
- free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
- uninit_console_utf8();
+ free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
+ uninit_console_utf8();
#endif
return ret;
--- a/src/opusrtp.c
+++ b/src/opusrtp.c
@@ -43,15 +43,15 @@
#include <getopt.h>
#ifndef _WIN32
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <errno.h>
#endif
#ifdef HAVE_PCAP
-#include <pcap.h>
+# include <pcap.h>
#endif
#include <opus.h>
#include <ogg/ogg.h>
@@ -842,7 +842,7 @@
ogg_flush(params);
fprintf(stderr, "Capturing packets\n");
- // read and dispatch packets until EOF is reached
+ /* read and dispatch packets until EOF is reached */
pcap_loop(pcap, 0, write_packet, (u_char *)params);
/* write outstanding data */
--- a/src/stack_alloc.h
+++ b/src/stack_alloc.h
@@ -41,7 +41,7 @@
# define alloca(_x) _alloca(_x);
# endif
#else
-#ifdef HAVE_ALLOCA_H
+# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# include <stdlib.h>
@@ -87,29 +87,29 @@
#ifdef ENABLE_VALGRIND
-#include <valgrind/memcheck.h>
+# include <valgrind/memcheck.h>
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+# define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
-#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
+# define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#else
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+# define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
-#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
+# define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#endif
#if defined(VAR_ARRAYS)
-#define VARDECL(var)
-#define ALLOC(var, size, type) type var[size]
+# define VARDECL(var)
+# define ALLOC(var, size, type) type var[size]
#elif defined(USE_ALLOCA)
-#define VARDECL(var) var
-#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
+# define VARDECL(var) var
+# define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
#else
-#define VARDECL(var) var
-#define ALLOC(var, size, type) var = PUSH(stack, size, type)
+# define VARDECL(var) var
+# define ALLOC(var, size, type) var = PUSH(stack, size, type)
#endif
--- a/src/wav_io.h
+++ b/src/wav_io.h
@@ -1,17 +1,17 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: wav_io.h
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,12 +32,12 @@
#include <opus_types.h>
#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
-#define le_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
-#define be_short(s) ((short) (s))
+# define le_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
+# define be_short(s) ((short) (s))
#else
-#define le_short(s) ((short) (s))
-#define be_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
-#endif
+# define le_short(s) ((short) (s))
+# define be_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
+#endif
/** Convert little endian */
static inline opus_int32 le_int(opus_int32 i)
--- a/src/wave_out.c
+++ b/src/wave_out.c
@@ -42,12 +42,12 @@
#if defined WIN32 || defined _WIN32
-#include <string.h>
-#include <errno.h>
-#include "wave_out.h"
+# include <string.h>
+# include <errno.h>
+# include "wave_out.h"
-#define MAXWAVESIZE 4294967040LU
-#define MAX_WAVEBLOCKS 32
+# define MAXWAVESIZE 4294967040LU
+# define MAX_WAVEBLOCKS 32
// This is modified for USE_WIN_AUDIO - ONLY 2002-02-27
--- a/src/wave_out.h
+++ b/src/wave_out.h
@@ -1,60 +1,60 @@
-/* Copyright (c) 2002, John Edwards
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-// WAVE_OUT.H - Necessary stuff for WIN_AUDIO
-
-#ifndef WAVE_OUT_H
-#define WAVE_OUT_H
-
-#include <stdio.h>
-#include <windows.h>
-#ifdef __MINGW32__
-#include <mmsystem.h>
-#endif
-
-//// constants /////////////////////////////////////////////////////
-
-#define SAMPLE_SIZE 16
-#define FILE_T FILE*
-#define INVALID_FILEDESC NULL
-
-//// Simple types //////////////////////////////////////////////////
-
-typedef signed int Int; // at least -32767...+32767, fast type
-typedef unsigned int Uint; // at least 0...65535, fast type
-typedef long double Ldouble; // most exact floating point format
-
-//// procedures/functions //////////////////////////////////////////
-// wave_out.c
-Int Set_WIN_Params ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels);
-int WIN_Play_Samples ( const void* buff, size_t len );
-int WIN_Audio_close ( void );
-
-#endif /* WAVE_OUT_H */
+/* Copyright (c) 2002, John Edwards
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// WAVE_OUT.H - Necessary stuff for WIN_AUDIO
+
+#ifndef WAVE_OUT_H
+#define WAVE_OUT_H
+
+#include <stdio.h>
+#include <windows.h>
+#ifdef __MINGW32__
+# include <mmsystem.h>
+#endif
+
+//// constants /////////////////////////////////////////////////////
+
+#define SAMPLE_SIZE 16
+#define FILE_T FILE*
+#define INVALID_FILEDESC NULL
+
+//// Simple types //////////////////////////////////////////////////
+
+typedef signed int Int; // at least -32767...+32767, fast type
+typedef unsigned int Uint; // at least 0...65535, fast type
+typedef long double Ldouble; // most exact floating point format
+
+//// procedures/functions //////////////////////////////////////////
+// wave_out.c
+Int Set_WIN_Params ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels);
+int WIN_Play_Samples ( const void* buff, size_t len );
+int WIN_Audio_close ( void );
+
+#endif /* WAVE_OUT_H */
--- a/win32/unicode_support.c
+++ b/win32/unicode_support.c
@@ -27,12 +27,12 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32
-#include "unicode_support.h"
+# include "unicode_support.h"
-#include <windows.h>
-#include <io.h>
+# include <windows.h>
+# include <io.h>
static UINT g_old_output_cp = ((UINT)-1);
@@ -194,4 +194,4 @@
}
}
-#endif
\ No newline at end of file
+#endif
--- a/win32/unicode_support.h
+++ b/win32/unicode_support.h
@@ -46,4 +46,4 @@
void init_console_utf8(void);
void uninit_console_utf8(void);
-#endif
\ No newline at end of file
+#endif