Browse code

Do not misuse unsigned long to store pointers.

Originally committed as revision 16986 to svn://svn.ffmpeg.org/ffmpeg/trunk

Ramiro Polla authored on 2009/02/04 14:56:39
Showing 2 changed files
... ...
@@ -1197,7 +1197,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
1197 1197
 
1198 1198
 #ifdef HAVE_AV_CONFIG_H
1199 1199
 
1200
-void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem);
1200
+void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
1201 1201
 
1202 1202
 #ifdef __GNUC__
1203 1203
 #define dynarray_add(tab, nb_ptr, elem)\
... ...
@@ -1205,12 +1205,12 @@ do {\
1205 1205
     __typeof__(tab) _tab = (tab);\
1206 1206
     __typeof__(elem) _elem = (elem);\
1207 1207
     (void)sizeof(**_tab == _elem); /* check that types are compatible */\
1208
-    ff_dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\
1208
+    ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
1209 1209
 } while(0)
1210 1210
 #else
1211 1211
 #define dynarray_add(tab, nb_ptr, elem)\
1212 1212
 do {\
1213
-    ff_dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\
1213
+    ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
1214 1214
 } while(0)
1215 1215
 #endif
1216 1216
 
... ...
@@ -21,10 +21,10 @@
21 21
 #include "avformat.h"
22 22
 
23 23
 /* add one element to a dynamic array */
24
-void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem)
24
+void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
25 25
 {
26 26
     int nb, nb_alloc;
27
-    unsigned long *tab;
27
+    intptr_t *tab;
28 28
 
29 29
     nb = *nb_ptr;
30 30
     tab = *tab_ptr;
... ...
@@ -33,7 +33,7 @@ void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem)
33 33
             nb_alloc = 1;
34 34
         else
35 35
             nb_alloc = nb * 2;
36
-        tab = av_realloc(tab, nb_alloc * sizeof(unsigned long));
36
+        tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
37 37
         *tab_ptr = tab;
38 38
     }
39 39
     tab[nb++] = elem;