shithub: sox

Download patch

ref: 5e23e9c24393638380e8474fae1f42661c498967
parent: 3518bcd92416e7cf71ee9a863695a518f3de4e52
author: Mans Rullgard <mans@mansr.com>
date: Mon Aug 24 17:34:28 EDT 2020

utils: drop inttypes fallback definitions

All modern systems have the C99 inttypes.h definitions.  Drop the
fallbacks.

--- a/src/util.h
+++ b/src/util.h
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "soxconfig.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -32,55 +33,6 @@
 #include "xmalloc.h"
 
 /*---------------------------- Portability stuff -----------------------------*/
-
-#if defined(HAVE_INTTYPES_H)
-  #include <inttypes.h>
-#elif defined(HAVE_STDINT_H)
-  #include <stdint.h>
-#else
-  typedef sox_int8_t   int8_t;
-  typedef sox_uint8_t  uint8_t;
-  typedef sox_int16_t  int16_t;
-  typedef sox_uint16_t uint16_t;
-  typedef sox_int32_t  int32_t;
-  typedef sox_uint32_t uint32_t;
-  typedef sox_int64_t  int64_t;
-  typedef sox_uint64_t uint64_t;
-  #define UINT64_MAX ((uint64_t)-1)
-#endif
-
-/* Define the format specifier to use for int64_t values.
- * Example: printf("You may have already won $ %" PRId64 " !!!", n64); */
-#ifndef PRId64 /* Maybe <inttypes.h> already defined this. */
-#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %lld. */
-#define PRId64 "I64d"
-#elif LONG_MAX==9223372036854775807
-#define PRId64 "ld"
-#else
-#define PRId64 "lld"
-#endif
-#endif /* PRId64 */
-
-/* Define the format specifier to use for uint64_t values. */
-#ifndef PRIu64 /* Maybe <inttypes.h> already defined this. */
-#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %llu. */
-#define PRIu64 "I64u"
-#elif ULONG_MAX==0xffffffffffffffff
-#define PRIu64 "lu"
-#else
-#define PRIu64 "llu"
-#endif
-#endif /* PRIu64 */
-
-/* Define the format specifier to use for size_t values.
- * Example: printf("Sizeof(x) = %" PRIuPTR " bytes", sizeof(x)); */
-#ifndef PRIuPTR /* Maybe <inttypes.h> already defined this. */
-#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %zu. */
-#define PRIuPTR "Iu"
-#else
-#define PRIuPTR "zu"
-#endif
-#endif /* PRIuPTR */
 
 #ifdef __GNUC__
 #define NORET __attribute__((noreturn))