[MPlayer-cvslog] r32766 - trunk/libmpdemux/mf.c

ranma subversion at mplayerhq.hu
Thu Jan 6 15:41:11 CET 2011


Author: ranma
Date: Thu Jan  6 15:41:10 2011
New Revision: 32766

Log:
Don't hardcode filename length.

Use limits.h to get the maximum length instead of hardcoding it.
Original patch by Sang-Uok Kum.

Signed-off-by: Tobias Diedrich <ranma at google.com>

Modified:
   trunk/libmpdemux/mf.c

Modified: trunk/libmpdemux/mf.c
==============================================================================
--- trunk/libmpdemux/mf.c	Thu Jan  6 15:38:55 2011	(r32765)
+++ trunk/libmpdemux/mf.c	Thu Jan  6 15:41:10 2011	(r32766)
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -63,8 +64,8 @@ mf_t* open_mf(char * filename){
    FILE *lst_f=fopen(filename + 1,"r");
    if ( lst_f )
     {
-     fname=malloc( 255 );
-     while ( fgets( fname,255,lst_f ) )
+     fname=malloc(PATH_MAX);
+     while ( fgets( fname,PATH_MAX,lst_f ) )
       {
        /* remove spaces from end of fname */
        char *t=fname + strlen( fname ) - 1;


More information about the MPlayer-cvslog mailing list