[vlc-commits] playlist: m3u: use cctype

Francois Cartegnie git at videolan.org
Thu Mar 12 13:27:11 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 11 10:49:17 2020 +0100| [984fa85411f3129ea7f9fd71168401f3e4a92e12] | committer: Francois Cartegnie

playlist: m3u: use cctype

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=984fa85411f3129ea7f9fd71168401f3e4a92e12
---

 modules/demux/playlist/m3u.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 9675bc84cb..e9d0238918 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -36,6 +36,8 @@
 
 #include "playlist.h"
 
+#include <ctype.h>
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -230,17 +232,16 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
         char *psz_parse = psz_line;
 
         /* Skip leading tabs and spaces */
-        while( *psz_parse == ' ' || *psz_parse == '\t' ||
-               *psz_parse == '\n' || *psz_parse == '\r' ) psz_parse++;
+        while( isspace( *psz_parse ) )
+            psz_parse++;
 
         if( *psz_parse == '#' )
         {
             /* Parse extra info */
 
             /* Skip leading tabs and spaces */
-            while( *psz_parse == ' ' || *psz_parse == '\t' ||
-                   *psz_parse == '\n' || *psz_parse == '\r' ||
-                   *psz_parse == '#' ) psz_parse++;
+            while( isspace( *psz_parse ) || *psz_parse == '#' )
+                psz_parse++;
 
             if( !*psz_parse ) goto error;
 
@@ -353,9 +354,9 @@ static void parseEXTINF(char *psz_string, char **ppsz_artist,
 
     end = psz_string + strlen( psz_string );
 
-    /* ignore whitespaces */
-    for (; psz_string < end && ( *psz_string == '\t' || *psz_string == ' ' );
-         psz_string++ );
+    /* strip leading whitespaces */
+    while( psz_string < end && isspace( *psz_string ) )
+        psz_string++;
 
     /* duration: read to next comma */
     psz_item = psz_string;



More information about the vlc-commits mailing list