commit cb43def766c81825f5d0df21e55310c430dd6c68
parent 8c731a7bb7ca018869a6f127c300629aaa917d81
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 20 Feb 2009 08:15:06 +0000
cleaning up types, reducing warnings
Diffstat:
16 files changed, 53 insertions(+), 45 deletions(-)
diff --git a/src/plugins/ffmpeg/libavcodec/bitstream.c b/src/plugins/ffmpeg/libavcodec/bitstream.c
@@ -46,9 +46,6 @@ const uint8_t ff_log2_run[32]={
* @deprecated. Code which uses ff_realloc_static is broken/misdesigned
* and should correctly use static arrays
*/
-attribute_deprecated av_alloc_size(2)
-static void *ff_realloc_static(void *ptr, unsigned int size);
-
static void *ff_realloc_static(void *ptr, unsigned int size)
{
return av_realloc(ptr, size);
diff --git a/src/plugins/ffmpeg/libavcodec/bitstream_filter.c b/src/plugins/ffmpeg/libavcodec/bitstream_filter.c
@@ -57,9 +57,9 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc){
int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
AVCodecContext *avctx, const char *args,
- uint8_t **poutbuf, int *poutbuf_size,
+ uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe){
- *poutbuf= (uint8_t *) buf;
- *poutbuf_size= buf_size;
- return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe);
+ *poutbuf= (uint8_t *)buf;
+ *poutbuf_size= buf_size;
+ return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe);
}
diff --git a/src/plugins/ffmpeg/libavcodec/eval.c b/src/plugins/ffmpeg/libavcodec/eval.c
@@ -47,8 +47,8 @@
typedef struct Parser{
int stack_index;
char *s;
- double *const_value;
- const char **const_name; // NULL terminated
+ const double *const_value;
+ const char *const*const_name; // NULL terminated
double (**func1)(void *, double a); // NULL terminated
const char **func1_name; // NULL terminated
double (**func2)(void *, double a, double b); // NULL terminated
@@ -375,7 +375,7 @@ static int verify_expr(AVEvalExpr * e) {
}
}
-AVEvalExpr * ff_parse(const char *s, const char **const_name,
+AVEvalExpr * ff_parse(const char *s, const char *const *const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), char **func2_name,
const char **error){
@@ -404,7 +404,7 @@ AVEvalExpr * ff_parse(const char *s, const char **const_name,
return e;
}
-double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) {
+double ff_parse_eval(AVEvalExpr * e, const double *const_value, void *opaque) {
Parser p;
p.const_value= const_value;
@@ -412,7 +412,7 @@ double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) {
return eval_expr(&p, e);
}
-double ff_eval2(const char *s, double *const_value, const char **const_name,
+double ff_eval2(const char *s, const double *const_value, const char *const*const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), char **func2_name,
void *opaque, const char **error){
diff --git a/src/plugins/ffmpeg/libavcodec/eval.h b/src/plugins/ffmpeg/libavcodec/eval.h
@@ -52,7 +52,7 @@ double ff_eval(char *s, double *const_value, const char **const_name,
* @param opaque a pointer which will be passed to all functions from func1 and func2
* @return the value of the expression
*/
-double ff_eval2(const char *s, double *const_value, const char **const_name,
+double ff_eval2(const char *s, const double *const_value, const char *const*const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), char **func2_name,
void *opaque, const char **error);
@@ -71,7 +71,7 @@ typedef struct ff_expr_s AVEvalExpr;
* @return AVEvalExpr which must be freed with ff_eval_free by the user when it is not needed anymore
* NULL if anything went wrong
*/
-AVEvalExpr * ff_parse(const char *s, const char **const_name,
+AVEvalExpr * ff_parse(const char *s, const char *const *const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), char **func2_name,
const char **error);
@@ -81,7 +81,7 @@ AVEvalExpr * ff_parse(const char *s, const char **const_name,
* @param opaque a pointer which will be passed to all functions from func1 and func2
* @return the value of the expression
*/
-double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque);
+double ff_parse_eval(AVEvalExpr * e, const double *const_value, void *opaque);
void ff_eval_free(AVEvalExpr * e);
#endif /* FFMPEG_EVAL_H */
diff --git a/src/plugins/ffmpeg/libavcodec/pnm.h b/src/plugins/ffmpeg/libavcodec/pnm.h
@@ -26,8 +26,8 @@
typedef struct PNMContext {
uint8_t *bytestream;
- uint8_t *bytestream_start;
- uint8_t *bytestream_end;
+ const uint8_t *bytestream_start;
+ const uint8_t *bytestream_end;
AVFrame picture;
int maxval; ///< maximum value of a pixel
} PNMContext;
diff --git a/src/plugins/ffmpeg/libavcodec/pnm_parser.c b/src/plugins/ffmpeg/libavcodec/pnm_parser.c
@@ -38,7 +38,7 @@ static int pnm_parse(AVCodecParserContext *s,
retry:
if(pc->index){
pnmctx.bytestream_start=
- pnmctx.bytestream= pc->buffer;
+ pnmctx.bytestream= (uint8_t) pc->buffer;
pnmctx.bytestream_end= pc->buffer + pc->index;
}else{
pnmctx.bytestream_start=
diff --git a/src/plugins/ffmpeg/libavcodec/pnmenc.c b/src/plugins/ffmpeg/libavcodec/pnmenc.c
@@ -95,7 +95,7 @@ static int pnm_decode_frame(AVCodecContext *avctx,
} else if (upgrade == 2) {
unsigned int j, v, f = (65535*32768 + s->maxval/2) / s->maxval;
for (j=0; j<n/2; j++) {
- v = be2me_16(((uint16_t *)s->bytestream)[j]);
+ v = be2me_16(((const uint16_t *)s->bytestream)[j]);
((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
}
}
@@ -238,6 +238,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
return s->bytestream - s->bytestream_start;
}
+#if HAVE_DEAD_CODE
static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data){
PNMContext *s = avctx->priv_data;
AVFrame *pict = data;
@@ -318,6 +319,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
}
return s->bytestream - s->bytestream_start;
}
+#endif
#if 0
static int pnm_probe(AVProbeData *pd)
diff --git a/src/plugins/ffmpeg/libavcodec/snow.h b/src/plugins/ffmpeg/libavcodec/snow.h
@@ -129,9 +129,11 @@ extern void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
#else
+#if HAVE_DEAD_CODE
static int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0);}
static int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0);}
#endif
+#endif
/* C bits used by mmx/sse2/altivec */
diff --git a/src/plugins/ffmpeg/libavcodec/utils.c b/src/plugins/ffmpeg/libavcodec/utils.c
@@ -842,7 +842,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf
return -1;
}
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
- int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
+ int ret = avctx->codec->encode(avctx, buf, buf_size, (void *) samples);
avctx->frame_number++;
return ret;
}else
@@ -1331,7 +1331,11 @@ int av_tempfile(char *prefix, char **filename) {
return -1;
}
#if !defined(HAVE_MKSTEMP)
- fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
+ fd = open(*filename, O_RDWR |
+#ifdef O_BINARY
+ O_BINARY |
+#endif
+ O_CREAT, 0444);
#else
snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
fd = mkstemp(*filename);
@@ -1413,6 +1417,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
int i;
int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr);
const char *p;
+ char *pp;
int frame_width = 0, frame_height = 0;
for(i=0;i<n;i++) {
@@ -1424,10 +1429,12 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
}
if (i == n) {
p = str;
- frame_width = strtol(p, (char **)&p, 10);
+ frame_width = strtol(p, &pp, 10);
+ p = pp;
if (*p)
p++;
- frame_height = strtol(p, (char **)&p, 10);
+ frame_height = strtol(p, &pp, 10);
+ p = pp;
}
if (frame_width <= 0 || frame_height <= 0)
return -1;
diff --git a/src/plugins/ffmpeg/libavformat/avformat.h b/src/plugins/ffmpeg/libavformat/avformat.h
@@ -128,11 +128,10 @@ static inline void av_free_packet(AVPacket *pkt)
/**
* the exact value of the fractional number is: 'val + num / den'.
* num is assumed to be such as 0 <= num < den
- * @deprecated Use AVRational instead
*/
typedef struct AVFrac {
int64_t val, num, den;
-} AVFrac attribute_deprecated;
+} AVFrac;
/*************************************************/
/* input/output formats */
diff --git a/src/plugins/ffmpeg/libavformat/aviobuf.c b/src/plugins/ffmpeg/libavformat/aviobuf.c
@@ -538,8 +538,10 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
if (init_put_byte(*s, buffer, buffer_size,
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
- url_read, url_write, url_seek) < 0) {
- av_free(buffer);
+ (int (*)(void *, uint8_t*,int)) url_read,
+ (int (*)(void *, uint8_t*,int)) url_write,
+ (offset_t (*)(void *, offset_t, int)) url_seek) < 0) {
+ av_free(buffer);
av_freep(s);
return AVERROR(EIO);
}
diff --git a/src/plugins/ffmpeg/libavformat/utils.c b/src/plugins/ffmpeg/libavformat/utils.c
@@ -2821,6 +2821,7 @@ int64_t parse_date(const char *datestr, int duration)
"%H%M%S",
};
const char *q;
+ char *qq;
int is_utc, len;
char lastch;
int negative = 0;
@@ -2881,10 +2882,11 @@ int64_t parse_date(const char *datestr, int duration)
q = small_strptime(p, time_fmt[0], &dt);
if (!q) {
/* parse datestr as S+ */
- dt.tm_sec = strtol(p, (char **)&q, 10);
- if (q == p)
+ dt.tm_sec = strtol(p, &qq, 10);
+ if (qq == p)
/* the parsing didn't succeed */
return INT64_MIN;
+ q = qq;
dt.tm_min = 0;
dt.tm_hour = 0;
}
diff --git a/src/plugins/ffmpeg/libavutil/fifo.c b/src/plugins/ffmpeg/libavutil/fifo.c
@@ -71,10 +71,10 @@ void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) {
void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
{
- av_fifo_generic_write(f, (void *)buf, size, NULL);
+ av_fifo_generic_write(f, buf, size, NULL);
}
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int))
+int av_fifo_generic_write(AVFifoBuffer *f, const void *src, int size, int (*func)(const void*, void*, int))
{
int total = size;
do {
@@ -84,7 +84,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
break;
} else {
memcpy(f->wptr, src, len);
- src = (uint8_t*)src + len;
+ src = (const uint8_t*)src + len;
}
f->wptr += len;
if (f->wptr >= f->end)
diff --git a/src/plugins/ffmpeg/libavutil/fifo.h b/src/plugins/ffmpeg/libavutil/fifo.h
@@ -91,7 +91,7 @@ attribute_deprecated void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int
* If func is NULL, src is interpreted as a simple byte array for source data.
* @return the number of bytes written to the fifo.
*/
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
+int av_fifo_generic_write(AVFifoBuffer *f, const void *src, int size, int (*func)(const void*, void*, int));
/**
* Resizes an AVFifoBuffer.
diff --git a/src/plugins/ffmpeg/libavutil/internal.h b/src/plugins/ffmpeg/libavutil/internal.h
@@ -277,24 +277,15 @@ if((y)<(x)){\
}
#ifndef HAVE_LLRINT
-av_always_inline av_const long long llrint(double x)
-{
- return rint(x);
-}
+#define llrint(x) ((long long) rint(x))
#endif /* HAVE_LLRINT */
#ifndef HAVE_LRINT
-av_always_inline av_const long int lrint(double x)
-{
- return rint(x);
-}
+#define lrint(x) ((long int) rint(x))
#endif /* HAVE_LRINT */
#ifndef HAVE_LRINTF
-av_always_inline av_const long int lrintf(float x)
-{
- return (int)(rint(x));
-}
+#define lrintf(x) ((long int) rint(x))
#endif /* HAVE_LRINTF */
#ifndef HAVE_ROUND
diff --git a/src/plugins/ffmpeg/libswscale/yuv2rgb.c b/src/plugins/ffmpeg/libswscale/yuv2rgb.c
@@ -379,6 +379,7 @@ PROLOG(yuv2rgb_c_16, uint16_t)
DST1(3);
EPILOG(8)
+#if HAVE_DEAD_CODE
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_8, uint8_t)
@@ -398,6 +399,7 @@ PROLOG(yuv2rgb_c_8, uint8_t)
DST2(3);
DST1(3);
EPILOG(8)
+#endif
// r, g, b, dst_1, dst_2
PROLOG(yuv2rgb_c_8_ordered_dither, uint8_t)
@@ -436,6 +438,7 @@ EPILOG(8)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
+#if HAVE_DEAD_CODE
PROLOG(yuv2rgb_c_4, uint8_t)
int acc;
#define DST1_4(i) \
@@ -468,6 +471,7 @@ PROLOG(yuv2rgb_c_4, uint8_t)
DST2_4(3);
DST1_4(3);
EPILOG(4)
+#endif
PROLOG(yuv2rgb_c_4_ordered_dither, uint8_t)
const uint8_t *d64= dither_8x8_73[y&7];
@@ -508,6 +512,7 @@ EPILOG(4)
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
+#if HAVE_DEAD_CODE
PROLOG(yuv2rgb_c_4b, uint8_t)
RGB(0);
DST1(0);
@@ -525,6 +530,7 @@ PROLOG(yuv2rgb_c_4b, uint8_t)
DST2(3);
DST1(3);
EPILOG(8)
+#endif
PROLOG(yuv2rgb_c_4b_ordered_dither, uint8_t)
const uint8_t *d64= dither_8x8_73[y&7];