Mir

Code review comment for lp:~mir-team/mir/public-cookie-api

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

+/*
+ *
+ * \params[in] ev The input event
+ * \params[in] cookie An allocated void* with exactly cookie_size bytes
+ * \params[in] size The size of the allocated void*
+ */
+void mir_input_event_copy_cookie(MirInputEvent const* ev, MirCookie* cookie, size_t size);

When comments and code disagree, both are likely wrong.

While I'm not sure I fully understand the intended usage I suspect that have two scenarios:

1. Getting a MirCookie from an event.
2. Converting a MirCookie to and from a chunk of memory.

In neither of these does it make sense for a user to supply allocate and supply a pointer to an incomplete type.

How about:

MirCookie* mir_input_event_get_cookie(MirInputEvent const* ev);

and either:

MirCookie* mir_blob_to_mir_cookie(MirBlob* blob);
MirBlob* mir_blob_from_mir_cookie(MirCookie* cookie);

Or:

size_t mir_cookie_get_buffer_size(MirCookie* cookie);
void mir_cookie_to_buffer(MirCookie* cookie, void* buffer, size_t size);
MirCookie* mir_cookie_from_buffer(void const* buffer, size_t size);

review: Needs Fixing

« Back to merge proposal