Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH] msgpackffi.decode can now be assigned to buf.rpos
Date: Fri, 20 Dec 2019 23:00:50 +0100	[thread overview]
Message-ID: <274febe4-c14a-e6b4-3dbd-6c8301a405ba@tarantool.org> (raw)
In-Reply-To: <20190912174448.25680-1-maria.khaydich@tarantool.org>



Hi! Thanks for the patch!

Review of the first commit:

============================================================================

> Author: Maria <marianneliash@gmail.com>
>
>     lua: keeping the pointer type in msgpackffi.decode()
>     
>     Method decode_unchecked returns two values - the one that has
>     been decoded and a pointer to the new position within the buffer
>     given as a parameter. The type of returned pointer used to be
>     cdata<unsigned char *> and it was not possible to assign returned
>     value to buf.rpos due to the following error:
>     
>     > cannot convert 'const unsigned char *' to 'char *'
>     
>     The patch fixes this by making decode_unchecked method return either
>     cdata<char *> or cdata<const char *> depending on the given parameter.
>     
>     Closes #3926
>
> diff --git a/test/app-tap/msgpackffi.test.lua b/test/app-tap/msgpackffi.test.lua
> index 36ac26b7e..e64228e4d 100755
> --- a/test/app-tap/msgpackffi.test.lua
> +++ b/test/app-tap/msgpackffi.test.lua
> @@ -4,6 +4,8 @@ package.path = "lua/?.lua;"..package.path
>  
>  local tap = require('tap')
>  local common = require('serializer_test')
> +local buffer = require('buffer')

Buffer is never used here. Lets drop it.

> +local ffi = require('ffi')

============================================================================

Review of the second commit:

============================================================================

> Author: Alexander Turenko <alexander.turenko@tarantool.org>
>
>     lua: don't modify pointer type in msgpack.decode*
>     
>     msgpackffi.decode_unchecked([const] char *) returns two values: a
>     decoded result and a new pointer within passed buffer. After #3926 a
>     cdata type of the returned pointer follows a type of passed buffer.
>     
>     This commit modifies behaviour of msgpack module in the same way. The
>     following functions now returns cdata<char *> or cdata<const char *>
>     depending of its argument:
>     
>     * msgpack.decode(cdata<[const] char *>, number)
>     * msgpack.decode_unchecked(cdata<[const] char *>)
>     * msgpack.decode_array_header(cdata<[const] char *>, number)
>     * msgpack.decode_map_header(cdata<[const] char *>, number)
>     
>     Follows up #3926.
>
> diff --git a/test/app-tap/msgpackffi.test.lua b/test/app-tap/msgpackffi.test.lua
> index e64228e4d..be6906e67 100755
> --- a/test/app-tap/msgpackffi.test.lua
> +++ b/test/app-tap/msgpackffi.test.lua
> @@ -117,45 +117,6 @@ local function test_other(test, s)

Now "require('ffi')" in the beginning of that file becomes
not used. Please, drop it.

  parent reply	other threads:[~2019-12-20 22:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 17:44 Maria
2019-11-06  0:44 ` [Tarantool-patches] " Alexander Turenko
2019-11-13 11:21   ` [Tarantool-patches] [tarantool-patches] " Maria Khaydich
2019-12-08 23:36     ` Alexander Turenko
2019-12-11 11:15       ` [Tarantool-patches] [tarantool-patches] Re: [PATCH] lua: keeping the pointer type in msgpackffi.decode Maria Khaydich
2019-12-17 23:32         ` Alexander Turenko
2019-12-20 22:00 ` Vladislav Shpilevoy [this message]
2019-12-24 10:26   ` [Tarantool-patches] [tarantool-patches] [PATCH] msgpackffi.decode can now be assigned to buf.rpos Maria Khaydich
2019-12-24 16:26     ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=274febe4-c14a-e6b4-3dbd-6c8301a405ba@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [tarantool-patches] [PATCH] msgpackffi.decode can now be assigned to buf.rpos' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox