Revision 3c71bc55

View differences:

libavcodec/pcx.c
42 42
/**
43 43
 * @return advanced src pointer
44 44
 */
45
static char *pcx_rle_decode(uint8_t *src, uint8_t *dst,
45
static const char *pcx_rle_decode(const uint8_t *src, uint8_t *dst,
46 46
                            unsigned int bytes_per_scanline) {
47 47
    unsigned int i = 0;
48 48
    unsigned char run, value;
......
61 61
    return src;
62 62
}
63 63

  
64
static void pcx_palette(uint8_t **src, uint32_t *dst, unsigned int pallen) {
64
static void pcx_palette(const uint8_t **src, uint32_t *dst, unsigned int pallen) {
65 65
    unsigned int i;
66 66

  
67 67
    for (i=0; i<pallen; i++)
......
70 70
}
71 71

  
72 72
static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
73
                            uint8_t *buf, int buf_size) {
73
                            const uint8_t *buf, int buf_size) {
74 74
    PCXContext * const s = avctx->priv_data;
75 75
    AVFrame *picture = data;
76 76
    AVFrame * const p = &s->picture;
77 77
    int xmin, ymin, xmax, ymax;
78 78
    unsigned int w, h, bits_per_pixel, bytes_per_line, nplanes, stride, y, x,
79 79
                 bytes_per_scanline;
80
    uint8_t *ptr, *bufstart = buf;
80
    uint8_t *ptr;
81
    uint8_t const *bufstart = buf;
81 82

  
82 83
    if (buf[0] != 0x0a || buf[1] > 5 || buf[1] == 1 || buf[2] != 1) {
83 84
        av_log(avctx, AV_LOG_ERROR, "this is not PCX encoded data\n");
......
161 162

  
162 163
    } else if (nplanes == 1 && bits_per_pixel == 8) {
163 164
        uint8_t scanline[bytes_per_scanline];
164
        uint8_t *palstart = bufstart + buf_size - 769;
165
        const uint8_t *palstart = bufstart + buf_size - 769;
165 166

  
166 167
        for (y=0; y<h; y++, ptr+=stride) {
167 168
            buf = pcx_rle_decode(buf, scanline, bytes_per_scanline);
......
213 214
    if (nplanes == 1 && bits_per_pixel == 8) {
214 215
        pcx_palette(&buf, (uint32_t *) p->data[1], 256);
215 216
    } else if (bits_per_pixel < 8) {
216
        uint8_t *palette = bufstart+16;
217
        const uint8_t *palette = bufstart+16;
217 218
        pcx_palette(&palette, (uint32_t *) p->data[1], 16);
218 219
    }
219 220

  

Also available in: Unified diff