mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-08 16:54:03 +02:00
Do not misuse unsigned long to store pointers.
Originally committed as revision 16986 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
5a897cfa3c
commit
2db5da97e2
@ -1197,7 +1197,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
|
|||||||
|
|
||||||
#ifdef HAVE_AV_CONFIG_H
|
#ifdef HAVE_AV_CONFIG_H
|
||||||
|
|
||||||
void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem);
|
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define dynarray_add(tab, nb_ptr, elem)\
|
#define dynarray_add(tab, nb_ptr, elem)\
|
||||||
@ -1205,12 +1205,12 @@ do {\
|
|||||||
__typeof__(tab) _tab = (tab);\
|
__typeof__(tab) _tab = (tab);\
|
||||||
__typeof__(elem) _elem = (elem);\
|
__typeof__(elem) _elem = (elem);\
|
||||||
(void)sizeof(**_tab == _elem); /* check that types are compatible */\
|
(void)sizeof(**_tab == _elem); /* check that types are compatible */\
|
||||||
ff_dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\
|
ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
|
||||||
} while(0)
|
} while(0)
|
||||||
#else
|
#else
|
||||||
#define dynarray_add(tab, nb_ptr, elem)\
|
#define dynarray_add(tab, nb_ptr, elem)\
|
||||||
do {\
|
do {\
|
||||||
ff_dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\
|
ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
|
||||||
} while(0)
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
|
|
||||||
/* add one element to a dynamic array */
|
/* add one element to a dynamic array */
|
||||||
void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem)
|
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
|
||||||
{
|
{
|
||||||
int nb, nb_alloc;
|
int nb, nb_alloc;
|
||||||
unsigned long *tab;
|
intptr_t *tab;
|
||||||
|
|
||||||
nb = *nb_ptr;
|
nb = *nb_ptr;
|
||||||
tab = *tab_ptr;
|
tab = *tab_ptr;
|
||||||
@ -33,7 +33,7 @@ void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem)
|
|||||||
nb_alloc = 1;
|
nb_alloc = 1;
|
||||||
else
|
else
|
||||||
nb_alloc = nb * 2;
|
nb_alloc = nb * 2;
|
||||||
tab = av_realloc(tab, nb_alloc * sizeof(unsigned long));
|
tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
|
||||||
*tab_ptr = tab;
|
*tab_ptr = tab;
|
||||||
}
|
}
|
||||||
tab[nb++] = elem;
|
tab[nb++] = elem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user