Diego Biurrun wrote:
version 9:
+- av_strnstr
- av_basename and av_dirname
- adobe and limelight publisher authentication in RTMP
- VDPAU hardware acceleration through normal hwaccel
Quoting from directly above where you added this entry:
Entries are sorted chronologically from oldest to youngest within
each release, releases are sorted from youngest to oldest.
:-)
already fixed :)
+char *av_strnstr(const char *s1, const char *s2, size_t len)
+{
+ size_t l2;
+
+ l2 = strlen(s2);
+ if (!l2)
+ return s1;
+ while (len >= l2) {
+ len--;
+ if (!memcmp(s1, s2, l2))
+ return s1;
+ s1++;
+ }
+ return NULL;
+}
Indentation level is twice what it should be. Doesn't this generate
warnings when you return those const pointers? Also, all hail for
non-descriptive variable names :)
indentation fixed.
btw, do you see stristr() just above?
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -67,6 +67,21 @@ int av_stristart(const char *str, const char *pfx, const
char **ptr);
char *av_stristr(const char *haystack, const char *needle);
/**
+ * Locate the first occurrence in the string haystack of the string needle
+ * where not more than length characters are searched.
Locate the first occurrence of the string needle in the first length
characters of the string haystack.
There is some doxygen syntax to markup parameters that might help here.
like in the rest of that file?
+ * where not more than length characters are searched. A zero-length string
+ * This function is a length limited version of the standard strstr().
length-limited
yup
+ * @param haystack string to search in
+ * @param needle string to search for
+ * @param length length of string to search in
+ * @return pointer to the located match within haystack
pointer to the first match within the haystack
+ * or a null pointer if no match
NULL
+ */
+char *av_strnstr(const char *haystack, const char *needle, size_t
haystack_size);
nit: break the line
seriously?
The parameter names of the declaration don't match the definition, nor the
doxygen ...
doxygen fixed.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel