mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
improve ff_get_line to return line length
Originally committed as revision 24400 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7c89295145
commit
a43416a540
@ -554,18 +554,19 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
|
|||||||
return buf;
|
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;
|
int i = 0;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
c = get_byte(s);
|
c = get_byte(s);
|
||||||
if (i < maxlen-1)
|
if (c && i < maxlen-1)
|
||||||
buf[i++] = c;
|
buf[i++] = c;
|
||||||
} while (c != '\n' && c);
|
} while (c != '\n' && c);
|
||||||
|
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t get_be64(ByteIOContext *s)
|
uint64_t get_be64(ByteIOContext *s)
|
||||||
|
@ -167,7 +167,7 @@ int ff_get_v_length(uint64_t val);
|
|||||||
*/
|
*/
|
||||||
void ff_put_v(ByteIOContext *bc, 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"
|
#define SPACE_CHARS " \t\r\n"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user