After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625717 - [PATCH] Add a test to Everything for string+len args
[PATCH] Add a test to Everything for string+len args
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 622123
 
 
Reported: 2010-07-31 13:06 UTC by Paolo Borelli
Modified: 2018-02-08 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.29 KB, patch)
2010-07-31 13:07 UTC, Paolo Borelli
none Details | Review
patch (1.63 KB, patch)
2010-08-07 12:08 UTC, Paolo Borelli
needs-work Details | Review
patch (2.09 KB, patch)
2010-08-19 20:03 UTC, Paolo Borelli
none Details | Review
updated patch (1.84 KB, patch)
2011-01-31 11:44 UTC, Jonathan Matthew
reviewed Details | Review

Description Paolo Borelli 2010-07-31 13:06:27 UTC
Add a function to Evertything to test the case of strings passed as byte arrays instead of null terminated (like GtkTextBuffer.insert)
Comment 1 Paolo Borelli 2010-07-31 13:07:23 UTC
Created attachment 166880 [details] [review]
patch

not sure about the name...
Comment 2 Paolo Borelli 2010-08-07 12:08:32 UTC
Created attachment 167317 [details] [review]
patch

also add testcase for fixed-size bytearray, as requested by pygobject maintainers.
Comment 3 Simon van der Linden 2010-08-11 16:55:26 UTC
Review of attachment 167317 [details] [review]:

First, I think those tests would better go to gir/gimarshallingtests.c.

Secondly, returning the thing that was passed is harder to debug than asserting an expected value inside the (then) procedure, not to say that both the marshalling of the input argument and the one of the output argument may fail, and that the test could still pass. Actually, this happened. So, please assert a value inside the procedure.

Wouldn't we add tests out arguments, and return values, by the way?

::: gir/everything.h
@@ +55,3 @@
+/* not null-terminated strings */
+char *test_bytearray_in (const char *str, int len);
+char *test_bytearray_fixed_size_in (const char *str);

I think the name is misleading. GByteArray exists as well.
Comment 4 Paolo Borelli 2010-08-19 20:03:54 UTC
Created attachment 168319 [details] [review]
patch

Sorry for the delay, I was on vacation.

updated patch, I renamed it to "chararray", I am open to other suggestions.



I did not add the tests for the output case: not sure what you had in mind there... do you mean a function filling a **char str and *len?
Comment 5 Johan (not receiving bugmail) Dahlin 2010-09-06 04:46:11 UTC
(In reply to comment #4)
> Created an attachment (id=168319) [details] [review]
> patch
> 
> Sorry for the delay, I was on vacation.
> 
> updated patch, I renamed it to "chararray", I am open to other suggestions.
> 
> 
> 
> I did not add the tests for the output case: not sure what you had in mind
> there... do you mean a function filling a **char str and *len?

This needs to be updated to HEAD which generates code for gimarshallingtests.c
Comment 6 Fabio Durán Verdugo 2011-01-20 20:58:30 UTC
any news for this report?
Comment 7 Jonathan Matthew 2011-01-31 11:44:13 UTC
Created attachment 179705 [details] [review]
updated patch
Comment 8 Colin Walters 2011-01-31 16:33:50 UTC
Review of attachment 179705 [details] [review]:

::: tests/gimarshallingtests.c
@@ +3372,3 @@
+/**
+ * gi_marshalling_tests_chararray_in:
+ * @str: (array length=len) (element-type guint8):

Not a big fan of overriding the C type this way via (element-type); why didn't you write:

@@ +3375,3 @@
+ */
+void
+gi_marshalling_tests_chararray_in (const char *str, int len)

const guint8* str?

What real world API is this mirroring?

@@ +3383,3 @@
+/**
+ * gi_marshalling_tests_fixed_chararray_in:
+ * @str: (array fixed-size=5) (element-type guint8):

Is there really an API out there somewhere that does this?
Comment 9 Jonathan Matthew 2011-02-06 05:23:14 UTC
(In reply to comment #8)
> Review of attachment 179705 [details] [review]:
> 
> ::: tests/gimarshallingtests.c
> @@ +3372,3 @@
> +/**
> + * gi_marshalling_tests_chararray_in:
> + * @str: (array length=len) (element-type guint8):
> 
> Not a big fan of overriding the C type this way via (element-type); why didn't
> you write:
> 
> @@ +3375,3 @@
> + */
> +void
> +gi_marshalling_tests_chararray_in (const char *str, int len)
> 
> const guint8* str?
> 
> What real world API is this mirroring?

I think Paolo was intending to mirror gtk_text_buffer_insert.

I'm doing this with the aim of getting gdk_pixbuf_loader_write working, which doesn't require an element-type annotation.

> @@ +3383,3 @@
> +/**
> + * gi_marshalling_tests_fixed_chararray_in:
> + * @str: (array fixed-size=5) (element-type guint8):
> 
> Is there really an API out there somewhere that does this?

The closest things I can find:

void dacp_share_pair (DACPShare *share, gchar *service_name, gchar passcode[4]);

void            gst_netaddress_set_ip6_address   (GstNetAddress *naddr, guint8 address[16], guint16 port);
Comment 10 André Klapper 2015-02-07 17:17:01 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 11 GNOME Infrastructure Team 2018-02-08 11:56:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/30.