本文整理汇总了C++中G_OUTPUT_STREAM函数的典型用法代码示例。如果您正苦于以下问题:C++ G_OUTPUT_STREAM函数的具体用法?C++ G_OUTPUT_STREAM怎么用?C++ G_OUTPUT_STREAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_OUTPUT_STREAM函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: on_replace_file_ready
static void
on_replace_file_ready (GObject *source, GAsyncResult *res, gpointer user_data)
{
GcrCertificateExporter *self = GCR_CERTIFICATE_EXPORTER (user_data);
GFile *file = G_FILE (source);
GFileOutputStream *os;
os = g_file_replace_finish (file, res, &self->pv->error);
if (self->pv->error) {
complete_async_result (self);
return;
}
write_to_outputstream (self, G_OUTPUT_STREAM (os));
}
开发者ID:Distrotech,项目名称:gcr,代码行数:16,代码来源:gcr-certificate-exporter.c
示例2: arv_dom_document_save_to_url
void
arv_dom_document_save_to_url (ArvDomDocument *document, const char *path, GError **error)
{
GFile *file;
GFileOutputStream *stream;
g_return_if_fail (path != NULL);
file = g_file_new_for_uri (path);
stream = g_file_create (file, G_FILE_CREATE_REPLACE_DESTINATION, NULL, error);
if (stream != NULL) {
arv_dom_document_save_to_stream (document, G_OUTPUT_STREAM (stream), error);
g_object_unref (stream);
}
g_object_unref (file);
}
开发者ID:epicsdeb,项目名称:aravis,代码行数:16,代码来源:arvdomparser.c
示例3: didReceiveData
void didReceiveData(ResourceHandle*, const char* data, unsigned length, int /*encodedDataLength*/)
{
if (m_handleResponseLater.isScheduled()) {
m_handleResponseLater.cancel();
handleResponse();
}
gsize bytesWritten;
GUniqueOutPtr<GError> error;
g_output_stream_write_all(G_OUTPUT_STREAM(m_outputStream.get()), data, length, &bytesWritten, 0, &error.outPtr());
if (error) {
downloadFailed(platformDownloadDestinationError(m_response, error->message));
return;
}
m_download->didReceiveData(bytesWritten);
}
开发者ID:skygr,项目名称:webkit,代码行数:16,代码来源:DownloadSoup.cpp
示例4: g_pollable_output_stream_default_write_nonblocking
static gssize
g_pollable_output_stream_default_write_nonblocking (GPollableOutputStream *stream,
const void *buffer,
gsize count,
GError **error)
{
if (!g_pollable_output_stream_is_writable (stream))
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
g_strerror (EAGAIN));
return -1;
}
return G_OUTPUT_STREAM_GET_CLASS (stream)->
write_fn (G_OUTPUT_STREAM (stream), buffer, count, NULL, error);
}
开发者ID:patito,项目名称:glib,代码行数:16,代码来源:gpollableoutputstream.c
示例5: didReceiveData
void didReceiveData(ResourceHandle*, const char* data, int length, int /*encodedDataLength*/)
{
if (m_handleResponseLaterID) {
g_source_remove(m_handleResponseLaterID);
handleResponse();
}
gsize bytesWritten;
GOwnPtr<GError> error;
g_output_stream_write_all(G_OUTPUT_STREAM(m_outputStream.get()), data, length, &bytesWritten, 0, &error.outPtr());
if (error) {
downloadFailed(platformDownloadDestinationError(ResourceResponse(m_response.get()), error->message));
return;
}
m_download->didReceiveData(bytesWritten);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:16,代码来源:DownloadSoup.cpp
示例6: get_stream_for_unique_path
/* called in an I/O thread */
static GOutputStream *
get_stream_for_unique_path (const gchar *path,
const gchar *filename,
gchar **filename_used)
{
GOutputStream *stream;
GFile *file;
gchar *real_path, *real_filename, *name, *ptr;
gint idx;
ptr = g_strrstr (filename, ".png");
if (ptr != NULL)
real_filename = g_strndup (filename, ptr - filename);
else
real_filename = g_strdup (filename);
idx = 0;
real_path = NULL;
do
{
if (idx == 0)
name = g_strdup_printf ("%s.png", real_filename);
else
name = g_strdup_printf ("%s - %d.png", real_filename, idx);
real_path = g_build_filename (path, name, NULL);
g_free (name);
file = g_file_new_for_path (real_path);
stream = G_OUTPUT_STREAM (g_file_create (file, G_FILE_CREATE_NONE, NULL, NULL));
g_object_unref (file);
if (stream != NULL)
*filename_used = real_path;
else
g_free (real_path);
idx++;
}
while (stream == NULL);
g_free (real_filename);
return stream;
}
开发者ID:sigurdga,项目名称:gnome-shell,代码行数:48,代码来源:shell-screenshot.c
示例7: cache_splice_ready_cb
static void
cache_splice_ready_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
GError *error = NULL;
g_output_stream_splice_finish (G_OUTPUT_STREAM (source),
res, &error);
if (error != NULL) {
g_warning ("Can't save the cover art image in the cache: %s\n", error->message);
g_error_free (error);
return;
}
}
开发者ID:Fantu,项目名称:nemo-extensions,代码行数:17,代码来源:nemo-preview-cover-art.c
示例8: os_splice_ready_cb
static void
os_splice_ready_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
GError *error = NULL;
PdfLoadJob *job = user_data;
g_output_stream_splice_finish (G_OUTPUT_STREAM (source), res, &error);
if (error != NULL) {
pdf_load_job_complete_error (job, error);
return;
}
pdf_load_job_cache_set_attributes (job);
}
开发者ID:TiredFingers,项目名称:gnome-documents,代码行数:17,代码来源:gd-pdf-loader.c
示例9: debug_dialog_store_filter_foreach
static gboolean
debug_dialog_store_filter_foreach (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer user_data)
{
GFileOutputStream *output_stream = (GFileOutputStream *) user_data;
gchar *domain, *category, *message, *level_str, *level_upper;
gdouble timestamp;
gchar *line;
GError *error = NULL;
gboolean out = FALSE;
gtk_tree_model_get (model, iter,
COL_DEBUG_TIMESTAMP, ×tamp,
COL_DEBUG_DOMAIN, &domain,
COL_DEBUG_CATEGORY, &category,
COL_DEBUG_LEVEL_STRING, &level_str,
COL_DEBUG_MESSAGE, &message,
-1);
level_upper = g_ascii_strup (level_str, -1);
line = g_strdup_printf ("%s%s%s-%s: %e: %s\n",
domain, EMP_STR_EMPTY (category) ? "" : "/",
category, level_upper, timestamp, message);
g_output_stream_write (G_OUTPUT_STREAM (output_stream), line,
strlen (line), NULL, &error);
if (error != NULL)
{
DEBUG ("Failed to write to file: %s", error->message);
g_error_free (error);
out = TRUE;
}
g_free (line);
g_free (level_upper);
g_free (level_str);
g_free (domain);
g_free (category);
g_free (message);
return out;
}
开发者ID:kenvandine,项目名称:empathy,代码行数:46,代码来源:empathy-debug-dialog.c
示例10: write_to_stream
static tsize_t
write_to_stream(thandle_t handle,
tdata_t buffer,
tsize_t size)
{
Priv *p = (Priv*) handle;
GError *error = NULL;
gchar *new_buffer;
gsize new_size;
gssize written = -1;
g_assert(p->stream);
if (p->can_seek)
{
written = g_output_stream_write(G_OUTPUT_STREAM(p->stream),
(void *) buffer, (gsize) size,
NULL, &error);
if (written < 0)
{
g_warning("%s", error->message);
g_error_free(error);
}
}
else
{
if (p->position + size > p->allocated)
{
new_size = p->position + size;
new_buffer = g_try_realloc(p->buffer, new_size);
if (!new_buffer)
return -1;
p->allocated = new_size;
p->buffer = new_buffer;
}
g_assert(p->position + size >= p->allocated);
memcpy(p->buffer + p->position, buffer, size);
p->position += size;
written = size;
}
return (tsize_t) written;
}
开发者ID:kleopatra999,项目名称:gegl,代码行数:46,代码来源:tiff-save.c
示例11: tunnel_wrote_cb
static void
tunnel_wrote_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
Tunnel *tunnel = user_data;
TunnelEnd *write_end, *read_end;
GError *error = NULL;
gssize nwrote;
nwrote = g_output_stream_write_finish (G_OUTPUT_STREAM (object), result, &error);
if (nwrote <= 0) {
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
return;
} else if (error) {
g_print ("Tunnel write failed: %s\n", error->message);
g_error_free (error);
}
tunnel_close (tunnel);
return;
}
if (object == (GObject *)tunnel->client.ostream) {
write_end = &tunnel->client;
read_end = &tunnel->server;
} else {
write_end = &tunnel->server;
read_end = &tunnel->client;
}
write_end->nwrote += nwrote;
if (write_end->nwrote < read_end->nread) {
g_output_stream_write_async (write_end->ostream,
read_end->buffer + write_end->nwrote,
read_end->nread - write_end->nwrote,
G_PRIORITY_DEFAULT, tunnel->cancellable,
tunnel_wrote_cb, tunnel);
} else {
g_input_stream_read_async (read_end->istream,
read_end->buffer, BUFSIZE,
G_PRIORITY_DEFAULT, tunnel->cancellable,
tunnel_read_cb, tunnel);
}
}
开发者ID:Distrotech,项目名称:libsoup,代码行数:45,代码来源:simple-proxy.c
示例12: create_file
static GFile *
create_file (GFile *base_dir)
{
GFile *scratch_file;
gchar *scratch_name;
GOutputStream *output_stream;
gint pid;
GError *error = NULL;
gchar buffer [BUFFER_SIZE];
gint i;
pid = getpid ();
scratch_name = g_strdup_printf ("gvfs-benchmark-scratch-%d", pid);
scratch_file = g_file_resolve_relative_path (base_dir, scratch_name);
g_free (scratch_name);
if (!scratch_file)
return NULL;
output_stream = G_OUTPUT_STREAM (g_file_replace (scratch_file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
if (!output_stream)
{
g_printerr ("Failed to create scratch file: %s\n", error->message);
g_object_unref (scratch_file);
return NULL;
}
memset (buffer, 0xaa, BUFFER_SIZE);
for (i = 0; i < FILE_SIZE; i += BUFFER_SIZE)
{
if (g_output_stream_write (output_stream, buffer, BUFFER_SIZE, NULL, &error) < BUFFER_SIZE)
{
g_printerr ("Failed to populate scratch file: %s\n", error->message);
g_output_stream_close (output_stream, NULL, NULL);
g_object_unref (output_stream);
g_object_unref (scratch_file);
return NULL;
}
}
g_output_stream_close (output_stream, NULL, NULL);
g_object_unref (output_stream);
return scratch_file;
}
开发者ID:Alustriel,项目名称:gvfs,代码行数:45,代码来源:benchmark-gvfs-small-files.c
示例13: nice_output_stream_is_writable
static gboolean
nice_output_stream_is_writable (GPollableOutputStream *stream)
{
NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;
NiceComponent *component = NULL;
NiceStream *_stream = NULL;
gboolean retval = FALSE;
NiceAgent *agent; /* owned */
/* Closed streams are not writeable. */
if (g_output_stream_is_closed (G_OUTPUT_STREAM (stream)))
return FALSE;
/* Has the agent disappeared? */
agent = g_weak_ref_get (&priv->agent_ref);
if (agent == NULL)
return FALSE;
agent_lock ();
if (!agent_find_component (agent, priv->stream_id, priv->component_id,
&_stream, &component)) {
g_warning ("Could not find component %u in stream %u", priv->component_id,
priv->stream_id);
goto done;
}
if (component->selected_pair.local != NULL) {
NiceSocket *sockptr = component->selected_pair.local->sockptr;
/* If it’s a reliable agent, see if there’s any space in the pseudo-TCP
* output buffer. */
if (!nice_socket_is_reliable (sockptr)) {
retval = pseudo_tcp_socket_can_send (component->tcp);
} else {
retval = (g_socket_condition_check (sockptr->fileno, G_IO_OUT) != 0);
}
}
done:
agent_unlock ();
g_object_unref (agent);
return retval;
}
开发者ID:ThoughtWorks-SZ,项目名称:libnice,代码行数:45,代码来源:outputstream.c
示例14: on_output_closed
static void
on_output_closed (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
CockpitStream *self = COCKPIT_STREAM (user_data);
GError *error = NULL;
g_output_stream_close_finish (G_OUTPUT_STREAM (object), result, &error);
if (error)
{
g_warning ("%s: couldn't close output stream: %s", self->priv->name, error->message);
close_immediately (self, "internal-error");
}
close_maybe (self);
g_object_unref (self);
}
开发者ID:systemd,项目名称:cockpit,代码行数:18,代码来源:cockpitstream.c
示例15: soup_output_stream_new
/**
* soup_output_stream_new:
* @session: the #SoupSession to use
* @msg: the #SoupMessage whose request will be streamed
* @size: the total size of the request body, or -1 if not known
*
* Prepares to send @msg over @session, and returns a #GOutputStream
* that can be used to write the response. The server's response will
* be available in @msg after calling soup_output_stream_close()
* (which will return a %SOUP_OUTPUT_STREAM_HTTP_ERROR #GError if the
* status is not 2xx).
*
* If you know the total number of bytes that will be written, pass
* that in @size. Otherwise, pass -1. (If you pass a size, you MUST
* write that many bytes to the stream; Trying to write more than
* that, or closing the stream without having written enough, will
* result in an error.
*
* In some situations, the request will not actually be sent until you
* call g_output_stream_close(). (In fact, currently this is *always*
* true.)
*
* Internally, #SoupOutputStream is implemented using asynchronous
* I/O, so if you are using the synchronous API (eg,
* g_output_stream_write()), you should create a new #GMainContext and
* set it as the %SOUP_SESSION_ASYNC_CONTEXT property on @session. (If
* you don't, then synchronous #GOutputStream calls will cause the
* main loop to be run recursively.) The async #GOutputStream API
* works fine with %SOUP_SESSION_ASYNC_CONTEXT either set or unset.
*
* Returns: a new #GOutputStream.
**/
GOutputStream *
soup_output_stream_new (SoupSession *session, SoupMessage *msg, goffset size)
{
SoupOutputStream *stream;
SoupOutputStreamPrivate *priv;
g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL);
stream = g_object_new (SOUP_TYPE_OUTPUT_STREAM, NULL);
priv = SOUP_OUTPUT_STREAM_GET_PRIVATE (stream);
priv->session = g_object_ref (session);
priv->async_context = soup_session_get_async_context (session);
priv->msg = g_object_ref (msg);
priv->size = size;
return G_OUTPUT_STREAM (stream);
}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:50,代码来源:soup-output-stream.c
示例16: stream_write
static ssize_t
stream_write (CamelStream *stream, const char *buffer, size_t n)
{
gssize nwritten;
GError *error = NULL;
CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream_vfs->stream), 0);
nwritten = g_output_stream_write (G_OUTPUT_STREAM (stream_vfs->stream), buffer, n, NULL, &error);
if (error) {
g_warning ("%s", error->message);
g_error_free (error);
}
return nwritten;
}
开发者ID:nobled,项目名称:evolution-data-server.svn-import,代码行数:18,代码来源:camel-stream-vfs.c
示例17: ekg_connection_remove
static void ekg_connection_remove(struct ekg_connection *c) {
if (g_input_stream_has_pending(G_INPUT_STREAM(c->instream))) {
debug_warn("ekg_connection_remove(%x) input stream has pending!\n", c);
g_input_stream_clear_pending(G_INPUT_STREAM(c->instream));
}
#if 0 /* XXX */
g_assert(!g_output_stream_has_pending(
G_OUTPUT_STREAM(c->outstream)));
#endif
connections = g_slist_remove(connections, c);
g_string_free(c->wr_buffer, TRUE);
g_object_unref(c->cancellable);
g_object_unref(c->instream);
g_object_unref(c->outstream);
g_slice_free(struct ekg_connection, c);
}
开发者ID:AdKwiatkos,项目名称:ekg2,代码行数:18,代码来源:connections.c
示例18: splice_stream_ready_cb
static void
splice_stream_ready_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
EmpathyTpFile *self = user_data;
GError *error = NULL;
g_output_stream_splice_finish (G_OUTPUT_STREAM (source), res, &error);
DEBUG ("Splice stream ready cb, error %p", error);
if (error != NULL && !self->priv->is_closing)
{
ft_operation_close_with_error (self, error);
g_clear_error (&error);
return;
}
}
开发者ID:raluca-elena,项目名称:empathy-cheese,代码行数:19,代码来源:empathy-tp-file.c
示例19: write_buf_cb
static void
write_buf_cb (GObject *object, GAsyncResult *res, gpointer user_data)
{
GOutputStream *output = G_OUTPUT_STREAM (object);
RequestData *req_data = user_data;
GVfsAfpConnection *afp_conn = req_data->conn;
GVfsAfpConnectionPrivate *priv = afp_conn->priv;
HANDLE_RES ();
g_hash_table_insert (priv->request_hash,
GUINT_TO_POINTER ((guint)GUINT16_FROM_BE (priv->write_dsi_header.requestID)),
req_data);
g_mutex_lock (&priv->mutex);
send_request_unlocked (afp_conn);
g_mutex_unlock (&priv->mutex);
}
开发者ID:Alustriel,项目名称:gvfs,代码行数:19,代码来源:gvfsafpconnection.c
示例20: gdav_request_splice_cb
static void
gdav_request_splice_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
SoupMessage *message;
GTask *task = G_TASK (user_data);
GError *local_error = NULL;
message = g_task_get_task_data (task);
g_output_stream_splice_finish (
G_OUTPUT_STREAM (source_object), result, &local_error);
if (local_error != NULL) {
g_task_return_error (task, local_error);
/* XXX That the input stream's content is not automatically
* copied to the SoupMessage's response_body is a known
* libsoup bug which may be fixed in a future release.
* Check that the response body is empty so we don't
* accidentally duplicate the body. */
} else if (message->response_body->data == NULL) {
GMemoryOutputStream *output_stream;
gpointer data;
gsize size;
output_stream = G_MEMORY_OUTPUT_STREAM (source_object);
size = g_memory_output_stream_get_data_size (output_stream);
data = g_memory_output_stream_steal_data (output_stream);
soup_message_body_append_take (
message->response_body, data, size);
soup_message_body_flatten (message->response_body);
soup_message_finished (message);
g_task_return_boolean (task, TRUE);
} else {
g_task_return_boolean (task, TRUE);
}
g_object_unref (task);
}
开发者ID:mbarnes,项目名称:libgdav,代码行数:43,代码来源:gdav-methods.c
注:本文中的G_OUTPUT_STREAM函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论