On Mon, 2018-08-13 at 19:15 +0200, Marc-André Lureau wrote: > On Mon, Aug 13, 2018 at 6:11 PM, Christophe Fergeau < > cfergeau@xxxxxxxxxx> wrote: > > The simpletlv_* functions return lengths as an int, but the test is > > casting it to a size_t before comparing it against -1. This is not > > giving the expected result on i686, causing the test to fail. > > > > Why not change the variable to be int? (or even ssize_t, the function > should also return a ssize_t then) Thank you for tracking the issue down. I agree that we should rather change the variable in the test to int or other signed type, rather than casting it back and forth. > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > --- > > tests/simpletlv.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/tests/simpletlv.c b/tests/simpletlv.c > > index cd0cd69..2665eef 100644 > > --- a/tests/simpletlv.c > > +++ b/tests/simpletlv.c > > @@ -66,11 +66,11 @@ static void test_length_nested(void) > > /* Nested structures do not support splitting TL and V buffers > > ?? */ > > /* Simple short value to TL */ > > length = simpletlv_get_length(nested, 1, SIMPLETLV_TL); > > - g_assert_cmpint(length, ==, -1); > > + g_assert_cmpint((int)length, ==, -1); > > > > /* Simple short value to V */ > > length = simpletlv_get_length(nested, 1, SIMPLETLV_VALUE); > > - g_assert_cmpint(length, ==, -1); > > + g_assert_cmpint((int)length, ==, -1); > > } > > > > static void test_length_skipped(void) > > @@ -127,7 +127,7 @@ static void test_encode_simple(void) > > /* Encode simple short TLV with pre-allocated buffer (too > > short) */ > > result = g_malloc(2); > > result_len = simpletlv_encode(simple, 1, &result, 2, NULL); > > - g_assert_cmpint(result_len, ==, -1); > > + g_assert_cmpint((int)result_len, ==, -1); > > g_free(result); > > > > /* Encode only TL part */ > > @@ -195,18 +195,18 @@ static void test_encode_nested(void) > > /* Encode simple short TLV with pre-allocated buffer (too > > short) */ > > result = g_malloc(4); > > result_len = simpletlv_encode(nested, 1, &result, 4, NULL); > > - g_assert_cmpint(result_len, ==, -1); > > + g_assert_cmpint((int)result_len, ==, -1); > > g_free(result); > > > > /* Encode only TL part */ > > result = NULL; > > result_len = simpletlv_encode_tl(nested, 1, &result, 0, NULL); > > - g_assert_cmpint(result_len, ==, -1); > > + g_assert_cmpint((int)result_len, ==, -1); > > > > /* Encode only VALUE part (equals to the value itself) */ > > result = NULL; > > result_len = simpletlv_encode_val(nested, 1, &result, 0, > > NULL); > > - g_assert_cmpint(result_len, ==, -1); > > + g_assert_cmpint((int)result_len, ==, -1); > > } > > > > static void test_encode_skipped(void) > > -- > > 2.17.1 > > > > _______________________________________________ > > Spice-devel mailing list > > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > > https://lists.freedesktop.org/mailman/listinfo/spice-devel > > > -- Jakub Jelen Software Engineer Security Technologies Red Hat, Inc. _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel