MCPcopy Create free account
hub / github.com/apache/arrow / garrow_mutable_buffer_set_data

Function garrow_mutable_buffer_set_data

c_glib/arrow-glib/buffer.cpp:503–527  ·  view source on GitHub ↗

* garrow_mutable_buffer_set_data: * @buffer: A #GArrowMutableBuffer. * @offset: A write offset in the buffer data in byte. * @data: (array length=size): The data to be written. * @size: The number of bytes of the data to be written. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: %TRUE on success, %FALSE otherwise. * * Since: 0.12.0 */

Source from the content-addressed store, hash-verified

501 * Since: 0.12.0
502 */
503gboolean
504garrow_mutable_buffer_set_data(GArrowMutableBuffer *buffer,
505 gint64 offset,
506 const guint8 *data,
507 gint64 size,
508 GError **error)
509{
510 const gchar *context = "[mutable-buffer][set-data]";
511 auto arrow_buffer = garrow_buffer_get_raw(GARROW_BUFFER(buffer));
512 if (offset + size > arrow_buffer->size()) {
513 g_set_error(error,
514 GARROW_ERROR,
515 GARROW_ERROR_INVALID,
516 "%s: Data is too large: "
517 "<(%" G_GINT64_FORMAT " + %" G_GINT64_FORMAT ") > "
518 "(%" G_GINT64_FORMAT ")>",
519 context,
520 offset,
521 size,
522 arrow_buffer->size());
523 return FALSE;
524 }
525 memcpy(arrow_buffer->mutable_data() + offset, data, size);
526 return TRUE;
527}
528
529G_DEFINE_TYPE(GArrowResizableBuffer, garrow_resizable_buffer, GARROW_TYPE_MUTABLE_BUFFER)
530

Callers

nothing calls this directly

Calls 3

garrow_buffer_get_rawFunction · 0.85
sizeMethod · 0.45
mutable_dataMethod · 0.45

Tested by

no test coverage detected