diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-12-04 04:00:21 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-12-04 04:00:21 +0000 |
commit | 372c3f82b7d73a4bab570f357cfb299c2531a95b (patch) | |
tree | e61bff34c2cc0ba598b4d0fad1137431f8113c4f /libavcodec/utils.c | |
parent | b47541c7a38de186e85f728fd54f1a9ec6b88688 (diff) | |
download | ffmpeg-372c3f82b7d73a4bab570f357cfb299c2531a95b.tar.gz |
Change the argument of memory allocation functions from unsigned int to size_t
with the next major bump in libavcodec.
Originally committed as revision 25872 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4a713136a0..69d333eabc 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -48,29 +48,32 @@ static int volatile entangled_thread_counter=0; int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op); static void *codec_mutex; -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) +void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) { if(min_size < *size) return ptr; - *size= FFMAX(17*min_size/16 + 32, min_size); + min_size= FFMAX(17*min_size/16 + 32, min_size); - ptr= av_realloc(ptr, *size); + ptr= av_realloc(ptr, min_size); if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now - *size= 0; + min_size= 0; + + *size= min_size; return ptr; } -void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size) +void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) { void **p = ptr; if (min_size < *size) return; - *size= FFMAX(17*min_size/16 + 32, min_size); + min_size= FFMAX(17*min_size/16 + 32, min_size); av_free(*p); - *p = av_malloc(*size); - if (!*p) *size = 0; + *p = av_malloc(min_size); + if (!*p) min_size = 0; + *size= min_size; } /* encoder management */ |