Browse Source

improve ff_get_line to return line length

Originally committed as revision 24400 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/n0.8
Aurelien Jacobs 15 years ago
parent
commit
a43416a540
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      libavformat/aviobuf.c
  2. +1
    -1
      libavformat/internal.h

+ 3
- 2
libavformat/aviobuf.c View File

@@ -554,18 +554,19 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
return buf;
}

void ff_get_line(ByteIOContext *s, char *buf, int maxlen)
int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
{
int i = 0;
char c;

do {
c = get_byte(s);
if (i < maxlen-1)
if (c && i < maxlen-1)
buf[i++] = c;
} while (c != '\n' && c);

buf[i] = 0;
return i;
}

uint64_t get_be64(ByteIOContext *s)


+ 1
- 1
libavformat/internal.h View File

@@ -167,7 +167,7 @@ int ff_get_v_length(uint64_t val);
*/
void ff_put_v(ByteIOContext *bc, uint64_t val);

void ff_get_line(ByteIOContext *s, char *buf, int maxlen);
int ff_get_line(ByteIOContext *s, char *buf, int maxlen);

#define SPACE_CHARS " \t\r\n"



Loading…
Cancel
Save