Improve reusability of service_name and uuid components
To allow the service_name and uuid components to be reused
in constrained environments such as 'opteesp', the dependency
on sscanf (stdio.h) is removed and replaced with a portable
hex to byte and string to integer implementation. This allows
the service locator to be used in SPs.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I51bf7849d13568ef506c6244cab108e79b8bd09a
diff --git a/components/service/locator/test/sn_tests.cpp b/components/service/locator/test/sn_tests.cpp
index 4f8630a..50cce75 100644
--- a/components/service/locator/test/sn_tests.cpp
+++ b/components/service/locator/test/sn_tests.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -54,10 +54,10 @@
CHECK(sn_check_service(sn2, "secure-storage"));
CHECK_EQUAL(0, sn_get_service_instance(sn2));
- const char *sn3 = "sn:ffa:d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0:7";
+ const char *sn3 = "sn:ffa:d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0:77";
CHECK(sn_check_authority(sn3, "ffa"));
CHECK(sn_check_service(sn3, "d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0"));
- CHECK_EQUAL(7, sn_get_service_instance(sn3));
+ CHECK_EQUAL(77, sn_get_service_instance(sn3));
/* Check instance defaults to zero */
const char *sn4 = "sn:ffa:d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0";
@@ -88,4 +88,4 @@
CHECK_EQUAL(UUID_CANONICAL_FORM_LEN, sn_read_service(sn4, buf, sizeof(buf)));
CHECK(memcmp(buf, "d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0", UUID_CANONICAL_FORM_LEN + 1) == 0);
CHECK_EQUAL(UUID_CANONICAL_FORM_LEN, strlen(buf));
-}
\ No newline at end of file
+}