diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-05 13:25:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-05 13:34:45 +0100 |
commit | 99efd596267248ba5eae1b0e540d880368a402c3 (patch) | |
tree | 1ab9b0250d1350ffaae7d5f2bf98ba78e21d0cf4 | |
parent | 1fa2bdc90a4a5309a3bf83ff9ae37f59e5f329fa (diff) | |
parent | cb45553f577f8e0ebfe05d3287e1b6fa5859b967 (diff) | |
download | ffmpeg-99efd596267248ba5eae1b0e540d880368a402c3.tar.gz |
Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
Remove pointless #undefs of previously forbidden functions.
fate: Add dependencies for bmp, cdxl, dfa, mp3
Conflicts:
doc/examples/muxing.c
libavfilter/filtfmts.c
libavutil/des.c
libavutil/eval.c
libavutil/log.c
libavutil/parseutils.c
tests/fate/mp3.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
34 files changed, 20 insertions, 105 deletions
diff --git a/libavcodec/golomb-test.c b/libavcodec/golomb-test.c index 54644ade46..8adcdf63d8 100644 --- a/libavcodec/golomb-test.c +++ b/libavcodec/golomb-test.c @@ -27,7 +27,6 @@ #include "golomb.h" #include "put_bits.h" -#undef fprintf #define COUNT 8191 #define SIZE (COUNT * 4) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 3774d6ebb7..610add12d4 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -312,7 +312,6 @@ av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs) } #ifdef TEST -#undef printf #include <stdio.h> #define FILT_ORDER 4 diff --git a/libavcodec/libaacplus.c b/libavcodec/libaacplus.c index 7872fecf4a..e9e50f8fe9 100644 --- a/libavcodec/libaacplus.c +++ b/libavcodec/libaacplus.c @@ -92,9 +92,7 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx) avctx->extradata_size = decoder_specific_info_size; memcpy(avctx->extradata, buffer, avctx->extradata_size); } -#undef free free(buffer); -#define free please_use_av_free } return 0; } diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index a7bf503b3c..d922fdca1b 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -158,9 +158,7 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx) memcpy(avctx->extradata, buffer, avctx->extradata_size); faac_cfg->outputFormat = 0; } -#undef free free(buffer); -#define free please_use_av_free } if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) { diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c index fa311fd657..ec53e2c072 100644 --- a/libavdevice/libcdio.c +++ b/libavdevice/libcdio.c @@ -33,9 +33,6 @@ #include "libavformat/avformat.h" #include "libavformat/internal.h" -/* cdio returns some malloced strings that need to be free()d */ -#undef free - typedef struct CDIOContext { const AVClass *class; cdrom_drive_t *drive; diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index bae1497c4b..80cb1bee11 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -48,8 +48,6 @@ #define DC1394_FRAMERATE_240 FRAMERATE_240 #endif -#undef free - typedef struct dc1394_data { AVClass *class; #if HAVE_LIBDC1394_1 diff --git a/libavdevice/timefilter.c b/libavdevice/timefilter.c index 343f1b1c44..ba2e54e0c0 100644 --- a/libavdevice/timefilter.c +++ b/libavdevice/timefilter.c @@ -90,8 +90,6 @@ double ff_timefilter_eval(TimeFilter *self, double delta) #include "libavutil/lfg.h" #define LFG_MAX ((1LL << 32) - 1) -#undef printf - int main(void) { AVLFG prng; diff --git a/libavfilter/filtfmts.c b/libavfilter/filtfmts.c index 14417cbd4b..72867292a9 100644 --- a/libavfilter/filtfmts.c +++ b/libavfilter/filtfmts.c @@ -26,9 +26,6 @@ #include "libavfilter/avfilter.h" #include "libavfilter/formats.h" -#undef fprintf -#undef printf - static void print_formats(AVFilterContext *filter_ctx) { int i, j; diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 43f9844def..ecc53275b1 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -47,8 +47,6 @@ #include "internal.h" #include "video.h" -#undef time - #include <ft2build.h> #include <freetype/config/ftheader.h> #include FT_FREETYPE_H diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c index 5217e032f6..a18c342756 100644 --- a/libavfilter/vf_mp.c +++ b/libavfilter/vf_mp.c @@ -581,7 +581,7 @@ int vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){ goto fail; picref->buf = pic; - picref->buf->please_use_av_free= (void*)av_free; + picref->buf->free= (void*)av_free; if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)))) goto fail; diff --git a/libavformat/network.c b/libavformat/network.c index 6e924bed66..64bd0ed9ed 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -60,8 +60,6 @@ static unsigned long openssl_thread_id(void) #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00 #include <gcrypt.h> #include <errno.h> -#undef malloc -#undef free GCRY_THREAD_OPTION_PTHREAD_IMPL; #endif #endif diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c index 49ac3ac06d..34ac4deff2 100644 --- a/libavformat/seek-test.c +++ b/libavformat/seek-test.c @@ -28,9 +28,6 @@ #include "libavutil/mathematics.h" #include "libavformat/avformat.h" -#undef printf -#undef fprintf - static char buffer[20]; static const char *ret_str(int v) diff --git a/libavformat/url-test.c b/libavformat/url-test.c index ceaffe8e9a..ee5f06e9ee 100644 --- a/libavformat/url-test.c +++ b/libavformat/url-test.c @@ -20,9 +20,6 @@ #include "internal.h" -#undef printf -#undef exit - static void test(const char *base, const char *rel) { char buf[200], buf2[200]; diff --git a/libavformat/utils.c b/libavformat/utils.c index 1ad0eaef5e..0f13304cd9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3530,7 +3530,6 @@ static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size) { int len, i, j, c; -#undef fprintf #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0) for(i=0;i<size;i+=16) { @@ -3568,7 +3567,6 @@ void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size) static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base) { -#undef fprintf #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0) PRINT("stream #%d:\n", pkt->stream_index); PRINT(" keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0)); diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 802d0f85e7..f03df67441 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -214,7 +214,6 @@ int av_strncasecmp(const char *a, const char *b, size_t n) #ifdef TEST #include "common.h" -#undef printf int main(void) { diff --git a/libavutil/base64.c b/libavutil/base64.c index d907805c7f..98b9c94d8a 100644 --- a/libavutil/base64.c +++ b/libavutil/base64.c @@ -175,8 +175,6 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size) #ifdef TEST // LCOV_EXCL_START -#undef printf - #define MAX_DATA_SIZE 1024 #define MAX_ENCODED_SIZE 2048 diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c index cdc2952dea..5ad74c10fd 100644 --- a/libavutil/blowfish.c +++ b/libavutil/blowfish.c @@ -420,7 +420,6 @@ void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, #ifdef TEST #include <stdio.h> -#undef printf #define NUM_VARIABLE_KEY_TESTS 34 @@ -523,7 +522,6 @@ static const uint8_t ciphertext2[16] = { #define IV "blowfish" -#undef exit static void test_blowfish(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, const uint8_t *ref, int len, uint8_t *iv, int dir, const char *test) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index e14b413725..a1d1547033 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -175,7 +175,6 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) } #ifdef TEST -#undef printf #include <stdio.h> static const struct { diff --git a/libavutil/crc.c b/libavutil/crc.c index bba8cb10a5..aeb9e466ab 100644 --- a/libavutil/crc.c +++ b/libavutil/crc.c @@ -113,7 +113,6 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, } #ifdef TEST -#undef printf int main(void) { uint8_t buf[1999]; diff --git a/libavutil/des.c b/libavutil/des.c index 32ac26f69c..a7a5074203 100644 --- a/libavutil/des.c +++ b/libavutil/des.c @@ -337,10 +337,6 @@ void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) { } #ifdef TEST -// LCOV_EXCL_START -#undef printf -#undef rand -#undef srand #include <stdlib.h> #include <stdio.h> #include "libavutil/time.h" @@ -442,5 +438,4 @@ int main(void) { #endif return 0; } -// LCOV_EXCL_STOP #endif diff --git a/libavutil/eval.c b/libavutil/eval.c index 0d6bd15529..4a27742729 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -660,8 +660,6 @@ int av_expr_parse_and_eval(double *d, const char *s, } #ifdef TEST -// LCOV_EXCL_START -#undef printf #include <string.h> static const double const_values[] = { @@ -797,5 +795,4 @@ int main(int argc, char **argv) return 0; } -// LCOV_EXCL_STOP #endif diff --git a/libavutil/fifo.c b/libavutil/fifo.c index 47328c4585..bafa9e9f98 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -149,8 +149,6 @@ void av_fifo_drain(AVFifoBuffer *f, int size) #ifdef TEST -#undef printf - int main(void) { /* create a FIFO buffer */ diff --git a/libavutil/internal.h b/libavutil/internal.h index cc977f64da..4400c5c439 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -58,38 +58,6 @@ # define INT_BIT (CHAR_BIT * sizeof(int)) #endif -/* avoid usage of dangerous/inappropriate system functions */ -#undef malloc -#define malloc please_use_av_malloc -#undef free -#define free please_use_av_free -#undef realloc -#define realloc please_use_av_realloc -#undef rand -#define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get -#undef srand -#define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init -#undef random -#define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get -#undef sprintf -#define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf -#undef strcat -#define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat -#undef exit -#define exit exit_is_forbidden -#undef printf -#define printf please_use_av_log_instead_of_printf -#undef fprintf -#define fprintf please_use_av_log_instead_of_fprintf -#undef puts -#define puts please_use_av_log_instead_of_puts -#undef perror -#define perror please_use_av_log_instead_of_perror -#undef strcasecmp -#define strcasecmp please_use_av_strcasecmp -#undef strncasecmp -#define strncasecmp please_use_av_strncasecmp - #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ {\ p = av_malloc(size);\ diff --git a/libavutil/log.c b/libavutil/log.c index 57b3d5d087..700e89fa97 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -99,7 +99,6 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = { #endif static int use_color = -1; -#undef fprintf static void colored_fputs(int level, const char *str) { if (use_color < 0) { @@ -220,7 +219,6 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) is_atty = isatty(2) ? 1 : -1; #endif -#undef fprintf if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ count++; if (is_atty == 1) diff --git a/libavutil/md5.c b/libavutil/md5.c index d0d0d27f07..f8f08f130b 100644 --- a/libavutil/md5.c +++ b/libavutil/md5.c @@ -180,7 +180,6 @@ void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len) } #ifdef TEST -#undef printf #include <stdio.h> static void print_md5(uint8_t *md5) diff --git a/libavutil/mem.c b/libavutil/mem.c index d73cddefd0..4253740a10 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -40,11 +40,6 @@ #include "intreadwrite.h" #include "mem.h" -/* here we can use OS-dependent allocation functions */ -#undef free -#undef malloc -#undef realloc - #ifdef MALLOC_PREFIX #define malloc AV_JOIN(MALLOC_PREFIX, malloc) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0ff45c8116..e81da47dbf 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1163,8 +1163,6 @@ void *av_opt_ptr(const AVClass *class, void *obj, const char *name) #ifdef TEST -#undef printf - typedef struct TestContext { const AVClass *class; diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index f188e815fa..ca40569e6a 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -31,8 +31,6 @@ #include "random_seed.h" #include "parseutils.h" -#undef time - #ifdef TEST #define av_get_random_seed av_get_random_seed_deterministic @@ -676,15 +674,13 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info #ifdef TEST -static uint32_t random = MKTAG('L','A','V','U'); +static uint32_t randomv = MKTAG('L','A','V','U'); static uint32_t av_get_random_seed_deterministic(void) { - return random = random * 1664525 + 1013904223; + return randomv = randomv * 1664525 + 1013904223; } -#undef printf - int main(void) { printf("Testing av_parse_video_rate()\n"); diff --git a/libavutil/sha.c b/libavutil/sha.c index 8d5ca458f9..9f630fcc87 100644 --- a/libavutil/sha.c +++ b/libavutil/sha.c @@ -332,7 +332,6 @@ void av_sha_final(AVSHA* ctx, uint8_t *digest) #ifdef TEST #include <stdio.h> -#undef printf int main(void) { diff --git a/libavutil/xtea.c b/libavutil/xtea.c index 28780fb551..d4eede70f0 100644 --- a/libavutil/xtea.c +++ b/libavutil/xtea.c @@ -183,7 +183,6 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, #ifdef TEST #include <stdio.h> -#undef printf #define XTEA_NUM_TESTS 6 @@ -220,7 +219,6 @@ static const uint8_t xtea_test_ct[XTEA_NUM_TESTS][8] = { { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 } }; -#undef exit static void test_xtea(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, const uint8_t *ref, int len, uint8_t *iv, int dir, const char *test) diff --git a/tests/fate/bmp.mak b/tests/fate/bmp.mak index c6601902f5..9e52ac081f 100644 --- a/tests/fate/bmp.mak +++ b/tests/fate/bmp.mak @@ -37,5 +37,7 @@ fate-bmp-rle4: CMD = framecrc -i $(SAMPLES)/bmp/testcompress4.bmp -pix_fmt rgb24 FATE_BMP += fate-bmp-rle8 fate-bmp-rle8: CMD = framecrc -i $(SAMPLES)/bmp/testcompress8.bmp -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += $(FATE_BMP) -fate-bmp: $(FATE_BMP) +FATE_BMP-$(call DEMDEC, IMAGE2, BMP) += $(FATE_BMP) + +FATE_SAMPLES_AVCONV += $(FATE_BMP-yes) +fate-bmp: $(FATE_BMP-yes) diff --git a/tests/fate/cdxl.mak b/tests/fate/cdxl.mak index 86eaa09d0a..2c69e39749 100644 --- a/tests/fate/cdxl.mak +++ b/tests/fate/cdxl.mak @@ -13,5 +13,7 @@ fate-cdxl-pal8-small: CMD = framecrc -i $(SAMPLES)/cdxl/fruit.cdxl -an -pix_fmt FATE_CDXL += fate-cdxl-bitline-ham6 fate-cdxl-bitline-ham6: CMD = framecrc -i $(SAMPLES)/cdxl/bitline.cdxl -frames:v 10 -FATE_SAMPLES_AVCONV += $(FATE_CDXL) -fate-cdxl: $(FATE_CDXL) +FATE_CDXL-$(call DEMDEC, CDXL, CDXL) += $(FATE_CDXL) + +FATE_SAMPLES_AVCONV += $(FATE_CDXL-yes) +fate-cdxl: $(FATE_CDXL-yes) diff --git a/tests/fate/dfa.mak b/tests/fate/dfa.mak index 56f7bfeeb9..4800d8aa90 100644 --- a/tests/fate/dfa.mak +++ b/tests/fate/dfa.mak @@ -31,5 +31,7 @@ fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa -pix_fmt rgb2 FATE_DFA += fate-dfa11 fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += $(FATE_DFA) -fate-dfa: $(FATE_DFA) +FATE_DFA-$(call DEMDEC, DFA, DFA) += $(FATE_DFA) + +FATE_SAMPLES_AVCONV += $(FATE_DFA-yes) +fate-dfa: $(FATE_DFA-yes) diff --git a/tests/fate/mp3.mak b/tests/fate/mp3.mak index 2181fa6a25..1986061c29 100644 --- a/tests/fate/mp3.mak +++ b/tests/fate/mp3.mak @@ -30,11 +30,14 @@ FATE_MP3 += fate-mp3-float-extra_overread fate-mp3-float-extra_overread: CMD = pcm -c:a mp3float -i $(SAMPLES)/mpegaudio/extra_overread.mp3 fate-mp3-float-extra_overread: REF = $(SAMPLES)/mpegaudio/extra_overread.pcm -FATE_SAMPLES_AVCONV += $(FATE_MP3) -fate-mp3: $(FATE_MP3) $(FATE_MP3): CMP = stddev $(FATE_MP3): FUZZ = 0.07 ifdef HAVE_NEON fate-mp3-float-conf-hecommon: FUZZ = 0.70 endif + +FATE_MP3-$(call DEMDEC, MP3, MP3FLOAT) += $(FATE_MP3) + +FATE_SAMPLES_AVCONV += $(FATE_MP3-yes) +fate-mp3: $(FATE_MP3-yes) |