comparison aviobuf.c @ 6301:1b2b5dbcf549 libavformat

improve ff_get_line to return line length
author aurel
date Wed, 21 Jul 2010 21:40:10 +0000
parents e62d23b0547d
children 175c5f6cb556
comparison
equal deleted inserted replaced
6300:e62d23b0547d 6301:1b2b5dbcf549
552 buf[i] = 0; /* Ensure null terminated, but may be truncated */ 552 buf[i] = 0; /* Ensure null terminated, but may be truncated */
553 553
554 return buf; 554 return buf;
555 } 555 }
556 556
557 void ff_get_line(ByteIOContext *s, char *buf, int maxlen) 557 int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
558 { 558 {
559 int i = 0; 559 int i = 0;
560 char c; 560 char c;
561 561
562 do { 562 do {
563 c = get_byte(s); 563 c = get_byte(s);
564 if (i < maxlen-1) 564 if (c && i < maxlen-1)
565 buf[i++] = c; 565 buf[i++] = c;
566 } while (c != '\n' && c); 566 } while (c != '\n' && c);
567 567
568 buf[i] = 0; 568 buf[i] = 0;
569 return i;
569 } 570 }
570 571
571 uint64_t get_be64(ByteIOContext *s) 572 uint64_t get_be64(ByteIOContext *s)
572 { 573 {
573 uint64_t val; 574 uint64_t val;