Fix return type of g_converter_[in|out]put_stream.

Fixes bug #603265
This commit is contained in:
Paolo Borelli 2009-11-29 15:14:10 +01:00
parent bd2a9f7ebb
commit e7992b7b06
5 changed files with 26 additions and 30 deletions

View File

@ -191,13 +191,13 @@ g_converter_input_stream_init (GConverterInputStream *stream)
* *
* Creates a new converter input stream for the @base_stream. * Creates a new converter input stream for the @base_stream.
* *
* Returns: a new #GConverterInputStream. * Returns: a new #GInputStream.
**/ **/
GConverterInputStream * GInputStream *
g_converter_input_stream_new (GInputStream *base_stream, g_converter_input_stream_new (GInputStream *base_stream,
GConverter *converter) GConverter *converter)
{ {
GConverterInputStream *stream; GInputStream *stream;
g_return_val_if_fail (G_IS_INPUT_STREAM (base_stream), NULL); g_return_val_if_fail (G_IS_INPUT_STREAM (base_stream), NULL);

View File

@ -71,8 +71,8 @@ struct _GConverterInputStreamClass
}; };
GType g_converter_input_stream_get_type (void) G_GNUC_CONST; GType g_converter_input_stream_get_type (void) G_GNUC_CONST;
GConverterInputStream *g_converter_input_stream_new (GInputStream *base_stream, GInputStream *g_converter_input_stream_new (GInputStream *base_stream,
GConverter *converter); GConverter *converter);
GConverter *g_converter_input_stream_get_converter (GConverterInputStream *converter_stream); GConverter *g_converter_input_stream_get_converter (GConverterInputStream *converter_stream);
G_END_DECLS G_END_DECLS

View File

@ -192,8 +192,8 @@ g_converter_output_stream_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
static void static void
g_converter_output_stream_init (GConverterOutputStream *stream) g_converter_output_stream_init (GConverterOutputStream *stream)
{ {
@ -208,13 +208,13 @@ g_converter_output_stream_init (GConverterOutputStream *stream)
* *
* Creates a new converter output stream for the @base_stream. * Creates a new converter output stream for the @base_stream.
* *
* Returns: a new #GConverterOutputStream. * Returns: a new #GOutputStream.
**/ **/
GConverterOutputStream * GOutputStream *
g_converter_output_stream_new (GOutputStream *base_stream, g_converter_output_stream_new (GOutputStream *base_stream,
GConverter *converter) GConverter *converter)
{ {
GConverterOutputStream *stream; GOutputStream *stream;
g_return_val_if_fail (G_IS_OUTPUT_STREAM (base_stream), NULL); g_return_val_if_fail (G_IS_OUTPUT_STREAM (base_stream), NULL);

View File

@ -71,8 +71,8 @@ struct _GConverterOutputStreamClass
}; };
GType g_converter_output_stream_get_type (void) G_GNUC_CONST; GType g_converter_output_stream_get_type (void) G_GNUC_CONST;
GConverterOutputStream *g_converter_output_stream_new (GOutputStream *base_stream, GOutputStream *g_converter_output_stream_new (GOutputStream *base_stream,
GConverter *converter); GConverter *converter);
GConverter *g_converter_output_stream_get_converter (GConverterOutputStream *converter_stream); GConverter *g_converter_output_stream_get_converter (GConverterOutputStream *converter_stream);
G_END_DECLS G_END_DECLS

View File

@ -298,10 +298,8 @@ test_expander (void)
gsize total_read; gsize total_read;
gssize res; gssize res;
GConverterResult cres; GConverterResult cres;
GInputStream *mem; GInputStream *mem, *cstream;
GConverterInputStream *cstream; GOutputStream *mem_out, *cstream_out;
GOutputStream *mem_out;
GConverterOutputStream *cstream_out;
GConverter *expander; GConverter *expander;
GError *error; GError *error;
int i; int i;
@ -334,7 +332,7 @@ test_expander (void)
while (TRUE) while (TRUE)
{ {
error = NULL; error = NULL;
res = g_input_stream_read (G_INPUT_STREAM (cstream), res = g_input_stream_read (cstream,
ptr, 1, ptr, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -356,7 +354,7 @@ test_expander (void)
for (i = 0; i < sizeof(unexpanded_data); i++) for (i = 0; i < sizeof(unexpanded_data); i++)
{ {
error = NULL; error = NULL;
res = g_output_stream_write (G_OUTPUT_STREAM (cstream_out), res = g_output_stream_write (cstream_out,
unexpanded_data + i, 1, unexpanded_data + i, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -368,7 +366,7 @@ test_expander (void)
g_assert (res == 1); g_assert (res == 1);
} }
g_output_stream_close (G_OUTPUT_STREAM (cstream_out), NULL, NULL); g_output_stream_close (cstream_out, NULL, NULL);
g_assert (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mem_out)) == n_written); g_assert (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mem_out)) == n_written);
g_assert (memcmp (g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (mem_out)), g_assert (memcmp (g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (mem_out)),
@ -390,10 +388,8 @@ test_compressor (void)
gsize total_read; gsize total_read;
gssize res; gssize res;
GConverterResult cres; GConverterResult cres;
GInputStream *mem; GInputStream *mem, *cstream;
GOutputStream *mem_out; GOutputStream *mem_out, *cstream_out;
GConverterInputStream *cstream;
GConverterOutputStream *cstream_out;
GConverter *expander, *compressor; GConverter *expander, *compressor;
GError *error; GError *error;
int i; int i;
@ -424,7 +420,7 @@ test_compressor (void)
while (TRUE) while (TRUE)
{ {
error = NULL; error = NULL;
res = g_input_stream_read (G_INPUT_STREAM (cstream), res = g_input_stream_read (cstream,
ptr, 1, ptr, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -448,7 +444,7 @@ test_compressor (void)
for (i = 0; i < expanded_size; i++) for (i = 0; i < expanded_size; i++)
{ {
error = NULL; error = NULL;
res = g_output_stream_write (G_OUTPUT_STREAM (cstream_out), res = g_output_stream_write (cstream_out,
expanded + i, 1, expanded + i, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -460,7 +456,7 @@ test_compressor (void)
g_assert (res == 1); g_assert (res == 1);
} }
g_output_stream_close (G_OUTPUT_STREAM (cstream_out), NULL, NULL); g_output_stream_close (cstream_out, NULL, NULL);
g_assert (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mem_out)) == n_read - 1); /* Last 2 zeros are combined */ g_assert (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mem_out)) == n_read - 1); /* Last 2 zeros are combined */
g_assert (memcmp (g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (mem_out)), g_assert (memcmp (g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (mem_out)),
@ -484,7 +480,7 @@ test_compressor (void)
while (TRUE) while (TRUE)
{ {
error = NULL; error = NULL;
res = g_input_stream_read (G_INPUT_STREAM (cstream), res = g_input_stream_read (cstream,
ptr, 1, ptr, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -508,7 +504,7 @@ test_compressor (void)
while (TRUE) while (TRUE)
{ {
error = NULL; error = NULL;
res = g_input_stream_read (G_INPUT_STREAM (cstream), res = g_input_stream_read (cstream,
ptr, 1, ptr, 1,
NULL, &error); NULL, &error);
g_assert (res != -1); g_assert (res != -1);
@ -537,7 +533,7 @@ test_compressor (void)
while (TRUE) while (TRUE)
{ {
error = NULL; error = NULL;
res = g_input_stream_read (G_INPUT_STREAM (cstream), res = g_input_stream_read (cstream,
ptr, 1, ptr, 1,
NULL, &error); NULL, &error);
if (res == -1) if (res == -1)