Revision 08c8e66a libavformat/http.c

View differences:

libavformat/http.c
394 394
    HTTPContext *s = h->priv_data;
395 395
    URLContext *old_hd = s->hd;
396 396
    int64_t old_off = s->off;
397
    uint8_t old_buf[BUFFER_SIZE];
398
    int old_buf_size;
397 399

  
398 400
    if (whence == AVSEEK_SIZE)
399 401
        return s->filesize;
......
401 403
        return -1;
402 404

  
403 405
    /* we save the old context in case the seek fails */
406
    old_buf_size = s->buf_end - s->buf_ptr;
407
    memcpy(old_buf, s->buf_ptr, old_buf_size);
404 408
    s->hd = NULL;
405 409
    if (whence == SEEK_CUR)
406 410
        off += s->off;
......
410 414

  
411 415
    /* if it fails, continue on old connection */
412 416
    if (http_open_cnx(h) < 0) {
417
        memcpy(s->buffer, old_buf, old_buf_size);
418
        s->buf_ptr = s->buffer;
419
        s->buf_end = s->buffer + old_buf_size;
413 420
        s->hd = old_hd;
414 421
        s->off = old_off;
415 422
        return -1;

Also available in: Unified diff