Revision 490a022d

View differences:

libavutil/error.h
37 37
#define AVUNERROR(e) (e)
38 38
#endif
39 39

  
40
#if LIBAVUTIL_VERSION_MAJOR < 51
41
#define AVERROR_INVALIDDATA AVERROR(EINVAL)  ///< Invalid data found when processing input
42
#define AVERROR_IO          AVERROR(EIO)     ///< I/O error
43
#define AVERROR_NOENT       AVERROR(ENOENT)  ///< No such file or directory
44
#define AVERROR_NOFMT       AVERROR(EILSEQ)  ///< Unknown format
45
#define AVERROR_NOMEM       AVERROR(ENOMEM)  ///< Not enough memory
46
#define AVERROR_NOTSUPP     AVERROR(ENOSYS)  ///< Operation not supported
47
#define AVERROR_NUMEXPECTED AVERROR(EDOM)    ///< Number syntax expected in filename
48
#define AVERROR_UNKNOWN     AVERROR(EINVAL)  ///< Unknown error
49
#endif
50

  
51 40
#define AVERROR_EOF         AVERROR(EPIPE)   ///< End of file
52 41

  
53 42
#define AVERROR_PATCHWELCOME    (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome
54 43

  
55
#if LIBAVUTIL_VERSION_MAJOR > 50
56 44
#define AVERROR_INVALIDDATA     (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input
57 45
#define AVERROR_NUMEXPECTED     (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename
58
#endif
59 46

  
60 47
#define AVERROR_DEMUXER_NOT_FOUND  (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
61 48
#define AVERROR_MUXER_NOT_FOUND    (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found
libavutil/file.c
47 47
    av_unused void *ptr;
48 48
    off_t off_size;
49 49
    char errbuf[128];
50
    size_t max_size = HAVE_MMAP ? SIZE_MAX : FF_INTERNAL_MEM_TYPE_MAX_VALUE;
51 50
    *bufptr = NULL;
52 51

  
53 52
    if (fd < 0) {
......
66 65
    }
67 66

  
68 67
    off_size = st.st_size;
69
    if (off_size > max_size) {
68
    if (off_size > SIZE_MAX) {
70 69
        av_log(&file_log_ctx, AV_LOG_ERROR,
71 70
               "File size for file '%s' is too big\n", filename);
72 71
        close(fd);
libavutil/log.c
29 29
#include "avutil.h"
30 30
#include "log.h"
31 31

  
32
#if LIBAVUTIL_VERSION_MAJOR > 50
33
static
34
#endif
35
int av_log_level = AV_LOG_INFO;
32
static int av_log_level = AV_LOG_INFO;
36 33
static int flags;
37 34

  
38 35
#if defined(_WIN32) && !defined(__MINGW32CE__)
libavutil/mem.c
61 61
   memory allocator. You do not need to suppress this file because the
62 62
   linker will do it automatically. */
63 63

  
64
void *av_malloc(FF_INTERNAL_MEM_TYPE size)
64
void *av_malloc(size_t size)
65 65
{
66 66
    void *ptr = NULL;
67 67
#if CONFIG_MEMALIGN_HACK
......
116 116
    return ptr;
117 117
}
118 118

  
119
void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
119
void *av_realloc(void *ptr, size_t size)
120 120
{
121 121
#if CONFIG_MEMALIGN_HACK
122 122
    int diff;
......
153 153
    *ptr = NULL;
154 154
}
155 155

  
156
void *av_mallocz(FF_INTERNAL_MEM_TYPE size)
156
void *av_mallocz(size_t size)
157 157
{
158 158
    void *ptr = av_malloc(size);
159 159
    if (ptr)
libavutil/mem.h
62 62
    #define av_alloc_size(n)
63 63
#endif
64 64

  
65
#if LIBAVUTIL_VERSION_MAJOR < 51
66
#   define FF_INTERNAL_MEM_TYPE unsigned int
67
#   define FF_INTERNAL_MEM_TYPE_MAX_VALUE UINT_MAX
68
#else
69
#   define FF_INTERNAL_MEM_TYPE size_t
70
#   define FF_INTERNAL_MEM_TYPE_MAX_VALUE SIZE_MAX
71
#endif
72

  
73 65
/**
74 66
 * Allocate a block of size bytes with alignment suitable for all
75 67
 * memory accesses (including vectors if available on the CPU).
......
78 70
 * be allocated.
79 71
 * @see av_mallocz()
80 72
 */
81
void *av_malloc(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1);
73
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
82 74

  
83 75
/**
84 76
 * Allocate or reallocate a block of memory.
......
92 84
 * cannot be reallocated or the function is used to free the memory block.
93 85
 * @see av_fast_realloc()
94 86
 */
95
void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) av_alloc_size(2);
87
void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
96 88

  
97 89
/**
98 90
 * Free a memory block which has been allocated with av_malloc(z)() or
......
112 104
 * @return Pointer to the allocated block, NULL if it cannot be allocated.
113 105
 * @see av_malloc()
114 106
 */
115
void *av_mallocz(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1);
107
void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
116 108

  
117 109
/**
118 110
 * Duplicate the string s.

Also available in: Unified diff