/*
- * Copyright (c) 2014 - 2019 Samsung Electronics Co.
+ * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace CKM {
namespace {
-const char *const HTTP_PREFIX = "http://";
-const size_t HTTP_PREFIX_LEN = sizeof(HTTP_PREFIX) / sizeof(HTTP_PREFIX[0]);
-const char *const HTTPS_PREFIX = "https://";
-const size_t HTTPS_PREFIX_LEN = sizeof(HTTPS_PREFIX) / sizeof(HTTPS_PREFIX[0]);
+template <size_t S>
+constexpr size_t staticStringLen(const char (&)[S]) {
+ static_assert(S, "static string of zero size");
+ return S-1;
+}
+
+const char HTTP_PREFIX[] = "http://";
+const size_t HTTP_PREFIX_LEN = staticStringLen(HTTP_PREFIX);
+const char HTTPS_PREFIX[] = "https://";
+const size_t HTTPS_PREFIX_LEN = staticStringLen(HTTPS_PREFIX);
typedef std::unique_ptr<BIO, std::function<void(BIO *)>> BioUniquePtr;