Revision 66e5b1df

View differences:

ffplay.c
2568 2568
        }
2569 2569
        ret = av_read_frame(ic, pkt);
2570 2570
        if (ret < 0) {
2571
            if (ret == AVERROR_EOF || url_feof(ic->pb))
2571
            if (ret == AVERROR_EOF || ic->pb->eof_reached)
2572 2572
                eof=1;
2573 2573
            if (url_ferror(ic->pb))
2574 2574
                break;
libavformat/4xm.c
259 259
            return ret;
260 260
        fourcc_tag = AV_RL32(&header[0]);
261 261
        size = AV_RL32(&header[4]);
262
        if (url_feof(pb))
262
        if (pb->eof_reached)
263 263
            return AVERROR(EIO);
264 264
        switch (fourcc_tag) {
265 265

  
libavformat/aiffdec.c
51 51
{
52 52
    int size;
53 53

  
54
    if (url_feof(pb))
54
    if (pb->eof_reached)
55 55
        return AVERROR(EIO);
56 56

  
57 57
    *tag = avio_rl32(pb);
libavformat/amr.c
122 122
    AVCodecContext *enc = s->streams[0]->codec;
123 123
    int read, size = 0, toc, mode;
124 124

  
125
    if (url_feof(s->pb))
125
    if (s->pb->eof_reached)
126 126
    {
127 127
        return AVERROR(EIO);
128 128
    }
libavformat/anm.c
181 181
    Page *p;
182 182
    int tmp, record_size;
183 183

  
184
    if (url_feof(s->pb))
184
    if (s->pb->eof_reached)
185 185
        return AVERROR(EIO);
186 186

  
187 187
    if (anm->page < 0)
libavformat/ape.c
337 337
    APEContext *ape = s->priv_data;
338 338
    uint32_t extra_size = 8;
339 339

  
340
    if (url_feof(s->pb))
340
    if (s->pb->eof_reached)
341 341
        return AVERROR(EIO);
342 342
    if (ape->currentframe > ape->totalframes)
343 343
        return AVERROR(EIO);
libavformat/applehttp.c
224 224
    if (var)
225 225
        free_segment_list(var);
226 226
    c->finished = 0;
227
    while (!url_feof(in)) {
227
    while (!in->eof_reached) {
228 228
        read_chomp_line(in, line, sizeof(line));
229 229
        if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
230 230
            struct variant_info info = {{0}};
......
457 457
        if (var->pb && !var->pkt.data) {
458 458
            ret = av_read_frame(var->ctx, &var->pkt);
459 459
            if (ret < 0) {
460
                if (!url_feof(var->pb))
460
                if (!var->pb->eof_reached)
461 461
                    return ret;
462 462
                reset_packet(&var->pkt);
463 463
            }
libavformat/applehttpproto.c
174 174

  
175 175
    free_segment_list(s);
176 176
    s->finished = 0;
177
    while (!url_feof(in)) {
177
    while (!in->eof_reached) {
178 178
        read_chomp_line(in, line, sizeof(line));
179 179
        if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
180 180
            struct variant_info info = {{0}};
libavformat/asfdec.c
639 639
            continue;
640 640
        } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
641 641
            asf_read_marker(s, gsize);
642
        } else if (url_feof(pb)) {
642
        } else if (pb->eof_reached) {
643 643
            return -1;
644 644
        } else {
645 645
            if (!s->keylen) {
......
660 660
    avio_rl64(pb);
661 661
    avio_r8(pb);
662 662
    avio_r8(pb);
663
    if (url_feof(pb))
663
    if (pb->eof_reached)
664 664
        return -1;
665 665
    asf->data_offset = avio_tell(pb);
666 666
    asf->packet_size_left = 0;
......
745 745
         */
746 746
        if (url_ferror(pb) == AVERROR(EAGAIN))
747 747
            return AVERROR(EAGAIN);
748
        if (!url_feof(pb))
748
        if (!pb->eof_reached)
749 749
            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, avio_tell(pb));
750 750
    }
751 751
    if ((c & 0x8f) == 0x82) {
752 752
        if (d || e) {
753
            if (!url_feof(pb))
753
            if (!pb->eof_reached)
754 754
                av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
755 755
            return -1;
756 756
        }
......
886 886
    ASFStream *asf_st = 0;
887 887
    for (;;) {
888 888
        int ret;
889
        if(url_feof(pb))
889
        if(pb->eof_reached)
890 890
            return AVERROR_EOF;
891 891
        if (asf->packet_size_left < FRAME_HEADER_SIZE
892 892
            || asf->packet_segments < 1) {
......
1195 1195
       skip them until the simple index object is reached */
1196 1196
    while (ff_guidcmp(&g, &index_guid)) {
1197 1197
        int64_t gsize= avio_rl64(s->pb);
1198
        if (gsize < 24 || url_feof(s->pb)) {
1198
        if (gsize < 24 || s->pb->eof_reached) {
1199 1199
            avio_seek(s->pb, current_pos, SEEK_SET);
1200 1200
            return;
1201 1201
        }
libavformat/assdec.c
92 92
    header_remaining= INT_MAX;
93 93
    dst[0] = &st->codec->extradata;
94 94
    dst[1] = &ass->event_buffer;
95
    while(!url_feof(pb)){
95
    while(!pb->eof_reached){
96 96
        uint8_t line[MAX_LINESIZE];
97 97

  
98 98
        len = ff_get_line(pb, line, sizeof(line));
libavformat/avidec.c
178 178
#ifdef DEBUG_SEEK
179 179
            av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
180 180
#endif
181
            if(url_feof(pb))
181
            if(pb->eof_reached)
182 182
                return -1;
183 183

  
184 184
            if(last_pos == pos || pos == base - 8)
......
195 195
            avio_rl32(pb);       /* size */
196 196
            duration = avio_rl32(pb);
197 197

  
198
            if(url_feof(pb))
198
            if(pb->eof_reached)
199 199
                return -1;
200 200

  
201 201
            pos = avio_tell(pb);
......
360 360
    codec_type = -1;
361 361
    frame_period = 0;
362 362
    for(;;) {
363
        if (url_feof(pb))
363
        if (pb->eof_reached)
364 364
            goto fail;
365 365
        tag = avio_rl32(pb);
366 366
        size = avio_rl32(pb);
......
989 989
    }
990 990

  
991 991
    memset(d, -1, sizeof(int)*8);
992
    for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
992
    for(i=sync=avio_tell(pb); !pb->eof_reached; i++) {
993 993
        int j;
994 994

  
995 995
        for(j=0; j<7; j++)
......
1145 1145
#if defined(DEBUG_SEEK)
1146 1146
        av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
1147 1147
#endif
1148
        if(url_feof(pb))
1148
        if(pb->eof_reached)
1149 1149
            return -1;
1150 1150

  
1151 1151
        if(last_pos == pos)
......
1203 1203
    printf("movi_end=0x%"PRIx64"\n", avi->movi_end);
1204 1204
#endif
1205 1205
    for(;;) {
1206
        if (url_feof(pb))
1206
        if (pb->eof_reached)
1207 1207
            break;
1208 1208
        tag = avio_rl32(pb);
1209 1209
        size = avio_rl32(pb);
libavformat/avio.h
432 432
/**
433 433
 * @}
434 434
 */
435

  
436
/**
437
 * @deprecated use AVIOContext.eof_reached
438
 */
439
attribute_deprecated int url_feof(AVIOContext *s);
435 440
#endif
436 441

  
437 442
AVIOContext *avio_alloc_context(
......
494 499
 */
495 500
int64_t avio_size(AVIOContext *s);
496 501

  
497
/**
498
 * feof() equivalent for AVIOContext.
499
 * @return non zero if and only if end of file
500
 */
501
int url_feof(AVIOContext *s);
502

  
503 502
int url_ferror(AVIOContext *s);
504 503

  
505 504
int av_url_read_fpause(AVIOContext *h, int pause);
libavformat/aviobuf.c
265 265
    return size;
266 266
}
267 267

  
268
#if FF_API_OLD_AVIO
268 269
int url_feof(AVIOContext *s)
269 270
{
270 271
    if(!s)
271 272
        return 0;
272 273
    return s->eof_reached;
273 274
}
275
#endif
274 276

  
275 277
int url_ferror(AVIOContext *s)
276 278
{
......
598 600
    }
599 601
    if (size1 == size) {
600 602
        if (url_ferror(s)) return url_ferror(s);
601
        if (url_feof(s))   return AVERROR_EOF;
603
        if (s->eof_reached)   return AVERROR_EOF;
602 604
    }
603 605
    return size1 - size;
604 606
}
......
621 623
    s->buf_ptr += len;
622 624
    if (!len) {
623 625
        if (url_ferror(s)) return url_ferror(s);
624
        if (url_feof(s))   return AVERROR_EOF;
626
        if (s->eof_reached)   return AVERROR_EOF;
625 627
    }
626 628
    return len;
627 629
}
......
928 930
    char *q;
929 931

  
930 932
    c = avio_r8(s);
931
    if (url_feof(s))
933
    if (s->eof_reached)
932 934
        return NULL;
933 935
    q = buf;
934 936
    for(;;) {
935
        if (url_feof(s) || c == '\n')
937
        if (s->eof_reached || c == '\n')
936 938
            break;
937 939
        if ((q - buf) < buf_size - 1)
938 940
            *q++ = c;
libavformat/bethsoftvid.c
179 179
    int audio_length;
180 180
    int ret_value;
181 181

  
182
    if(vid->is_finished || url_feof(pb))
182
    if(vid->is_finished || pb->eof_reached)
183 183
        return AVERROR(EIO);
184 184

  
185 185
    block_type = avio_r8(pb);
libavformat/bfi.c
109 109
    BFIContext *bfi = s->priv_data;
110 110
    AVIOContext *pb = s->pb;
111 111
    int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
112
    if (bfi->nframes == 0 || url_feof(pb)) {
112
    if (bfi->nframes == 0 || pb->eof_reached) {
113 113
        return AVERROR(EIO);
114 114
    }
115 115

  
......
117 117
    if (!bfi->avflag) {
118 118
        uint32_t state = 0;
119 119
        while(state != MKTAG('S','A','V','I')){
120
            if (url_feof(pb))
120
            if (pb->eof_reached)
121 121
                return AVERROR(EIO);
122 122
            state = 256*state + avio_r8(pb);
123 123
        }
libavformat/cafdec.c
219 219

  
220 220
    /* parse each chunk */
221 221
    found_data = 0;
222
    while (!url_feof(pb)) {
222
    while (!pb->eof_reached) {
223 223

  
224 224
        /* stop at data chunk if seeking is not supported or
225 225
           data chunk size is unknown */
......
228 228

  
229 229
        tag  = avio_rb32(pb);
230 230
        size = avio_rb64(pb);
231
        if (url_feof(pb))
231
        if (pb->eof_reached)
232 232
            break;
233 233

  
234 234
        switch (tag) {
......
307 307
    int res, pkt_size = 0, pkt_frames = 0;
308 308
    int64_t left      = CAF_MAX_PKT_SIZE;
309 309

  
310
    if (url_feof(pb))
310
    if (pb->eof_reached)
311 311
        return AVERROR(EIO);
312 312

  
313 313
    /* don't read past end of data chunk */
libavformat/daud.c
38 38
static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
39 39
    AVIOContext *pb = s->pb;
40 40
    int ret, size;
41
    if (url_feof(pb))
41
    if (pb->eof_reached)
42 42
        return AVERROR(EIO);
43 43
    size = avio_rb16(pb);
44 44
    avio_rb16(pb); // unknown
libavformat/dsicin.c
147 147
    hdr->video_frame_size = avio_rl32(pb);
148 148
    hdr->audio_frame_size = avio_rl32(pb);
149 149

  
150
    if (url_feof(pb) || url_ferror(pb))
150
    if (pb->eof_reached || url_ferror(pb))
151 151
        return AVERROR(EIO);
152 152

  
153 153
    if (avio_rl32(pb) != 0xAA55AA55)
libavformat/dv.c
412 412

  
413 413
    state = avio_rb32(s->pb);
414 414
    while ((state & 0xffffff7f) != 0x1f07003f) {
415
        if (url_feof(s->pb)) {
415
        if (s->pb->eof_reached) {
416 416
            av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
417 417
            return -1;
418 418
        }
libavformat/dxa.c
104 104
            return -1;
105 105
        ff_get_wav_header(pb, ast->codec, fsize);
106 106
        // find 'data' chunk
107
        while(avio_tell(pb) < c->vidpos && !url_feof(pb)){
107
        while(avio_tell(pb) < c->vidpos && !pb->eof_reached){
108 108
            tag = avio_rl32(pb);
109 109
            fsize = avio_rl32(pb);
110 110
            if(tag == MKTAG('d', 'a', 't', 'a')) break;
......
162 162
        return 0;
163 163
    }
164 164
    avio_seek(s->pb, c->vidpos, SEEK_SET);
165
    while(!url_feof(s->pb) && c->frames){
165
    while(!s->pb->eof_reached && c->frames){
166 166
        avio_read(s->pb, buf, 4);
167 167
        switch(AV_RL32(buf)){
168 168
        case MKTAG('N', 'U', 'L', 'L'):
libavformat/electronicarts.c
109 109
    ea->sample_rate = -1;
110 110
    ea->num_channels = 1;
111 111

  
112
    while (!url_feof(pb) && inHeader) {
112
    while (!pb->eof_reached && inHeader) {
113 113
        int inSubheader;
114 114
        uint8_t byte;
115 115
        byte = avio_r8(pb);
......
118 118
        case 0xFD:
119 119
            av_log (s, AV_LOG_DEBUG, "entered audio subheader\n");
120 120
            inSubheader = 1;
121
            while (!url_feof(pb) && inSubheader) {
121
            while (!pb->eof_reached && inSubheader) {
122 122
                uint8_t subbyte;
123 123
                subbyte = avio_r8(pb);
124 124

  
libavformat/ffmdec.c
91 91
{
92 92
    av_log(s, AV_LOG_ERROR, "resyncing\n");
93 93
    while (state != PACKET_ID) {
94
        if (url_feof(s->pb)) {
94
        if (s->pb->eof_reached) {
95 95
            av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
96 96
            return -1;
97 97
        }
libavformat/ffmetadec.c
48 48
                buf[i++] = c;
49 49
        }
50 50
        buf[i] = 0;
51
    } while (!url_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
51
    } while (!s->eof_reached && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
52 52
}
53 53

  
54 54
static AVChapter *read_chapter(AVFormatContext *s)
......
126 126
    AVMetadata **m = &s->metadata;
127 127
    uint8_t line[1024];
128 128

  
129
    while(!url_feof(s->pb)) {
129
    while(!s->pb->eof_reached) {
130 130
        get_line(s->pb, line, sizeof(line));
131 131

  
132 132
        if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
libavformat/filmstripdec.c
80 80
    FilmstripDemuxContext *film = s->priv_data;
81 81
    AVStream *st = s->streams[0];
82 82

  
83
    if (url_feof(s->pb))
83
    if (s->pb->eof_reached)
84 84
        return AVERROR(EIO);
85 85
    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
86 86
    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
libavformat/flacdec.c
46 46
    }
47 47

  
48 48
    /* process metadata blocks */
49
    while (!url_feof(s->pb) && !metadata_last) {
49
    while (!s->pb->eof_reached && !metadata_last) {
50 50
        avio_read(s->pb, header, 4);
51 51
        ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
52 52
                                   &metadata_size);
libavformat/flvdec.c
311 311
    dts = avio_rb24(s->pb);
312 312
    dts |= avio_r8(s->pb) << 24;
313 313
//    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
314
    if (url_feof(s->pb))
314
    if (s->pb->eof_reached)
315 315
        return AVERROR_EOF;
316 316
    avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */
317 317
    flags = 0;
libavformat/gxf.c
368 368

  
369 369
#define READ_ONE() \
370 370
    { \
371
        if (!max_interval-- || url_feof(pb)) \
371
        if (!max_interval-- || pb->eof_reached) \
372 372
            goto out; \
373 373
        tmp = tmp << 8 | avio_r8(pb); \
374 374
    }
......
422 422
    AVIOContext *pb = s->pb;
423 423
    GXFPktType pkt_type;
424 424
    int pkt_len;
425
    while (!url_feof(pb)) {
425
    while (!pb->eof_reached) {
426 426
        AVStream *st;
427 427
        int track_type, track_id, ret;
428 428
        int field_nr, field_info, skip = 0;
429 429
        int stream_index;
430 430
        if (!parse_packet_header(pb, &pkt_type, &pkt_len)) {
431
            if (!url_feof(pb))
431
            if (!pb->eof_reached)
432 432
                av_log(s, AV_LOG_ERROR, "sync lost\n");
433 433
            return -1;
434 434
        }
libavformat/idcin.c
227 227
    unsigned char r, g, b;
228 228
    unsigned char palette_buffer[768];
229 229

  
230
    if (url_feof(s->pb))
230
    if (s->pb->eof_reached)
231 231
        return AVERROR(EIO);
232 232

  
233 233
    if (idcin->next_chunk_is_video) {
libavformat/idroqdec.c
111 111

  
112 112
    while (!packet_read) {
113 113

  
114
        if (url_feof(s->pb))
114
        if (s->pb->eof_reached)
115 115
            return AVERROR(EIO);
116 116

  
117 117
        /* get the next chunk preamble */
libavformat/iff.c
138 138
    // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
139 139
    st->codec->codec_tag = avio_rl32(pb);
140 140

  
141
    while(!url_feof(pb)) {
141
    while(!pb->eof_reached) {
142 142
        uint64_t orig_pos;
143 143
        int res;
144 144
        const char *metadata_tag = NULL;
libavformat/img2.c
287 287
            infer_size(&codec->width, &codec->height, size[0]);
288 288
    } else {
289 289
        f[0] = s1->pb;
290
        if (url_feof(f[0]))
290
        if (f[0]->eof_reached)
291 291
            return AVERROR(EIO);
292 292
        size[0]= 4096;
293 293
    }
libavformat/ipmovie.c
225 225
        return chunk_type;
226 226

  
227 227
    /* read the next chunk, wherever the file happens to be pointing */
228
    if (url_feof(pb))
228
    if (pb->eof_reached)
229 229
        return CHUNK_EOF;
230 230
    if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
231 231
        CHUNK_PREAMBLE_SIZE)
......
271 271
    while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
272 272

  
273 273
        /* read the next chunk, wherever the file happens to be pointing */
274
        if (url_feof(pb)) {
274
        if (pb->eof_reached) {
275 275
            chunk_type = CHUNK_EOF;
276 276
            break;
277 277
        }
......
532 532
    while (memcmp(signature_buffer, signature, sizeof(signature))) {
533 533
        memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
534 534
        signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
535
        if (url_feof(pb))
535
        if (pb->eof_reached)
536 536
            return AVERROR_EOF;
537 537
    }
538 538
    /* initialize private context members */
libavformat/lxfdec.c
90 90
        return ret < 0 ? ret : AVERROR_EOF;
91 91

  
92 92
    while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
93
        if (url_feof(s->pb))
93
        if (s->pb->eof_reached)
94 94
            return AVERROR_EOF;
95 95

  
96 96
        memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);
libavformat/matroskadec.c
548 548
     * use it safely here to catch EOS. */
549 549
    if (!(total = avio_r8(pb))) {
550 550
        /* we might encounter EOS here */
551
        if (!url_feof(pb)) {
551
        if (!pb->eof_reached) {
552 552
            int64_t pos = avio_tell(pb);
553 553
            av_log(matroska->ctx, AV_LOG_ERROR,
554 554
                   "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
libavformat/mmf.c
266 266
    AVStream *st;
267 267
    int ret, size;
268 268

  
269
    if (url_feof(s->pb))
269
    if (s->pb->eof_reached)
270 270
        return AVERROR(EIO);
271 271
    st = s->streams[0];
272 272

  
libavformat/mov.c
259 259

  
260 260
    if (atom.size < 0)
261 261
        atom.size = INT64_MAX;
262
    while (total_size + 8 < atom.size && !url_feof(pb)) {
262
    while (total_size + 8 < atom.size && !pb->eof_reached) {
263 263
        int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
264 264
        a.size = atom.size;
265 265
        a.type=0;
......
2411 2411
        mov->found_mdat = 0;
2412 2412
        if (!url_is_streamed(s->pb) ||
2413 2413
            mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
2414
            url_feof(s->pb))
2414
            s->pb->eof_reached)
2415 2415
            return AVERROR_EOF;
2416 2416
        av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb));
2417 2417
        goto retry;
libavformat/mpc8.c
200 200
        return -1;
201 201
    }
202 202

  
203
    while(!url_feof(pb)){
203
    while(!pb->eof_reached){
204 204
        pos = avio_tell(pb);
205 205
        mpc8_get_chunk_header(pb, &tag, &size);
206 206
        if(tag == TAG_STREAMHDR)
......
247 247
    int tag;
248 248
    int64_t pos, size;
249 249

  
250
    while(!url_feof(s->pb)){
250
    while(!s->pb->eof_reached){
251 251
        pos = avio_tell(s->pb);
252 252
        mpc8_get_chunk_header(s->pb, &tag, &size);
253 253
        if (size < 0)
libavformat/mpeg.c
143 143
    state = *header_state;
144 144
    n = *size_ptr;
145 145
    while (n > 0) {
146
        if (url_feof(pb))
146
        if (pb->eof_reached)
147 147
            break;
148 148
        v = avio_r8(pb);
149 149
        n--;
......
253 253
        last_sync = avio_tell(s->pb);
254 254
    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
255 255
    if (startcode < 0){
256
        if(url_feof(s->pb))
256
        if(s->pb->eof_reached)
257 257
            return AVERROR_EOF;
258 258
        //FIXME we should remember header_state
259 259
        return AVERROR(EAGAIN);
libavformat/mpegts.c
1329 1329

  
1330 1330
    for(i = 0;i < MAX_RESYNC_SIZE; i++) {
1331 1331
        c = avio_r8(pb);
1332
        if (url_feof(pb))
1332
        if (pb->eof_reached)
1333 1333
            return -1;
1334 1334
        if (c == 0x47) {
1335 1335
            avio_seek(pb, -1, SEEK_CUR);
libavformat/msnwc_tcp.c
88 88

  
89 89
    /* Some files start with "connected\r\n\r\n".
90 90
     * So skip until we find the first byte of struct size */
91
    while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb));
91
    while(avio_r8(pb) != HEADER_SIZE && !pb->eof_reached);
92 92

  
93
    if(url_feof(pb)) {
93
    if(pb->eof_reached) {
94 94
        av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
95 95
        return -1;
96 96
    }
libavformat/mxfdec.c
179 179
static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
180 180
{
181 181
    int i, b;
182
    for (i = 0; i < size && !url_feof(pb); i++) {
182
    for (i = 0; i < size && !pb->eof_reached; i++) {
183 183
        b = avio_r8(pb);
184 184
        if (b == key[0])
185 185
            i = 0;
......
305 305
{
306 306
    KLVPacket klv;
307 307

  
308
    while (!url_feof(s->pb)) {
308
    while (!s->pb->eof_reached) {
309 309
        if (klv_read_packet(&klv, s->pb) < 0)
310 310
            return -1;
311 311
        PRINT_KEY(s, "read packet", klv.key);
......
914 914
    }
915 915
    avio_seek(s->pb, -14, SEEK_CUR);
916 916
    mxf->fc = s;
917
    while (!url_feof(s->pb)) {
917
    while (!s->pb->eof_reached) {
918 918
        const MXFMetadataReadTableEntry *metadata;
919 919

  
920 920
        if (klv_read_packet(&klv, s->pb) < 0)
libavformat/mxg.c
132 132
    uint8_t *startmarker_ptr, *end, *search_end, marker;
133 133
    MXGContext *mxg = s->priv_data;
134 134

  
135
    while (!url_feof(s->pb) && !url_ferror(s->pb)){
135
    while (!s->pb->eof_reached && !url_ferror(s->pb)){
136 136
        if (mxg->cache_size <= OVERREAD_SIZE) {
137 137
            /* update internal buffer */
138 138
            ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);
libavformat/ncdec.c
66 66

  
67 67
    uint32_t state=-1;
68 68
    while (state != NC_VIDEO_FLAG) {
69
        if (url_feof(s->pb))
69
        if (s->pb->eof_reached)
70 70
            return AVERROR(EIO);
71 71
        state = (state<<8) + avio_r8(s->pb);
72 72
    }
libavformat/nsvdec.c
230 230
    //nsv->state = NSV_UNSYNC;
231 231

  
232 232
    for (i = 0; i < NSV_MAX_RESYNC; i++) {
233
        if (url_feof(pb)) {
233
        if (pb->eof_reached) {
234 234
            av_dlog(s, "NSV EOF\n");
235 235
            nsv->state = NSV_UNSYNC;
236 236
            return -1;
......
296 296
    table_entries_used = avio_rl32(pb);
297 297
    av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
298 298
            strings_size, table_entries, table_entries_used);
299
    if (url_feof(pb))
299
    if (pb->eof_reached)
300 300
        return -1;
301 301

  
302 302
    av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb));
......
331 331
        }
332 332
        av_free(strings);
333 333
    }
334
    if (url_feof(pb))
334
    if (pb->eof_reached)
335 335
        return -1;
336 336

  
337 337
    av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb));
......
378 378

  
379 379
    avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
380 380

  
381
    if (url_feof(pb))
381
    if (pb->eof_reached)
382 382
        return -1;
383 383
    nsv->state = NSV_HAS_READ_NSVF;
384 384
    return 0;
......
554 554
        return 0; //-1; /* hey! eat what you've in your plate first! */
555 555

  
556 556
null_chunk_retry:
557
    if (url_feof(pb))
557
    if (pb->eof_reached)
558 558
        return -1;
559 559

  
560 560
    for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)
......
588 588
        vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
589 589
    }
590 590

  
591
    if (url_feof(pb))
591
    if (pb->eof_reached)
592 592
        return -1;
593 593
    if (!vsize && !asize) {
594 594
        nsv->state = NSV_UNSYNC;
libavformat/nutdec.c
121 121
    if(pos >= 0)
122 122
        avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
123 123

  
124
    while(!url_feof(bc)){
124
    while(!bc->eof_reached){
125 125
        state= (state<<8) | avio_r8(bc);
126 126
        if((state>>56) != 'N')
127 127
            continue;
......
790 790
            pos-=8;
791 791
        }else{
792 792
            frame_code = avio_r8(bc);
793
            if(url_feof(bc))
793
            if(bc->eof_reached)
794 794
                return -1;
795 795
            if(frame_code == 'N'){
796 796
                tmp= frame_code;
libavformat/nuv.c
60 60
    nuv_frametype frametype;
61 61
    if (!vst && !myth)
62 62
        return 1; // no codec data needed
63
    while (!url_feof(pb)) {
63
    while (!pb->eof_reached) {
64 64
        int size, subtype;
65 65
        frametype = avio_r8(pb);
66 66
        switch (frametype) {
......
195 195
    uint8_t hdr[HDRSIZE];
196 196
    nuv_frametype frametype;
197 197
    int ret, size;
198
    while (!url_feof(pb)) {
198
    while (!pb->eof_reached) {
199 199
        int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
200 200
        uint64_t pos = avio_tell(pb);
201 201
        ret = avio_read(pb, hdr, HDRSIZE);
libavformat/oggdec.c
219 219
            break;
220 220

  
221 221
        c = avio_r8(bc);
222
        if (url_feof(bc))
222
        if (bc->eof_reached)
223 223
            return -1;
224 224
        sync[sp++ & 3] = c;
225 225
    }while (i++ < MAX_PAGE_SIZE);
libavformat/psxstr.c
241 241
            break;
242 242
        }
243 243

  
244
        if (url_feof(pb))
244
        if (pb->eof_reached)
245 245
            return AVERROR(EIO);
246 246
    }
247 247
}
libavformat/qcp.c
140 140
    QCPContext    *c  = s->priv_data;
141 141
    unsigned int  chunk_size, tag;
142 142

  
143
    while(!url_feof(pb)) {
143
    while(!pb->eof_reached) {
144 144
        if (c->data_size) {
145 145
            int pkt_size, ret, mode = avio_r8(pb);
146 146

  
libavformat/rmdec.c
409 409
    avio_rb32(pb); /* number of headers */
410 410

  
411 411
    for(;;) {
412
        if (url_feof(pb))
412
        if (pb->eof_reached)
413 413
            return -1;
414 414
        tag = avio_rl32(pb);
415 415
        tag_size = avio_rb32(pb);
......
515 515
    AVStream *st;
516 516
    uint32_t state=0xFFFFFFFF;
517 517

  
518
    while(!url_feof(pb)){
518
    while(!pb->eof_reached){
519 519
        int len, num, i;
520 520
        *pos= avio_tell(pb) - 3;
521 521
        if(rm->remaining_len > 0){
......
848 848
                    st = s->streams[i];
849 849
            }
850 850

  
851
            if(len<0 || url_feof(s->pb))
851
            if(len<0 || s->pb->eof_reached)
852 852
                return AVERROR(EIO);
853 853

  
854 854
            res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
libavformat/smacker.c
235 235
    int palchange = 0;
236 236
    int pos;
237 237

  
238
    if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
238
    if (s->pb->eof_reached || smk->cur_frame >= smk->frames)
239 239
        return AVERROR_EOF;
240 240

  
241 241
    /* if we demuxed all streams, pass another frame */
libavformat/sol.c
130 130
{
131 131
    int ret;
132 132

  
133
    if (url_feof(s->pb))
133
    if (s->pb->eof_reached)
134 134
        return AVERROR(EIO);
135 135
    ret= av_get_packet(s->pb, pkt, MAX_SIZE);
136 136
    pkt->stream_index = 0;
libavformat/soxdec.c
127 127
{
128 128
    int ret, size;
129 129

  
130
    if (url_feof(s->pb))
130
    if (s->pb->eof_reached)
131 131
        return AVERROR_EOF;
132 132

  
133 133
    size = SOX_SAMPLES*s->streams[0]->codec->block_align;
libavformat/spdifdec.c
171 171

  
172 172
    while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
173 173
        state = (state << 8) | avio_r8(pb);
174
        if (url_feof(pb))
174
        if (pb->eof_reached)
175 175
            return AVERROR_EOF;
176 176
    }
177 177

  
libavformat/srtdec.c
81 81
    do {
82 82
        ptr2 = ptr;
83 83
        ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
84
    } while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-buffer<sizeof(buffer)-1);
84
    } while (!is_eol(*ptr2) && !s->pb->eof_reached && ptr-buffer<sizeof(buffer)-1);
85 85

  
86 86
    if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) {
87 87
        memcpy(pkt->data, buffer, pkt->size);
libavformat/swfdec.c
27 27
{
28 28
    int tag, len;
29 29

  
30
    if (url_feof(pb))
30
    if (pb->eof_reached)
31 31
        return -1;
32 32

  
33 33
    tag = avio_rl16(pb);
libavformat/tmv.c
146 146
    int ret, pkt_size = tmv->stream_index ?
147 147
                        tmv->audio_chunk_size : tmv->video_chunk_size;
148 148

  
149
    if (url_feof(pb))
149
    if (pb->eof_reached)
150 150
        return AVERROR_EOF;
151 151

  
152 152
    ret = av_get_packet(pb, pkt, pkt_size);
libavformat/tty.c
106 106
    TtyDemuxContext *s = avctx->priv_data;
107 107
    int n;
108 108

  
109
    if (url_feof(avctx->pb))
109
    if (avctx->pb->eof_reached)
110 110
        return AVERROR_EOF;
111 111

  
112 112
    n = s->chars_per_frame;
libavformat/txd.c
61 61
    chunk_size = avio_rl32(pb);
62 62
    marker     = avio_rl32(pb);
63 63

  
64
    if (url_feof(s->pb))
64
    if (s->pb->eof_reached)
65 65
        return AVERROR_EOF;
66 66
    if (marker != TXD_MARKER && marker != TXD_MARKER2) {
67 67
        av_log(s, AV_LOG_ERROR, "marker does not match\n");
libavformat/vc1test.c
92 92
    int keyframe = 0;
93 93
    uint32_t pts;
94 94

  
95
    if(url_feof(pb))
95
    if(pb->eof_reached)
96 96
        return AVERROR(EIO);
97 97

  
98 98
    frame_size = avio_rl24(pb);
libavformat/wav.c
155 155
    int64_t size;
156 156

  
157 157
    for (;;) {
158
        if (url_feof(pb))
158
        if (pb->eof_reached)
159 159
            return -1;
160 160
        size = next_tag(pb, &tag);
161 161
        if (tag == tag1)
......
234 234
    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
235 235

  
236 236
    for (;;) {
237
        if (url_feof(pb))
237
        if (pb->eof_reached)
238 238
            return -1;
239 239
        size = next_tag(pb, &tag);
240 240
        if (tag == MKTAG('d', 'a', 't', 'a')){
......
269 269
    uint8_t guid[16];
270 270
    int64_t size;
271 271

  
272
    while (!url_feof(pb)) {
272
    while (!pb->eof_reached) {
273 273
        avio_read(pb, guid, 16);
274 274
        size = avio_rl64(pb);
275 275
        if (size <= 24)
libavformat/wc3movie.c
157 157
        fourcc_tag = avio_rl32(pb);
158 158
        /* chunk sizes are 16-bit aligned */
159 159
        size = (avio_rb32(pb) + 1) & (~1);
160
        if (url_feof(pb))
160
        if (pb->eof_reached)
161 161
            return AVERROR(EIO);
162 162

  
163 163
    } while (fourcc_tag != BRCH_TAG);
......
208 208
        fourcc_tag = avio_rl32(pb);
209 209
        /* chunk sizes are 16-bit aligned */
210 210
        size = (avio_rb32(pb) + 1) & (~1);
211
        if (url_feof(pb))
211
        if (pb->eof_reached)
212 212
            return AVERROR(EIO);
213 213

  
214 214
        switch (fourcc_tag) {
libavformat/wtv.c
79 79

  
80 80
    if (wf->error || url_ferror(pb))
81 81
        return -1;
82
    if (wf->position >= wf->length || url_feof(pb))
82
    if (wf->position >= wf->length || pb->eof_reached)
83 83
        return 0;
84 84

  
85 85
    buf_size = FFMIN(buf_size, wf->length - wf->position);
......
554 554
{
555 555
    ff_asf_guid guid;
556 556
    int length, type;
557
    while(!url_feof(pb)) {
557
    while(!pb->eof_reached) {
558 558
        char key[1024];
559 559
        ff_get_guid(pb, &guid);
560 560
        type   = avio_rl32(pb);
......
770 770
{
771 771
    WtvContext *wtv = s->priv_data;
772 772
    AVIOContext *pb = wtv->pb;
773
    while (!url_feof(pb)) {
773
    while (!pb->eof_reached) {
774 774
        ff_asf_guid g;
775 775
        int len, sid, consumed;
776 776

  
......
997 997
            while(1) {
998 998
                uint64_t timestamp = avio_rl64(pb);
999 999
                uint64_t frame_nb  = avio_rl64(pb);
1000
                if (url_feof(pb))
1000
                if (pb->eof_reached)
1001 1001
                    break;
1002 1002
                ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
1003 1003
                                   0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME);
......
1011 1011
                    while (1) {
1012 1012
                        uint64_t frame_nb = avio_rl64(pb);
1013 1013
                        uint64_t position = avio_rl64(pb);
1014
                        if (url_feof(pb))
1014
                        if (pb->eof_reached)
1015 1015
                            break;
1016 1016
                        for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
1017 1017
                            AVIndexEntry *e = wtv->index_entries + i;
libavformat/wv.c
241 241
    int ret;
242 242
    int size, ver, off;
243 243

  
244
    if (url_feof(s->pb))
244
    if (s->pb->eof_reached)
245 245
        return AVERROR(EIO);
246 246
    if(wc->block_parsed){
247 247
        if(wv_read_block_header(s, s->pb, 0) < 0)

Also available in: Unified diff