Original commit message from CVS:
* gst/gstregistrybinary.c: (_gst_crc32):
Return the old CRC instead of 0 if we give a NULL buffer
or a buffer with a length of 0.
+2008-04-19 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst/gstregistrybinary.c: (_gst_crc32):
+ Return the old CRC instead of 0 if we give a NULL buffer
+ or a buffer with a length of 0.
+
2008-04-19 Sebastian Dröge <slomo@circular-chaos.org>
* gst/gsturi.c: (gst_uri_protocol_check_internal),
/* Changes for gstreamer:
* - Changed to use GLib data types
* - Change function name to _gst_crc32
+ * - Return the old CRC instead of 0 when len or buf are 0/NULL
*/
/* ========================================================================
static guint32
_gst_crc32 (guint32 crc, const gchar * buf, guint len)
{
- if (buf == NULL)
- return 0L;
+ if (buf == NULL || len == 0)
+ return crc;
+
crc = crc ^ 0xffffffffL;
while (len >= 8) {
DO8 (buf);