typefindfunctions: Use guint32 for sizes

This brings it in sync with the type used with gst_type_find_*() API
This commit is contained in:
Edward Hervey 2018-07-06 13:46:17 +02:00 committed by Edward Hervey
parent a87724138b
commit 38ba954e82

View file

@ -55,7 +55,7 @@ typedef struct
{ {
guint64 offset; guint64 offset;
const guint8 *data; const guint8 *data;
gint size; guint size;
} DataScanCtx; } DataScanCtx;
static inline void static inline void
@ -72,7 +72,7 @@ data_scan_ctx_advance (GstTypeFind * tf, DataScanCtx * c, guint bytes_to_skip)
} }
static inline gboolean static inline gboolean
data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len) data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, guint min_len)
{ {
const guint8 *data; const guint8 *data;
guint64 len; guint64 len;
@ -112,6 +112,9 @@ static inline gboolean
data_scan_ctx_memcmp (GstTypeFind * tf, DataScanCtx * c, guint offset, data_scan_ctx_memcmp (GstTypeFind * tf, DataScanCtx * c, guint offset,
const gchar * data, guint len) const gchar * data, guint len)
{ {
if (G_UNLIKELY (offset + len >= G_MAXUINT32))
return FALSE;
if (!data_scan_ctx_ensure_data (tf, c, offset + len)) if (!data_scan_ctx_ensure_data (tf, c, offset + len))
return FALSE; return FALSE;