[FFmpeg-cvslog] r24400 - in trunk/libavformat: aviobuf.c internal.h

aurel subversion
Wed Jul 21 23:40:10 CEST 2010


Author: aurel
Date: Wed Jul 21 23:40:10 2010
New Revision: 24400

Log:
improve ff_get_line to return line length

Modified:
   trunk/libavformat/aviobuf.c
   trunk/libavformat/internal.h

Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c	Wed Jul 21 23:39:01 2010	(r24399)
+++ trunk/libavformat/aviobuf.c	Wed Jul 21 23:40:10 2010	(r24400)
@@ -554,18 +554,19 @@ char *get_strz(ByteIOContext *s, char *b
     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)

Modified: trunk/libavformat/internal.h
==============================================================================
--- trunk/libavformat/internal.h	Wed Jul 21 23:39:01 2010	(r24399)
+++ trunk/libavformat/internal.h	Wed Jul 21 23:40:10 2010	(r24400)
@@ -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"
 



More information about the ffmpeg-cvslog mailing list