Mercurial > libavformat.hg
comparison rtsp.c @ 4789:c18ea19a9771 libavformat
strchr(string, '\0') returns non-NULL, and is thus not suited for use in
redir_isspace(char) to check if '\0' is a space or not. Therefore, we now
use memchr(), since then we can give the length of the string (i.e. the
length excluding the terminating '\0'). Fixes issue 919, see also the
follow-ups in the "[PATCH] rtsp.c small cleanups" mailinglist thread.
author | rbultje |
---|---|
date | Tue, 24 Mar 2009 03:24:59 +0000 |
parents | 52b8ffbf5d28 |
children | 5370b0c1653c |
comparison
equal
deleted
inserted
replaced
4788:99c0c6d046d8 | 4789:c18ea19a9771 |
---|---|
53 return AVPROBE_SCORE_MAX; | 53 return AVPROBE_SCORE_MAX; |
54 return 0; | 54 return 0; |
55 } | 55 } |
56 | 56 |
57 #define SPACE_CHARS " \t\r\n" | 57 #define SPACE_CHARS " \t\r\n" |
58 #define redir_isspace(c) strchr(SPACE_CHARS, c) | 58 /* we use memchr() instead of strchr() here because strchr() will return |
59 * the terminating '\0' of SPACE_CHARS instead of NULL if c is '\0'. */ | |
60 #define redir_isspace(c) memchr(SPACE_CHARS, c, 4) | |
59 static void skip_spaces(const char **pp) | 61 static void skip_spaces(const char **pp) |
60 { | 62 { |
61 const char *p; | 63 const char *p; |
62 p = *pp; | 64 p = *pp; |
63 while (redir_isspace(*p)) | 65 while (redir_isspace(*p)) |