[MPlayer-dev-eng] [PATCH] WIP: RFC: XXX: Unbreak build with GCC 14
Alexander Strasser
eclipse7 at gmx.net
Tue Apr 16 00:36:37 EEST 2024
DO NOT USE FOR NON-DEVELOPMENT: This is just to get the ball rolling
This change very likely contains errors. It was just to get the source
compiling again in one longish session...
See also: https://gcc.gnu.org/gcc-14/porting_to.html
---
As always testing and comments very welcome!
I guess not supporting GCC 14 initially would be another way forward,
but fear it's not a good idea.
DISCLAIMER:
1. There are **very likely** mistakes in this patch!
2. It's mostly what I could manage to do in one longish sitting
to get MPlayer to build with GCC 14.
3. I might have touched some warnings by accident because we have
so many of them accumulated and I might have forgotten to
actually search to the next error :(
PS.
If we actually build with GCC 14 we could also look into current
clang. Didn't work for me when I tried...
configure | 8 ++++----
libaf/af_lavcresample.c | 2 +-
libmpcodecs/ad_spdif.c | 4 ++--
libmpcodecs/vd_ffmpeg.c | 4 ++--
libmpcodecs/vf_pp.c | 2 +-
libmpcodecs/vf_scale.c | 6 +++---
libmpcodecs/vf_screenshot.c | 4 ++--
libmpdemux/demux_film.c | 2 +-
libmpdemux/demux_lavf.c | 2 +-
libmpdemux/muxer_avi.c | 26 +++++++++++++-------------
libmpdemux/muxer_lavf.c | 2 +-
libvo/gl_common.c | 2 +-
libvo/vo_aa.c | 4 ++--
libvo/vo_matrixview.c | 2 +-
libvo/vo_x11.c | 2 +-
loader/qtx/qtxsdk/components.h | 2 +-
mp_msg.c | 2 +-
mplayer.c | 2 +-
sub/spudec.c | 2 +-
sub/sub.c | 2 +-
20 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/configure b/configure
index abc6e07ea..197ee26e8 100755
--- a/configure
+++ b/configure
@@ -9858,10 +9858,10 @@ print_enabled_filters(){
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $libavdecoders $libavencoders
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $libavparsers
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $libavbsfs
-print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list ""
-print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list ""
-print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $libavdemuxers
-print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $libavmuxers
+print_enabled_components libavdevice/indev_list.c FFInputFormat indev_list ""
+print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list ""
+print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $libavdemuxers
+print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $libavmuxers
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $libavprotocols
print_enabled_filters libavfilter/filter_list.c AVFilter filter_list $libavfilters
diff --git a/libaf/af_lavcresample.c b/libaf/af_lavcresample.c
index 642f6401a..c09a32df7 100644
--- a/libaf/af_lavcresample.c
+++ b/libaf/af_lavcresample.c
@@ -160,7 +160,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
memcpy(s->in[0], in, in_len);
- ret = swr_convert(s->swrctx, &s->tmp[0], out_len/chans/2, &s->in[0], in_len/chans/2);
+ ret = swr_convert(s->swrctx, &s->tmp[0], out_len/chans/2, (const uint8_t * const *)&s->in[0], in_len/chans/2);
if (ret < 0) return NULL;
out_len= ret*chans*2;
diff --git a/libmpcodecs/ad_spdif.c b/libmpcodecs/ad_spdif.c
index 4cdf2c77a..926d94051 100644
--- a/libmpcodecs/ad_spdif.c
+++ b/libmpcodecs/ad_spdif.c
@@ -54,7 +54,7 @@ static int read_packet(void *p, uint8_t *buf, int buf_size)
return 0;
}
-static int write_packet(void *p, uint8_t *buf, int buf_size)
+static int write_packet(void *p, const uint8_t *buf, int buf_size)
{
int len;
struct spdifContext *ctx = p;
@@ -131,7 +131,7 @@ static int init(sh_audio_t *sh)
// FORCE USE DTS-HD
if (lavf_ctx->streams[0]->codecpar->codec_id == AV_CODEC_ID_DTS)
av_dict_set(&opts, "dtshd_rate", "768000" /* 192000*4 */, 0);
- if ((res = avformat_write_header(lavf_ctx, opts)) < 0) {
+ if ((res = avformat_write_header(lavf_ctx, &opts)) < 0) {
av_dict_free(&opts);
if (res == AVERROR_PATCHWELCOME)
mp_msg(MSGT_DECAUDIO,MSGL_INFO,
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 1588f8817..bcf92a6a2 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -219,7 +219,7 @@ static int vdpau_render_wrapper(AVCodecContext *s, AVFrame *f,
sh_video_t *sh = s->opaque;
struct vdpau_frame_data data;
uint8_t *planes[4] = {(void *)&data};
- data.surface = (VdpVideoSurface)mpi->priv;
+ data.surface = (VdpVideoSurface)(uintptr_t)mpi->priv;
data.info = info;
data.bitstream_buffers_used = count;
data.bitstream_buffers = buffers;
@@ -738,7 +738,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic, int isreference){
if (ctx->use_vdpau) {
VdpVideoSurface surface = (VdpVideoSurface)mpi->priv;
avctx->draw_horiz_band= NULL;
- mpi->planes[3] = surface;
+ mpi->planes[3] = (void *)(uintptr_t)surface;
}
#endif
#if CONFIG_XVMC
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index 9721554d0..954c076da 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -142,7 +142,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts, double
if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
// do the postprocessing! (or copy if no DR)
- pp_postprocess(mpi->planes ,mpi->stride,
+ pp_postprocess((const unsigned char **)mpi->planes ,mpi->stride,
vf->dmpi->planes,vf->dmpi->stride,
(mpi->w+7)&(~7),mpi->h,
mpi->qscale, mpi->qstride,
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index e48a2ad45..e8304faf4 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -439,14 +439,14 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src
int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2], 2*src_stride[3]};
int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2], 2*dst_stride[3]};
- sws_scale(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
+ sws_scale(sws1, (const uint8_t * const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
for(i=0; i<MP_MAX_PLANES; i++){
src2[i] += src_stride[i];
dst2[i] += dst_stride[i];
}
- sws_scale(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
+ sws_scale(sws2, (const uint8_t * const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
}else{
- sws_scale(sws1, src2, src_stride, y, h, dst, dst_stride);
+ sws_scale(sws1, (const uint8_t * const *)src2, src_stride, y, h, dst, dst_stride);
}
}
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index e8b87fa91..0996dcc74 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -60,7 +60,7 @@ static void draw_slice(struct vf_instance *vf, unsigned char** src,
int* stride, int w,int h, int x, int y)
{
if (vf->priv->store_slices) {
- sws_scale(vf->priv->ctx, src, stride, y, h, vf->priv->pic->data, vf->priv->pic->linesize);
+ sws_scale(vf->priv->ctx, (const uint8_t * const *)src, stride, y, h, vf->priv->pic->data, vf->priv->pic->linesize);
}
vf_next_draw_slice(vf,src,stride,w,h,x,y);
}
@@ -158,7 +158,7 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
if (!priv->pic->data[0])
priv->pic->data[0] = av_malloc(priv->pic->linesize[0]*priv->dh);
- sws_scale(priv->ctx, mpi->planes, mpi->stride, 0, mpi->height, priv->pic->data, priv->pic->linesize);
+ sws_scale(priv->ctx, (const uint8_t * const *)mpi->planes, mpi->stride, 0, mpi->height, priv->pic->data, priv->pic->linesize);
}
static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
diff --git a/libmpdemux/demux_film.c b/libmpdemux/demux_film.c
index fdb391ddd..b351368e4 100644
--- a/libmpdemux/demux_film.c
+++ b/libmpdemux/demux_film.c
@@ -157,7 +157,7 @@ static int demux_film_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
free(buf);
}
else {/* for 16bit */
- unsigned short* tmp = dp->buffer;
+ unsigned short* tmp = (unsigned short *)dp->buffer;
unsigned short* buf = malloc(film_chunk.chunk_size);
for(i = 0; i < film_chunk.chunk_size/4; i++) {
buf[i*2] = tmp[i];
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 06a9e15cc..60b15f0f6 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -378,7 +378,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
}
case AVMEDIA_TYPE_VIDEO:{
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
- const int32_t *disp_matrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+ const int32_t *disp_matrix = (const int32_t *)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
sh_video_t* sh_video;
BITMAPINFOHEADER *bih;
sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
diff --git a/libmpdemux/muxer_avi.c b/libmpdemux/muxer_avi.c
index 78a666770..912e6cde2 100644
--- a/libmpdemux/muxer_avi.c
+++ b/libmpdemux/muxer_avi.c
@@ -142,8 +142,8 @@ static muxer_stream_t* avifile_new_stream(muxer_t *muxer,int type){
static void write_avi_chunk(stream_t *stream,unsigned int id,int len,void* data){
int le_len = le2me_32(len);
int le_id = le2me_32(id);
- stream_write_buffer(stream, &le_id, 4);
- stream_write_buffer(stream, &le_len, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_len, 4);
if(len>0){
if(data){
@@ -176,9 +176,9 @@ static void write_avi_list(stream_t *stream, unsigned int id, int len)
list_id = le2me_32(list_id);
le_len = le2me_32(len);
le_id = le2me_32(id);
- stream_write_buffer(stream, &list_id, 4);
- stream_write_buffer(stream, &le_len, 4);
- stream_write_buffer(stream, &le_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&list_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_len, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_id, 4);
}
static void avifile_odml_new_riff(muxer_t *muxer)
@@ -199,7 +199,7 @@ static void avifile_odml_new_riff(muxer_t *muxer)
riff[0]=le2me_32(mmioFOURCC('R','I','F','F'));
riff[1]=0;
riff[2]=le2me_32(mmioFOURCC('A','V','I','X'));
- stream_write_buffer(muxer->stream, riff, 12);
+ stream_write_buffer(muxer->stream, (unsigned char *)riff, 12);
write_avi_list(muxer->stream,listtypeAVIMOVIE,0);
@@ -251,12 +251,12 @@ static void avifile_write_header(muxer_t *muxer){
movilen = le2me_32(rifflen - 12);
rifflen = le2me_32(rifflen);
stream_seek(muxer->stream, vsi->riffofs[i]+4);
- stream_write_buffer(muxer->stream,&rifflen,4);
+ stream_write_buffer(muxer->stream,(unsigned char *)&rifflen,4);
/* fixup movi length */
if (i > 0) {
stream_seek(muxer->stream, vsi->riffofs[i]+16);
- stream_write_buffer(muxer->stream,&movilen,4);
+ stream_write_buffer(muxer->stream,(unsigned char *)&movilen,4);
}
}
@@ -269,7 +269,7 @@ static void avifile_write_header(muxer_t *muxer){
riff[0]=le2me_32(riff[0]);
riff[1]=le2me_32(riff[1]);
riff[2]=le2me_32(riff[2]);
- stream_write_buffer(muxer->stream,&riff,12);
+ stream_write_buffer(muxer->stream,(unsigned char *)&riff,12);
}
// update AVI header:
@@ -406,7 +406,7 @@ static void avifile_write_header(muxer_t *muxer){
idxhdr[6] = 0;
idxhdr[7] = 0;
- stream_write_buffer(muxer->stream,idxhdr,sizeof(idxhdr));
+ stream_write_buffer(muxer->stream,(unsigned char *)idxhdr,sizeof(idxhdr));
for (j=0; j<n; j++) {
struct avi_odmlsuperidx_entry *entry = &si->superidx[j];
unsigned int data[4];
@@ -414,7 +414,7 @@ static void avifile_write_header(muxer_t *muxer){
data[1] = le2me_32(entry->ofs >> 32);
data[2] = le2me_32(entry->len);
data[3] = le2me_32(entry->duration);
- stream_write_buffer(muxer->stream,data,sizeof(data));
+ stream_write_buffer(muxer->stream,(unsigned char *)data,sizeof(data));
}
}
}
@@ -642,13 +642,13 @@ static void avifile_odml_write_index(muxer_t *muxer){
si->superidx[j].ofs = stream_tell(muxer->stream);
si->superidx[j].duration = duration;
- stream_write_buffer(muxer->stream, idxhdr,sizeof(idxhdr));
+ stream_write_buffer(muxer->stream, (unsigned char *)idxhdr,sizeof(idxhdr));
for (k=0; k<entries_per_subidx && idxpos<si->idxpos; k++) {
unsigned int entry[2];
entry[0] = le2me_32(si->idx[idxpos].ofs - start);
entry[1] = le2me_32(si->idx[idxpos].len | si->idx[idxpos].flags);
idxpos++;
- stream_write_buffer(muxer->stream, entry, sizeof(entry));
+ stream_write_buffer(muxer->stream, (unsigned char *)entry, sizeof(entry));
}
}
}
diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c
index 19fa9e956..a78c1c366 100644
--- a/libmpdemux/muxer_lavf.c
+++ b/libmpdemux/muxer_lavf.c
@@ -77,7 +77,7 @@ const m_option_t lavfopts_conf[] = {
{NULL, NULL, 0, 0, 0, 0, NULL}
};
-static int mp_write(void *opaque, uint8_t *buf, int size)
+static int mp_write(void *opaque, const uint8_t *buf, int size)
{
muxer_t *muxer = opaque;
return stream_write_buffer(muxer->stream, buf, size);
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index f59309bde..42d08123d 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -2239,7 +2239,7 @@ static XVisualInfo *getWindowVisualInfo(Window win) {
XVisualInfo vinfo_template;
int tmp;
if (!XGetWindowAttributes(mDisplay, win, &xw_attr))
- return DefaultVisual(mDisplay, 0);
+ vinfo_template.visualid = XVisualIDFromVisual(DefaultVisual(mDisplay, 0));
vinfo_template.visualid = XVisualIDFromVisual(xw_attr.visual);
return XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp);
}
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
index dc805be5b..4d5bcaad4 100644
--- a/libvo/vo_aa.c
+++ b/libvo/vo_aa.c
@@ -357,7 +357,7 @@ draw_frame(uint8_t *src[]) {
break;
}
- sws_scale(sws,src,stride,0,src_height,image,image_stride);
+ sws_scale(sws,(const uint8_t * const *)src,stride,0,src_height,image,image_stride);
/* Now 'ASCIInate' the image */
if (fast)
@@ -377,7 +377,7 @@ draw_slice(uint8_t *src[], int stride[],
int dx2 = screen_x + ((x+w) * screen_w / src_width);
int dy2 = screen_y + ((y+h) * screen_h / src_height);
- sws_scale(sws,src,stride,y,h,image,image_stride);
+ sws_scale(sws,(const uint8_t * const *)src,stride,y,h,image,image_stride);
/* Now 'ASCIInate' the image */
if (fast)
diff --git a/libvo/vo_matrixview.c b/libvo/vo_matrixview.c
index ee2735b1c..716f1c2a1 100644
--- a/libvo/vo_matrixview.c
+++ b/libvo/vo_matrixview.c
@@ -170,7 +170,7 @@ static void flip_page(void)
static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
{
- sws_scale(sws, src, stride, y, h, map_image, map_stride);
+ sws_scale(sws, (const uint8_t * const *)src, stride, y, h, map_image, map_stride);
return 0;
}
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index c3ec528a4..c3381ef8f 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -492,7 +492,7 @@ static int draw_slice(uint8_t * src[], int stride[], int w, int h,
dst[0] += dstStride[0] * (image_height - 1);
dstStride[0] = -dstStride[0];
}
- sws_scale(swsContext, src, stride, y, h, dst, dstStride);
+ sws_scale(swsContext, (const uint8_t * const *)src, stride, y, h, dst, dstStride);
return 0;
}
diff --git a/loader/qtx/qtxsdk/components.h b/loader/qtx/qtxsdk/components.h
index 5ad7572d8..177ddc430 100644
--- a/loader/qtx/qtxsdk/components.h
+++ b/loader/qtx/qtxsdk/components.h
@@ -780,7 +780,7 @@ static inline void dump_CodecDecompressParams(void* xxx){
printf("dstrect: %d;%d - %d;%d\n",cd->dstRect.top,cd->dstRect.left,cd->dstRect.bottom,cd->dstRect.right);
printf("wantedDestinationPixelTypes=%p\n",cd->wantedDestinationPixelTypes);
if(cd->wantedDestinationPixelTypes){
- unsigned int* p=cd->wantedDestinationPixelTypes;
+ unsigned int* p=(unsigned int*)cd->wantedDestinationPixelTypes;
while(p[0]){
printf(" 0x%08X %p\n",p[0],&p[0]);
++p;
diff --git a/mp_msg.c b/mp_msg.c
index 67bcc067d..3b059801a 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -70,7 +70,7 @@ const char* filename_recode(const char* filename)
filename_len = strlen(filename);
max_path = MSGSIZE_MAX - 4;
precoded = recoded_filename;
- if (iconv(inv_msgiconv, &filename, &filename_len,
+ if (iconv(inv_msgiconv, (char **)&filename, &filename_len,
&precoded, &max_path) == (size_t)(-1) && errno == E2BIG) {
precoded[0] = precoded[1] = precoded[2] = '.';
precoded += 3;
diff --git a/mplayer.c b/mplayer.c
index b4411cef2..a8c4ef17d 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3536,7 +3536,7 @@ goto_enable_cache:
break;
if ((mpctx->demuxer->file_format == DEMUXER_TYPE_AVI || mpctx->demuxer->file_format == DEMUXER_TYPE_ASF || mpctx->demuxer->file_format == DEMUXER_TYPE_MOV)
&& stream_dump_type == 2)
- stream_write_buffer(os, &in_size, 4);
+ stream_write_buffer(os, (unsigned char *)&in_size, 4);
if (in_size > 0) {
stream_write_buffer(os, start, in_size);
stream_dump_progress(in_size, mpctx->stream);
diff --git a/sub/spudec.c b/sub/spudec.c
index eefc235d4..515e88b96 100644
--- a/sub/spudec.c
+++ b/sub/spudec.c
@@ -899,7 +899,7 @@ static void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh,
ctx=sws_getContext(sw, sh, AV_PIX_FMT_GRAY8, dw, dh, AV_PIX_FMT_GRAY8, SWS_GAUSS, &filter, NULL, NULL);
sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds);
for (i=ss*sh-1; i>=0; i--) s2[i] = -s2[i];
- sws_scale(ctx,&s2,&ss,0,sh,&d2,&ds);
+ sws_scale(ctx,(const uint8_t * const *)&s2,&ss,0,sh,&d2,&ds);
for (i=ds*dh-1; i>=0; i--) d2[i] = -d2[i];
sws_freeContext(ctx);
}
diff --git a/sub/sub.c b/sub/sub.c
index 142242179..c03302992 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -727,7 +727,7 @@ static inline void vo_update_text_sub(mp_osd_obj_t *obj, int dxs, int dys)
// reading the subtitle words from vo_sub->text[]
while (*t) {
if (sub_utf8)
- c = utf8_get_char(&t);
+ c = utf8_get_char((const char**)&t);
else if ((c = *t++) >= 0x80 && sub_unicode)
c = (c<<8) + *t++;
if (k==MAX_UCS){
--
More information about the MPlayer-dev-eng
mailing list