Mercurial > libavformat.hg
changeset 4375:ecc817a37849 libavformat
Do not misuse unsigned long to store pointers.
author | ramiro |
---|---|
date | Wed, 04 Feb 2009 05:56:39 +0000 |
parents | 1664a812629f |
children | 2b46680bf82f |
files | avformat.h cutils.c |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/avformat.h Wed Feb 04 04:50:47 2009 +0000 +++ b/avformat.h Wed Feb 04 05:56:39 2009 +0000 @@ -1197,7 +1197,7 @@ #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__ #define dynarray_add(tab, nb_ptr, elem)\ @@ -1205,12 +1205,12 @@ __typeof__(tab) _tab = (tab);\ __typeof__(elem) _elem = (elem);\ (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) #else #define dynarray_add(tab, nb_ptr, elem)\ 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) #endif
--- a/cutils.c Wed Feb 04 04:50:47 2009 +0000 +++ b/cutils.c Wed Feb 04 05:56:39 2009 +0000 @@ -21,10 +21,10 @@ #include "avformat.h" /* 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; - unsigned long *tab; + intptr_t *tab; nb = *nb_ptr; tab = *tab_ptr; @@ -33,7 +33,7 @@ nb_alloc = 1; else 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[nb++] = elem;