mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
printf: fix up dodgy use of #if HAVE_FOO and #if !HAVE_FOO
Should use #ifdef and #ifndef.
This commit is contained in:
parent
79d6b91e27
commit
97b3948a9f
3 changed files with 13 additions and 13 deletions
|
@ -29,10 +29,10 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
/* Get intmax_t. */
|
/* Get intmax_t. */
|
||||||
#if HAVE_STDINT_H_WITH_UINTMAX
|
#ifdef HAVE_STDINT_H_WITH_UINTMAX
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_INTTYPES_H_WITH_UINTMAX
|
#ifdef HAVE_INTTYPES_H_WITH_UINTMAX
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int prefix_count;
|
unsigned int prefix_count;
|
||||||
int prefixes[2];
|
int prefixes[2];
|
||||||
#if !HAVE_SNPRINTF
|
#ifndef HAVE_SNPRINTF
|
||||||
unsigned int tmp_length;
|
unsigned int tmp_length;
|
||||||
char tmpbuf[700];
|
char tmpbuf[700];
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
@ -658,7 +658,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*p = dp->conversion;
|
*p = dp->conversion;
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
p[1] = '%';
|
p[1] = '%';
|
||||||
p[2] = 'n';
|
p[2] = 'n';
|
||||||
p[3] = '\0';
|
p[3] = '\0';
|
||||||
|
@ -678,7 +678,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
abort ();
|
abort ();
|
||||||
prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
|
prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
|
||||||
}
|
}
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
/* Prepare checking whether snprintf returns the count
|
/* Prepare checking whether snprintf returns the count
|
||||||
via %n. */
|
via %n. */
|
||||||
ENSURE_ALLOCATION (length + 1);
|
ENSURE_ALLOCATION (length + 1);
|
||||||
|
@ -688,14 +688,14 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
size_t maxlen;
|
size_t maxlen;
|
||||||
int count;
|
int count;
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
int retcount;
|
int retcount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
maxlen = allocated - length;
|
maxlen = allocated - length;
|
||||||
count = -1;
|
count = -1;
|
||||||
|
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
retcount = 0;
|
retcount = 0;
|
||||||
|
|
||||||
#define SNPRINTF_BUF(arg) \
|
#define SNPRINTF_BUF(arg) \
|
||||||
|
@ -845,7 +845,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
while (digitp != dp->precision_end);
|
while (digitp != dp->precision_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
count = print_long_long (result + length, maxlen,
|
count = print_long_long (result + length, maxlen,
|
||||||
width, precision, dp->flags, dp->conversion, arg);
|
width, precision, dp->flags, dp->conversion, arg);
|
||||||
#else
|
#else
|
||||||
|
@ -937,7 +937,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
/* Portability: Not all implementations of snprintf()
|
/* Portability: Not all implementations of snprintf()
|
||||||
are ISO C 99 compliant. Determine the number of
|
are ISO C 99 compliant. Determine the number of
|
||||||
bytes that snprintf() has produced or would have
|
bytes that snprintf() has produced or would have
|
||||||
|
@ -972,7 +972,7 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#if !HAVE_SNPRINTF
|
#ifndef HAVE_SNPRINTF
|
||||||
if (count >= tmp_length)
|
if (count >= tmp_length)
|
||||||
/* tmp_length was incorrectly calculated - fix the
|
/* tmp_length was incorrectly calculated - fix the
|
||||||
code above! */
|
code above! */
|
||||||
|
@ -990,11 +990,11 @@ vasnprintf (char *resultbuf, size_t * lengthp, const char *format, va_list args)
|
||||||
n = 2 * allocated;
|
n = 2 * allocated;
|
||||||
|
|
||||||
ENSURE_ALLOCATION (n);
|
ENSURE_ALLOCATION (n);
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HAVE_SNPRINTF
|
#ifdef HAVE_SNPRINTF
|
||||||
/* The snprintf() result did fit. */
|
/* The snprintf() result did fit. */
|
||||||
#else
|
#else
|
||||||
/* Append the sprintf() result. */
|
/* Append the sprintf() result. */
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#ifndef __attribute__
|
#ifndef __attribute__
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined (__STRICT_ANSI__)
|
||||||
# define __attribute__(Spec) /* empty */
|
# define __attribute__(Spec) /* empty */
|
||||||
# endif
|
# endif
|
||||||
/* The __-protected variants of `format' and `printf' attributes
|
/* The __-protected variants of `format' and `printf' attributes
|
||||||
|
|
Loading…
Reference in a new issue