您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_OUTPUT_STREAM函数代码示例

51自学网 2021-06-01 21:01:43
  C++
这篇教程C++ G_OUTPUT_STREAM函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中G_OUTPUT_STREAM函数的典型用法代码示例。如果您正苦于以下问题:C++ G_OUTPUT_STREAM函数的具体用法?C++ G_OUTPUT_STREAM怎么用?C++ G_OUTPUT_STREAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了G_OUTPUT_STREAM函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: on_replace_file_ready

static voidon_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,


示例2: arv_dom_document_save_to_url

voidarv_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,


示例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,


示例4: g_pollable_output_stream_default_write_nonblocking

static gssizeg_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,


示例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,


示例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,


示例7: cache_splice_ready_cb

static voidcache_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,


示例8: os_splice_ready_cb

static voidos_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,


示例9: debug_dialog_store_filter_foreach

static gbooleandebug_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, &timestamp,      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,


示例10: write_to_stream

static tsize_twrite_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,


示例11: tunnel_wrote_cb

static voidtunnel_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,


示例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,


示例13: nice_output_stream_is_writable

static gbooleannice_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,


示例14: on_output_closed

static voidon_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,


示例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,


示例16: stream_write

static ssize_tstream_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,


示例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,


示例18: splice_stream_ready_cb

static voidsplice_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,


示例19: write_buf_cb

static voidwrite_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,


示例20: gdav_request_splice_cb

static voidgdav_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,


示例21: vfs_data_open_done

/* Called when a file open completes */static voidvfs_data_open_done (GObject *source, GAsyncResult *res, gpointer callback_data){    VfsAsyncHandle* ah = (VfsAsyncHandle*)callback_data;    if(ah->state == VFS_ASYNC_PROCESSING) {        g_assert (ah->operation == VFS_OP_OPENING);	g_clear_error (&ah->error);	        if (ah->writer)            ah->ostream = G_OUTPUT_STREAM (g_file_replace_finish (ah->file, res, &ah->error));        else            ah->istream = G_INPUT_STREAM (g_file_read_finish (ah->file, res, &ah->error));            ah->state = VFS_ASYNC_READY;        ah->total = 0;        ah->last = 0;    }}
开发者ID:GNOME,项目名称:seahorse-plugins,代码行数:20,


示例22: on_input_stream_read_ready

static void on_input_stream_read_ready (GObject * object, GAsyncResult * res, gpointer data){	GError * error = NULL;	GDownloadable *download = G_DOWNLOADABLE (data);	GioDownload *gio_download = GIO_DOWNLOAD (data);	g_assert (download != NULL);		gssize size = g_input_stream_read_finish (G_INPUT_STREAM(object), res, &error);	handle_critical_error (error);		if (size < 0)  {		g_downloadable_set_status (download, G_DOWNLOADABLE_NETWORK_ERROR);		return;	}		if (size == 0 && download->priv->size == download->priv->downloaded_size) {		/* Download Completed */		write_chunks_to_output_stream (gio_download);		g_input_stream_close_async (G_INPUT_STREAM(gio_download->priv->input), G_PRIORITY_DEFAULT,									NULL, on_input_stream_close_ready, NULL);		g_output_stream_close_async (G_OUTPUT_STREAM(gio_download->priv->output), G_PRIORITY_DEFAULT,									 NULL, on_output_stream_close_ready, NULL);				g_downloadable_set_status (download, G_DOWNLOADABLE_COMPLETED); 		g_signal_emit_by_name (download, "download-completed");					return;	}	if (gio_download->priv->num_chunks == NUM_OF_CHUNKS) {		write_chunks_to_output_stream (gio_download);		gio_download->priv->num_chunks = 0;	} 	MemChunk *chunk = mem_chunk_new_from_buffer (size, gio_download->priv->chunk_buff);	gio_download->priv->chunks = g_slist_prepend (gio_download->priv->chunks, chunk);	gio_download->priv->num_chunks++;	g_signal_emit_by_name (data, "download-progressed", size);	read_input_stream (download);}
开发者ID:trhura,项目名称:rookie,代码行数:42,


示例23: write_buf_cb

static voidwrite_buf_cb (GObject *object, GAsyncResult *res, gpointer user_data){  GOutputStream *output = G_OUTPUT_STREAM (object);  GVfsAfpConnection *afp_conn = G_VFS_AFP_CONNECTION (user_data);  GVfsAfpConnectionPrivate *priv = afp_conn->priv;  RequestData *req_data;  req_data = g_queue_peek_head (priv->request_queue);    HANDLE_RES ();  g_hash_table_insert (priv->request_hash,                       GUINT_TO_POINTER ((guint)GUINT16_FROM_BE (priv->write_dsi_header.requestID)),                       req_data);  g_queue_pop_head (priv->request_queue);  send_request (afp_conn);}
开发者ID:Amerekanets,项目名称:gvfs,代码行数:20,


示例24: stream_flush

static intstream_flush (CamelStream *stream){	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);	GError *error = NULL;	g_return_val_if_fail (CAMEL_IS_STREAM_VFS (stream) && stream_vfs != NULL, -1);	g_return_val_if_fail (stream_vfs->stream != NULL, -1);	g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream_vfs->stream), -1);	g_output_stream_flush (G_OUTPUT_STREAM (stream_vfs->stream), NULL, &error);	if (error) {		g_warning ("%s", error->message);		g_error_free (error);		return -1;	}	return 0;}
开发者ID:nobled,项目名称:evolution-data-server.svn-import,代码行数:20,


示例25: cleanup

