buffer: warn if (offset + size) > buffer->size

previously we would silently bail out if the given offset + data size
would overflow the buffer size. Now we use g_return_val_if_fail so we
get a warning if we hit this case.
This commit is contained in:
Robert Bragg 2010-10-18 18:50:02 +01:00
parent aafcee31b2
commit 525504f9bf

View File

@ -458,11 +458,8 @@ cogl_buffer_set_data (CoglBuffer *buffer,
const guint8 *data,
gsize size)
{
if (!cogl_is_buffer (buffer))
return FALSE;
if (G_UNLIKELY((offset + size) > buffer->size))
return FALSE;
g_return_val_if_fail (cogl_is_buffer (buffer), FALSE);
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
return buffer->vtable.set_data (buffer, offset, data, size);
}