]> git.sesse.net Git - mlt/commitdiff
fix reading properties file without trailing newline
authorDan Dennedy <dan@dennedy.org>
Sun, 12 Aug 2012 17:38:35 +0000 (10:38 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 12 Aug 2012 17:38:35 +0000 (10:38 -0700)
src/framework/mlt_properties.c

index 6d8ef08bb92f491dfe9898603e82280e9403e5d4..4f21d68cffdd94da5d0a8b4829d0e0f2f84e8049 100644 (file)
@@ -192,8 +192,10 @@ static int load_properties( mlt_properties self, const char *filename )
                // Read each string from the file
                while( fgets( temp, 1024, file ) )
                {
-                       // Chomp the string
-                       temp[ strlen( temp ) - 1 ] = '\0';
+                       // Chomp the new line character from the string
+                       int x = strlen( temp ) - 1;
+                       if ( temp[x] == '\n' || temp[x] == '\r' )
+                               temp[x] = '\0';
 
                        // Check if the line starts with a .
                        if ( temp[ 0 ] == '.' )