static voidcleanup(GeglOperation *operation){  GeglProperties *o = GEGL_PROPERTIES(operation);  Priv *p = (Priv*) o->user_data;  if (p != NULL)    {      if (p->tiff != NULL)        TIFFClose(p->tiff);      else if (p->stream != NULL)        g_output_stream_close(G_OUTPUT_STREAM(p->stream), NULL, NULL);      if (p->stream != NULL)        g_clear_object(&p->stream);      p->tiff = NULL;      if (p->file != NULL)        g_clear_object(&p->file);    }}
开发者ID:kleopatra999,项目名称:gegl,代码行数:20,


示例26: nice_output_stream_write_nonblocking

static gssizenice_output_stream_write_nonblocking (GPollableOutputStream *stream,    const void *buffer, gsize count, GError **error){  NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;  NiceAgent *agent;  /* owned */  gint n_sent;  /* Closed streams are not writeable. */  if (g_output_stream_is_closed (G_OUTPUT_STREAM (stream))) {    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED,        "Stream is closed.");    return -1;  }  /* Has the agent disappeared? */  agent = g_weak_ref_get (&priv->agent_ref);  if (agent == NULL) {    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED,        "Stream is closed due to the NiceAgent being finalised.");    return -1;  }  if (count == 0) {    n_sent = 0;    goto done;  }  n_sent = nice_agent_send (agent, priv->stream_id, priv->component_id,      count, buffer);  if (n_sent == -1)    g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,        g_strerror (EAGAIN)); done:  g_object_unref (agent);  return n_sent;}
开发者ID:ThoughtWorks-SZ,项目名称:libnice,代码行数:41,


示例27: on_outputstream_write_ready

static voidon_outputstream_write_ready (GObject *source, GAsyncResult *res, gpointer user_data){	GcrCertificateExporter *self = GCR_CERTIFICATE_EXPORTER (user_data);	GOutputStream *os = G_OUTPUT_STREAM (source);	gssize written;	written = g_output_stream_write_finish (os, res, &self->pv->error);	if (self->pv->error) {		complete_async_result (self);		return;	}	g_return_if_fail (written >= 0);	g_return_if_fail (written <= self->pv->buffer->len - self->pv->buffer_at);	self->pv->buffer_at += written;	/* Write next bit, or finished */	write_to_outputstream (self, os);}
开发者ID:Distrotech,项目名称:gcr,代码行数:21,


示例28: prepare_write_stream

static GOutputStream *prepare_write_stream (const gchar *filename,                      gchar **filename_used){  GOutputStream *stream;  GFile *file;  if (g_path_is_absolute (filename))    {      file = g_file_new_for_path (filename);      *filename_used = g_strdup (filename);      stream = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL));      g_object_unref (file);    }  else    {      stream = get_stream_for_filename (filename, filename_used);    }  return stream;}
开发者ID:sigurdga,项目名称:gnome-shell,代码行数:21,


示例29: on_create_file_ready

static voidon_create_file_ready (GObject *source, GAsyncResult *res, gpointer user_data){	GcrCertificateExporter *self = GCR_CERTIFICATE_EXPORTER (user_data);	GFileOutputStream *os;	GtkWidget *dialog;	os = g_file_create_finish (self->pv->output_file, res, &self->pv->error);	/* Try again this time replacing the file */	if (g_error_matches (self->pv->error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {		g_clear_error (&self->pv->error);		dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (self->pv->chooser_dialog),		     GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,		     GTK_BUTTONS_NONE, "<b>%s</b>/n/n%s",		     _("A file already exists with this name."),		     _("Do you want to replace it with a new file?"));		gtk_dialog_add_buttons (GTK_DIALOG (dialog),		                        _("_Cancel"), GTK_RESPONSE_CANCEL,		                        _("_Replace"), GTK_RESPONSE_ACCEPT, NULL);		g_signal_connect (dialog, "response",		                  G_CALLBACK (on_replace_dialog_response), self);		if (self->pv->cancellable)			g_cancellable_connect (self->pv->cancellable,			                       G_CALLBACK (on_cancel_replace_dialog),			                       g_object_ref (dialog), g_object_unref);		gtk_widget_show (dialog);		return;	}	if (self->pv->error) {		complete_async_result (self);		return;	}	write_to_outputstream (self, G_OUTPUT_STREAM (os));}
开发者ID:Distrotech,项目名称:gcr,代码行数:40,


示例30: disabled_repos_free

static voiddisabled_repos_free (GHashTable *disabled){	GHashTableIter iter;	GFile *file;	GFileOutputStream *file_stream;	GDataOutputStream *data_stream;	const gchar *line = PACMAN_REPO_LIST_HEADER "/n";	g_return_if_fail (disabled != NULL);	g_debug ("pacman: storing disabled repos in %s", PACMAN_REPO_LIST);	file = g_file_new_for_path (PACMAN_REPO_LIST);	file_stream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL);	if (file_stream == NULL) {		g_object_unref (file);		g_hash_table_unref (disabled);		return;	}	g_hash_table_iter_init (&iter, disabled);	data_stream = g_data_output_stream_new (G_OUTPUT_STREAM (file_stream));	/* write header, then all disabled repos line by line */	if (g_data_output_stream_put_string (data_stream, line, NULL, NULL)) {		while (g_hash_table_iter_next (&iter, (gpointer *) &line, NULL) &&			g_data_output_stream_put_string (data_stream, line, NULL, NULL) &&			g_data_output_stream_put_string (data_stream, "/n", NULL, NULL));	}	g_object_unref (data_stream);	g_object_unref (file_stream);	g_object_unref (file);	g_hash_table_unref (disabled);}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:38,



注:本文中的G_OUTPUT_STREAM函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ G_PARAM_SPEC函数代码示例
C++ G_OBJECT_WARN_INVALID_PROPERTY_ID函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。