typefind: remove pointless checks for data being NULL

It was already checked in an early out, and as it's only
incremented for at most the size of the passed buffer, it
can only become NULL in an address wraparound.

While there, don't cast away const on a pointer.

Coverity 1139845
This commit is contained in:
Vincent Penquerc'h 2014-04-10 15:16:03 +01:00
parent 9e99a1ca41
commit 577ec29245

View file

@ -517,7 +517,7 @@ xml_check_first_element_from_data (const guint8 * data, guint length,
/* look for the first element, it has to be the requested element. Bail
* out if it is not within the first 4kB. */
while (data && pos < MIN (4096, length)) {
while (pos < MIN (4096, length)) {
while (*data != '<' && pos < MIN (4096, length)) {
XML_INC_BUFFER_DATA;
}
@ -533,7 +533,7 @@ xml_check_first_element_from_data (const guint8 * data, guint length,
/* the first normal element, check if it's the one asked for */
if (pos + elen + 1 >= length)
return FALSE;
return (data && element && strncmp ((char *) data, element, elen) == 0);
return (element && strncmp ((const char *) data, element, elen) == 0);
}
return FALSE;