Add properties to GMemoryOutputStream
[platform/upstream/glib.git] / gio / gmemoryoutputstream.c
1 /* GIO - GLib Input, Output and Streaming Library
2  * 
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Authors:
21  *   Christian Kellner <gicmo@gnome.org>
22  *   Krzysztof KosiƄski <tweenk.pl@gmail.com>
23  */
24
25 #include "config.h"
26 #include "gmemoryoutputstream.h"
27 #include "goutputstream.h"
28 #include "gseekable.h"
29 #include "gsimpleasyncresult.h"
30 #include "gioerror.h"
31 #include "string.h"
32 #include "glibintl.h"
33
34 #include "gioalias.h"
35
36 /**
37  * SECTION:gmemoryoutputstream
38  * @short_description: Streaming output operations on memory chunks
39  * @include: gio/gio.h
40  * @see_also: #GMemoryInputStream
41  *
42  * #GMemoryOutputStream is a class for using arbitrary
43  * memory chunks as output for GIO streaming output operations.
44  *
45  */
46
47 #define MIN_ARRAY_SIZE  16
48
49 enum {
50   PROP_0,
51   PROP_DATA,
52   PROP_SIZE,
53   PROP_DATA_SIZE,
54   PROP_REALLOC_FUNCTION,
55   PROP_DESTROY_FUNCTION
56 };
57
58 struct _GMemoryOutputStreamPrivate {
59   
60   gpointer       data; /* Write buffer */
61   gsize          len; /* Current length of the data buffer. Can change with resizing. */
62   gsize          valid_len; /* The part of data that has been written to */
63   gsize          pos; /* Current position in the stream. Distinct from valid_len,
64                          because the stream is seekable. */
65
66   GReallocFunc   realloc_fn;
67   GDestroyNotify destroy;
68 };
69
70 static void     g_memory_output_stream_set_property (GObject      *object,
71                                                      guint         prop_id,
72                                                      const GValue *value,
73                                                      GParamSpec   *pspec);
74 static void     g_memory_output_stream_get_property (GObject      *object,
75                                                      guint         prop_id,
76                                                      GValue       *value,
77                                                      GParamSpec   *pspec);
78 static void     g_memory_output_stream_finalize     (GObject      *object);
79
80 static gssize   g_memory_output_stream_write       (GOutputStream *stream,
81                                                     const void    *buffer,
82                                                     gsize          count,
83                                                     GCancellable  *cancellable,
84                                                     GError       **error);
85
86 static gboolean g_memory_output_stream_close       (GOutputStream  *stream,
87                                                     GCancellable   *cancellable,
88                                                     GError        **error);
89
90 static void     g_memory_output_stream_write_async  (GOutputStream        *stream,
91                                                      const void           *buffer,
92                                                      gsize                 count,
93                                                      int                   io_priority,
94                                                      GCancellable         *cancellable,
95                                                      GAsyncReadyCallback   callback,
96                                                      gpointer              data);
97 static gssize   g_memory_output_stream_write_finish (GOutputStream        *stream,
98                                                      GAsyncResult         *result,
99                                                      GError              **error);
100 static void     g_memory_output_stream_close_async  (GOutputStream        *stream,
101                                                      int                   io_priority,
102                                                      GCancellable         *cancellable,
103                                                      GAsyncReadyCallback   callback,
104                                                      gpointer              data);
105 static gboolean g_memory_output_stream_close_finish (GOutputStream        *stream,
106                                                      GAsyncResult         *result,
107                                                      GError              **error);
108
109 static void     g_memory_output_stream_seekable_iface_init (GSeekableIface  *iface);
110 static goffset  g_memory_output_stream_tell                (GSeekable       *seekable);
111 static gboolean g_memory_output_stream_can_seek            (GSeekable       *seekable);
112 static gboolean g_memory_output_stream_seek                (GSeekable       *seekable,
113                                                            goffset          offset,
114                                                            GSeekType        type,
115                                                            GCancellable    *cancellable,
116                                                            GError         **error);
117 static gboolean g_memory_output_stream_can_truncate        (GSeekable       *seekable);
118 static gboolean g_memory_output_stream_truncate            (GSeekable       *seekable,
119                                                            goffset          offset,
120                                                            GCancellable    *cancellable,
121                                                            GError         **error);
122
123 G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM,
124                          G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
125                                                 g_memory_output_stream_seekable_iface_init))
126
127
128 static void
129 g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass)
130 {
131   GOutputStreamClass *ostream_class;
132   GObjectClass *gobject_class;
133
134   g_type_class_add_private (klass, sizeof (GMemoryOutputStreamPrivate));
135
136   gobject_class = G_OBJECT_CLASS (klass);
137   gobject_class->set_property = g_memory_output_stream_set_property;
138   gobject_class->get_property = g_memory_output_stream_get_property;
139   gobject_class->finalize     = g_memory_output_stream_finalize;
140
141   ostream_class = G_OUTPUT_STREAM_CLASS (klass);
142
143   ostream_class->write_fn = g_memory_output_stream_write;
144   ostream_class->close_fn = g_memory_output_stream_close;
145   ostream_class->write_async  = g_memory_output_stream_write_async;
146   ostream_class->write_finish = g_memory_output_stream_write_finish;
147   ostream_class->close_async  = g_memory_output_stream_close_async;
148   ostream_class->close_finish = g_memory_output_stream_close_finish;
149
150   g_object_class_install_property (gobject_class,
151                                    PROP_DATA,
152                                    g_param_spec_pointer ("data",
153                                                          P_("Data Buffer"),
154                                                          P_("Pointer to buffer where data will be written."),
155                                                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
156                                                          G_PARAM_STATIC_STRINGS));
157
158   g_object_class_install_property (gobject_class,
159                                    PROP_SIZE,
160                                    g_param_spec_ulong ("size",
161                                                        P_("Data Buffer Size"),
162                                                        P_("Current size of the data buffer."),
163                                                        0, G_MAXULONG, 0,
164                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
165                                                        G_PARAM_STATIC_STRINGS));
166
167   g_object_class_install_property (gobject_class,
168                                    PROP_DATA_SIZE,
169                                    g_param_spec_ulong ("data-size",
170                                                        P_("Data Size"),
171                                                        P_("Size of data written to the buffer."),
172                                                        0, G_MAXULONG, 0,
173                                                        G_PARAM_READABLE |
174                                                        G_PARAM_STATIC_STRINGS));
175
176   g_object_class_install_property (gobject_class,
177                                    PROP_REALLOC_FUNCTION,
178                                    g_param_spec_pointer ("realloc-function",
179                                                          P_("Memory Reallocation Function"),
180                                                          P_("Function with realloc semantics called to enlarge the buffer."),
181                                                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
182                                                          G_PARAM_STATIC_STRINGS));
183
184   g_object_class_install_property (gobject_class,
185                                    PROP_DESTROY_FUNCTION,
186                                    g_param_spec_pointer ("destroy-function",
187                                                          P_("Destroy Notification Function"),
188                                                          P_("Function called with the buffer as argument when the stream is destroyed."),
189                                                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
190                                                          G_PARAM_STATIC_STRINGS));
191 }
192
193 static void
194 g_memory_output_stream_set_property (GObject      *object,
195                                      guint         prop_id,
196                                      const GValue *value,
197                                      GParamSpec   *pspec)
198 {
199   GMemoryOutputStream        *stream;
200   GMemoryOutputStreamPrivate *priv;
201
202   stream = G_MEMORY_OUTPUT_STREAM (object);
203   priv = stream->priv;
204
205   switch (prop_id)
206     {
207     case PROP_DATA:
208       priv->data = g_value_get_pointer (value);
209       break;
210     case PROP_SIZE:
211       priv->len = g_value_get_ulong (value);
212       break;
213     case PROP_REALLOC_FUNCTION:
214       priv->realloc_fn = g_value_get_pointer (value);
215       break;
216     case PROP_DESTROY_FUNCTION:
217       priv->destroy = g_value_get_pointer (value);
218       break;
219     default:
220       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
221       break;
222     }
223 }
224
225 static void
226 g_memory_output_stream_get_property (GObject      *object,
227                                      guint         prop_id,
228                                      GValue       *value,
229                                      GParamSpec   *pspec)
230 {
231   GMemoryOutputStream        *stream;
232   GMemoryOutputStreamPrivate *priv;
233
234   stream = G_MEMORY_OUTPUT_STREAM (object);
235   priv = stream->priv;
236
237   switch (prop_id)
238     {
239     case PROP_DATA:
240       g_value_set_pointer (value, priv->data);
241       break;
242     case PROP_SIZE:
243       g_value_set_ulong (value, priv->len);
244       break;
245     case PROP_DATA_SIZE:
246       g_value_set_ulong (value, priv->valid_len);
247       break;
248     case PROP_REALLOC_FUNCTION:
249       g_value_set_pointer (value, priv->realloc_fn);
250       break;
251     case PROP_DESTROY_FUNCTION:
252       g_value_set_pointer (value, priv->destroy);
253       break;
254     default:
255       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
256       break;
257     }
258 }
259
260 static void
261 g_memory_output_stream_finalize (GObject *object)
262 {
263   GMemoryOutputStream        *stream;
264   GMemoryOutputStreamPrivate *priv;
265
266   stream = G_MEMORY_OUTPUT_STREAM (object);
267   priv = stream->priv;
268   
269   if (priv->destroy)
270     priv->destroy (priv->data);
271
272   G_OBJECT_CLASS (g_memory_output_stream_parent_class)->finalize (object);
273 }
274
275 static void
276 g_memory_output_stream_seekable_iface_init (GSeekableIface *iface)
277 {
278   iface->tell         = g_memory_output_stream_tell;
279   iface->can_seek     = g_memory_output_stream_can_seek;
280   iface->seek         = g_memory_output_stream_seek;
281   iface->can_truncate = g_memory_output_stream_can_truncate;
282   iface->truncate_fn  = g_memory_output_stream_truncate;
283 }
284
285
286 static void
287 g_memory_output_stream_init (GMemoryOutputStream *stream)
288 {
289   stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
290                                               G_TYPE_MEMORY_OUTPUT_STREAM,
291                                               GMemoryOutputStreamPrivate);
292   stream->priv->pos = 0;
293   stream->priv->valid_len = 0;
294 }
295
296 /**
297  * g_memory_output_stream_new:
298  * @data: pointer to a chunk of memory to use, or %NULL
299  * @size: the size of @data
300  * @realloc_function: a function with realloc() semantics to be called when
301  *     @data needs to be grown, or %NULL
302  * @destroy_function: a function to be called on @data when the stream is
303  *     finalized, or %NULL
304  *
305  * Creates a new #GMemoryOutputStream.
306  *
307  * If @data is non-%NULL, the stream  will use that for its internal storage.
308  * If @realloc_fn is non-%NULL, it will be used for resizing the internal
309  * storage when necessary. To construct a fixed-size output stream,
310  * pass %NULL as @realloc_fn.
311  * |[
312  * /&ast; a stream that can grow &ast;/
313  * stream = g_memory_output_stream_new (NULL, 0, realloc, free);
314  *
315  * /&ast; a fixed-size stream &ast;/
316  * data = malloc (200);
317  * stream2 = g_memory_output_stream_new (data, 200, NULL, free);
318  * ]|
319  *
320  * Return value: A newly created #GMemoryOutputStream object.
321  **/
322 GOutputStream *
323 g_memory_output_stream_new (gpointer       data,
324                             gsize          size,
325                             GReallocFunc   realloc_function,
326                             GDestroyNotify destroy_function)
327 {
328   GOutputStream *stream;
329
330   stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM,
331                          "data", data,
332                          "size", size,
333                          "realloc-function", realloc_function,
334                          "destroy-function", destroy_function,
335                          NULL);
336
337   return stream;
338 }
339
340 /**
341  * g_memory_output_stream_get_data:
342  * @ostream: a #GMemoryOutputStream
343  *
344  * Gets any loaded data from the @ostream.
345  *
346  * Note that the returned pointer may become invalid on the next
347  * write or truncate operation on the stream.
348  *
349  * Returns: pointer to the stream's data
350  **/
351 gpointer
352 g_memory_output_stream_get_data (GMemoryOutputStream *ostream)
353 {
354   g_return_val_if_fail (G_IS_MEMORY_OUTPUT_STREAM (ostream), NULL);
355
356   return ostream->priv->data;
357 }
358
359 /**
360  * g_memory_output_stream_get_size:
361  * @ostream: a #GMemoryOutputStream
362  *
363  * Gets the size of the currently allocated data area (availible from
364  * g_memory_output_stream_get_data()). If the stream isn't
365  * growable (no realloc was passed to g_memory_output_stream_new()) then
366  * this is the maximum size of the stream and further writes
367  * will return %G_IO_ERROR_NO_SPACE.
368  *
369  * Note that for growable streams the returned size may become invalid on
370  * the next write or truncate operation on the stream.
371  *
372  * If you want the number of bytes currently written to the stream, use
373  * g_memory_output_stream_get_data_size().
374  *
375  * Returns: the number of bytes allocated for the data buffer
376  */
377 gsize
378 g_memory_output_stream_get_size (GMemoryOutputStream *ostream)
379 {
380   g_return_val_if_fail (G_IS_MEMORY_OUTPUT_STREAM (ostream), 0);
381
382   return ostream->priv->len;
383 }
384
385 /**
386  * g_memory_output_stream_get_data_size:
387  * @ostream: a #GMemoryOutputStream
388  *
389  * Returns the number of bytes from the start up
390  * to including the last byte written in the stream
391  * that has not been truncated away.
392  *
393  * Returns: the number of bytes written to the stream
394  *
395  * Since: 2.18
396  */
397 gsize
398 g_memory_output_stream_get_data_size (GMemoryOutputStream *ostream)
399 {
400   g_return_val_if_fail (G_IS_MEMORY_OUTPUT_STREAM (ostream), 0);
401
402   return ostream->priv->valid_len;
403 }
404
405 static gboolean
406 array_resize (GMemoryOutputStream  *ostream,
407               gsize                 size,
408               gboolean              allow_partial,
409               GError              **error)
410 {
411   GMemoryOutputStreamPrivate *priv;
412   gpointer data;
413   gsize len;
414
415   priv = ostream->priv;
416
417   if (priv->len == size)
418     return TRUE;
419
420   if (!priv->realloc_fn)
421     {
422       if (allow_partial &&
423           priv->pos < priv->len)
424         return TRUE; /* Short write */
425
426       g_set_error_literal (error,
427                            G_IO_ERROR,
428                            G_IO_ERROR_NO_SPACE,
429                            _("Memory output stream not resizable"));
430       return FALSE;
431     }
432
433   len = priv->len;
434   data = priv->realloc_fn (priv->data, size);
435
436   if (size > 0 && !data)
437     {
438       if (allow_partial &&
439           priv->pos < priv->len)
440         return TRUE; /* Short write */
441
442       g_set_error_literal (error,
443                            G_IO_ERROR,
444                            G_IO_ERROR_NO_SPACE,
445                            _("Failed to resize memory output stream"));
446       return FALSE;
447     }
448
449   if (size > len)
450     memset ((guint8 *)data + len, 0, size - len);
451
452   priv->data = data;
453   priv->len = size;
454
455   if (priv->len < priv->valid_len)
456     priv->valid_len = priv->len;
457
458   return TRUE;
459 }
460
461 static gint
462 g_nearest_pow (gint num)
463 {
464   gint n = 1;
465
466   while (n < num)
467     n <<= 1;
468
469   return n;
470 }
471
472 static gssize
473 g_memory_output_stream_write (GOutputStream  *stream,
474                               const void     *buffer,
475                               gsize           count,
476                               GCancellable   *cancellable,
477                               GError        **error)
478 {
479   GMemoryOutputStream        *ostream;
480   GMemoryOutputStreamPrivate *priv;
481   guint8   *dest;
482   gsize new_size;
483
484   ostream = G_MEMORY_OUTPUT_STREAM (stream);
485   priv = ostream->priv;
486
487   if (count == 0)
488     return 0;
489
490   /* Check for address space overflow, but only if the buffer is resizable.
491      Otherwise we just do a short write and don't worry. */
492   if (priv->realloc_fn && priv->pos + count < priv->pos)
493     goto overflow;
494
495   if (priv->pos + count > priv->len)
496     {
497       /* At least enought to fit the write, rounded up
498              for greater than linear growth.
499          TODO: This wastes a lot of memory at large stream sizes.
500                Figure out a more rational allocation strategy. */
501       new_size = g_nearest_pow (priv->pos + count);
502       /* Check for overflow again. We have only checked if
503          pos + count > G_MAXSIZE, but it only catches the case of writing
504          more than 4GiB total on a 32-bit system. There's still the problem
505          of g_nearest_pow overflowing above 0x7fffffff, so we're
506          effectively limited to 2GiB. */
507       if (new_size < priv->len)
508         goto overflow;
509
510       new_size = MAX (new_size, MIN_ARRAY_SIZE);
511       if (!array_resize (ostream, new_size, TRUE, error))
512         return -1;
513     }
514
515   /* Make sure we handle short writes if the array_resize
516      only added part of the required memory */
517   count = MIN (count, priv->len - priv->pos);
518
519   dest = (guint8 *)priv->data + priv->pos;
520   memcpy (dest, buffer, count);
521   priv->pos += count;
522
523   if (priv->pos > priv->valid_len)
524     priv->valid_len = priv->pos;
525
526   return count;
527
528  overflow:
529   /* Overflow: buffer size would need to be bigger than G_MAXSIZE. */
530   g_set_error_literal (error,
531                        G_IO_ERROR,
532                        G_IO_ERROR_NO_SPACE,
533                        _("Amount of memory required to process the write is "
534                          "larger than available address space"));
535   return -1;
536 }
537
538 static gboolean
539 g_memory_output_stream_close (GOutputStream  *stream,
540                               GCancellable   *cancellable,
541                               GError        **error)
542 {
543   return TRUE;
544 }
545
546 static void
547 g_memory_output_stream_write_async (GOutputStream       *stream,
548                                     const void          *buffer,
549                                     gsize                count,
550                                     int                  io_priority,
551                                     GCancellable        *cancellable,
552                                     GAsyncReadyCallback  callback,
553                                     gpointer             data)
554 {
555   GSimpleAsyncResult *simple;
556   gssize nwritten;
557
558   nwritten = g_memory_output_stream_write (stream,
559                                            buffer,
560                                            count,
561                                            cancellable,
562                                            NULL);
563
564   simple = g_simple_async_result_new (G_OBJECT (stream),
565                                       callback,
566                                       data,
567                                       g_memory_output_stream_write_async);
568
569   g_simple_async_result_set_op_res_gssize (simple, nwritten);
570   g_simple_async_result_complete_in_idle (simple);
571   g_object_unref (simple);
572 }
573
574 static gssize
575 g_memory_output_stream_write_finish (GOutputStream  *stream,
576                                      GAsyncResult   *result,
577                                      GError        **error)
578 {
579   GSimpleAsyncResult *simple;
580   gssize nwritten;
581
582   simple = G_SIMPLE_ASYNC_RESULT (result);
583
584   g_warn_if_fail (g_simple_async_result_get_source_tag (simple) ==
585                   g_memory_output_stream_write_async);
586
587   nwritten = g_simple_async_result_get_op_res_gssize (simple);
588
589   return nwritten;
590 }
591
592 static void
593 g_memory_output_stream_close_async (GOutputStream       *stream,
594                                     int                  io_priority,
595                                     GCancellable        *cancellable,
596                                     GAsyncReadyCallback  callback,
597                                     gpointer             data)
598 {
599   GSimpleAsyncResult *simple;
600
601   simple = g_simple_async_result_new (G_OBJECT (stream),
602                                       callback,
603                                       data,
604                                       g_memory_output_stream_close_async);
605
606
607   /* will always return TRUE */
608   g_memory_output_stream_close (stream, cancellable, NULL);
609
610   g_simple_async_result_complete_in_idle (simple);
611   g_object_unref (simple);
612 }
613
614 static gboolean
615 g_memory_output_stream_close_finish (GOutputStream  *stream,
616                                      GAsyncResult   *result,
617                                      GError        **error)
618 {
619   GSimpleAsyncResult *simple;
620
621   simple = G_SIMPLE_ASYNC_RESULT (result);
622
623   g_warn_if_fail (g_simple_async_result_get_source_tag (simple) ==
624                   g_memory_output_stream_close_async);
625
626   return TRUE;
627 }
628
629 static goffset
630 g_memory_output_stream_tell (GSeekable *seekable)
631 {
632   GMemoryOutputStream *stream;
633   GMemoryOutputStreamPrivate *priv;
634
635   stream = G_MEMORY_OUTPUT_STREAM (seekable);
636   priv = stream->priv;
637
638   return priv->pos;
639 }
640
641 static gboolean
642 g_memory_output_stream_can_seek (GSeekable *seekable)
643 {
644   return TRUE;
645 }
646
647 static gboolean
648 g_memory_output_stream_seek (GSeekable    *seekable,
649                             goffset        offset,
650                             GSeekType      type,
651                             GCancellable  *cancellable,
652                             GError       **error)
653 {
654   GMemoryOutputStream        *stream;
655   GMemoryOutputStreamPrivate *priv;
656   goffset absolute;
657
658   stream = G_MEMORY_OUTPUT_STREAM (seekable);
659   priv = stream->priv;
660
661   switch (type)
662     {
663     case G_SEEK_CUR:
664       absolute = priv->pos + offset;
665       break;
666
667     case G_SEEK_SET:
668       absolute = offset;
669       break;
670
671     case G_SEEK_END:
672       absolute = priv->len + offset;
673       break;
674
675     default:
676       g_set_error_literal (error,
677                            G_IO_ERROR,
678                            G_IO_ERROR_INVALID_ARGUMENT,
679                            _("Invalid GSeekType supplied"));
680
681       return FALSE;
682     }
683
684   if (absolute < 0)
685     {
686       g_set_error_literal (error,
687                            G_IO_ERROR,
688                            G_IO_ERROR_INVALID_ARGUMENT,
689                            _("Requested seek before the beginning of the stream"));
690       return FALSE;
691     }
692
693   if (absolute > priv->len)
694     {
695       g_set_error_literal (error,
696                            G_IO_ERROR,
697                            G_IO_ERROR_INVALID_ARGUMENT,
698                            _("Requested seek beyond the end of the stream"));
699       return FALSE;
700     }
701
702   priv->pos = absolute;
703
704   return TRUE;
705 }
706
707 static gboolean
708 g_memory_output_stream_can_truncate (GSeekable *seekable)
709 {
710   GMemoryOutputStream *ostream;
711   GMemoryOutputStreamPrivate *priv;
712
713   ostream = G_MEMORY_OUTPUT_STREAM (seekable);
714   priv = ostream->priv;
715
716   return priv->realloc_fn != NULL;
717 }
718
719 static gboolean
720 g_memory_output_stream_truncate (GSeekable     *seekable,
721                                  goffset        offset,
722                                  GCancellable  *cancellable,
723                                  GError       **error)
724 {
725   GMemoryOutputStream *ostream = G_MEMORY_OUTPUT_STREAM (seekable);
726
727   if (!array_resize (ostream, offset, FALSE, error))
728     return FALSE;
729
730   return TRUE;
731 }
732
733 #define __G_MEMORY_OUTPUT_STREAM_C__
734 #include "gioaliasdef.c"