From 719408745786159cb0471477e015e155c14935b6 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sun, 26 May 2019 00:49:57 +0700 Subject: gsm48_decode_bcd_number2(): fix: return -ENOSPC on truncation The documentation of gsm48_decode_bcd_number2() clearly states that the output truncation is a erroneous case, so it should actually return negative in such cases. Let's return -ENOSPC. Change-Id: I75680f232001ba419a587fed4c24f32c70c3ad2b --- tests/gsm0408/gsm0408_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/gsm0408/gsm0408_test.c') diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index 3ccbf4dd..55c9b619 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -702,7 +702,7 @@ static const struct bcd_number_test { /* Decoding test (one 5 digits do not fit) */ .dec_hex = "0a21436587092143658709", .dec_ascii = "123456789012345", - .dec_rc = 0, + .dec_rc = -ENOSPC, /* Buffer length limitations */ .dec_buf_lim = 15 + 1, /* 5 digits less */ @@ -778,7 +778,7 @@ static void test_bcd_number_encode_decode() printf(" - Expected: (rc=%d) '%s'\n", test->dec_rc, test->dec_ascii); printf(" - Actual: (rc=%d) '%s'\n", - rc, rc == 0 ? buf_dec : "(none)"); + rc, (rc == 0 || rc == -ENOSPC) ? buf_dec : "(none)"); } } -- cgit v1.2.3