openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/glib-2.0/1_2.60.3-r0/glib-2.60.3/gio/goutputstream.c
gboolean g_output_stream_write_all(GOutputStream* stream, const void* buffer,
                                   gsize count, gsize* bytes_written,
                                   GCancellable* cancellable, GError** error)
{
    gsize _bytes_written;
    gssize res;

    g_return_val_if_fail(G_IS_OUTPUT_STREAM(stream), FALSE);
    g_return_val_if_fail(buffer != NULL, FALSE);

    _bytes_written = 0;
    while (_bytes_written < count)
    {
        res = g_output_stream_write(stream, (char*)buffer + _bytes_written,
                                    count - _bytes_written, cancellable, error);
        if (res == -1)
        {
            if (bytes_written)
                *bytes_written = _bytes_written;
            return FALSE;
        }
        g_return_val_if_fail(res > 0, FALSE);

        _bytes_written += res;
    }

    if (bytes_written)
        *bytes_written = _bytes_written;

    return TRUE;
}
/**
 * g_output_stream_write_all:
 * @stream: a #GOutputStream.
 * @buffer: (array length=count) (element-type guint8): the buffer containing
 *the data to write.
 * @count: the number of bytes to write
 * @bytes_written: (out) (optional): location to store the number of bytes that
 *was written to the stream
 * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore.
 * @error: location to store the error occurring, or %NULL to ignore
 *
 * Tries to write @count bytes from @buffer into the stream. Will block
 * during the operation.
 *
 * This function is similar to g_output_stream_write(), except it tries to
 * write as many bytes as requested, only stopping on an error.
 *
 * On a successful write of @count bytes, %TRUE is returned, and @bytes_written
 * is set to @count.
 *
 * If there is an error during the operation %FALSE is returned and @error
 * is set to indicate the error status.
 *
 * As a special exception to the normal conventions for functions that
 * use #GError, if this function returns %FALSE (and sets @error) then
 * @bytes_written will be set to the number of bytes that were
 * successfully written before the error was encountered.  This
 * functionality is only available from C.  If you need it from another
 * language then you must write your own loop around
 * g_output_stream_write().
 *
 * Returns: %TRUE on success, %FALSE if there was an error
 **/


Tries to write @count bytes from @buffer into the stream. Will block
during the operation.

This function is similar to g_output_stream_write(), except it tries to
write as many bytes as requested, only stopping on an error.

On a successful write of @count bytes, %TRUE is returned, and @bytes_written
is set to @count.

If there is an error during the operation %FALSE is returned and @error
is set to indicate the error status.

As a special exception to the normal conventions for functions that
use #GError, if this function returns %FALSE (and sets @error) then
@bytes_written will be set to the number of bytes that were
successfully written before the error was encountered.  This
functionality is only available from C.  If you need it from another
language then you must write your own loop around
g_output_stream_write().

%TRUE on success, %FALSE if there was an error
Tries to write @count bytes from @buffer into the stream . Will block during the operation . This function is similar to g_output_stream_write () except it tries to write as many bytes as requested only stopping on an error . On a successful write of @count bytes %TRUE is returned and @bytes_written is set to @count . If there is an error during the operation %FALSE is returned and @error is set to indicate the error status . As a special exception to the normal conventions for functions that use #GError if this function returns %FALSE ( and sets @error ) then @bytes_written will be set to the number of bytes that were successfully written before the error was encountered . This functionality is only available from C . If you need it from another language then you must write your own loop around g_output_stream_write () . %TRUE on success %FALSE if there was an error
gboolean g_output_stream_write_all(GOutputStream* stream, const void* buffer,
                                   gsize count, gsize* bytes_written,
                                   GCancellable* cancellable, GError** error)
{
    gsize _bytes_written;
    gssize res;
    g_return_val_if_fail(G_IS_OUTPUT_STREAM(stream), FALSE);
    g_return_val_if_fail(buffer != NULL, FALSE);
    _bytes_written = 0;
    while (_bytes_written < count)
    {
        res = g_output_stream_write(stream, (char*)buffer + _bytes_written,
                                    count - _bytes_written, cancellable, error);
        if (res == -1)
        {
            if (bytes_written)
                *bytes_written = _bytes_written;
            return FALSE;
        }
        g_return_val_if_fail(res > 0, FALSE);
        _bytes_written += res;
    }
    if (bytes_written)
        *bytes_written = _bytes_written;
    return TRUE;
}
gboolean g_output_stream_write_all ( GOutputStream * stream , const void * buffer , gsize count , gsize * bytes_written , GCancellable * cancellable , GError * * error ) { gsize _bytes_written ; gssize res ; g_return_val_if_fail ( G_IS_OUTPUT_STREAM ( stream ) , FALSE ) ; g_return_val_if_fail ( buffer != NULL , FALSE ) ; _bytes_written = 0 ; while ( _bytes_written < count ) { res = g_output_stream_write ( stream , ( char * ) buffer + _bytes_written , count - _bytes_written , cancellable , error ) ; if ( res == -1 ) { if ( bytes_written ) * bytes_written = _bytes_written ; return FALSE ; } g_return_val_if_fail ( res > 0 , FALSE ) ; _bytes_written += res ; } if ( bytes_written ) * bytes_written = _bytes_written ; return TRUE ; }
g_output_stream_write_all:
 @stream: a #GOutputStream.
g_output_stream_write_all : @stream : a #GOutputStream .