- Libc asserts were already used in few places. Now it's unified.
- Libc asserts are disabled in release builds unlike dpl ones.
- Code coverage is improved.
Change-Id: Ie241b997433b2286d1b6c3f5e24571af5bf5809f
IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
ADD_DEFINITIONS("-DTIZEN_DEBUG_ENABLE")
ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
+ELSE (CMAKE_BUILD_TYPE MATCHES "DEBUG")
+ ADD_DEFINITIONS("-DNDEBUG=1")
ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
SET(TARGET_KEY_MANAGER "key-manager")
${KEY_MANAGER_PATH}/initial-values/NoCharactersHandler.cpp
${KEY_MANAGER_PATH}/initial-values/xml-utils.cpp
${KEY_MANAGER_PATH}/initial-values/initial-value-loader.cpp
- ${KEY_MANAGER_PATH}/dpl/core/src/assert.cpp
${KEY_MANAGER_PATH}/dpl/db/src/sql_connection.cpp
${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
${KEY_MANAGER_PATH}/sqlcipher/sqlcipher.c
${COMMON_PATH}/dpl/log/src/log.cpp
${COMMON_PATH}/dpl/log/src/old_style_log_provider.cpp
${COMMON_PATH}/dpl/log/src/journal_log_provider.cpp
- ${COMMON_PATH}/dpl/core/src/assert.cpp
${COMMON_PATH}/dpl/core/src/binary_queue.cpp
${COMMON_PATH}/dpl/core/src/colors.cpp
${COMMON_PATH}/dpl/core/src/exception.cpp
* @version 1.0
* @brief Certificate implementation.
*/
+#include <cassert>
+
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pem.h>
#include <dpl/log/log.h>
-#include <dpl/assert.h>
#include <key-impl.h>
#include <certificate-impl.h>
CertificateImpl::CertificateImpl(X509 *x509, bool duplicate)
{
- Assert(x509);
+ assert(x509);
if (duplicate)
m_x509 = X509_dup(x509);
/*
- * Copyright (c) 2000 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2020 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.
#include <openssl/obj_mac.h>
#include <ckm/ckm-error.h>
-#include <assert.h>
#include <dpl/log/log.h>
#include <generic-backend/exception.h>
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file assert.h
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of assert
- */
-#ifndef CENT_KEY_ASSERT_H
-#define CENT_KEY_ASSERT_H
-
-#include <dpl/noreturn.h>
-#include <string>
-
-namespace CKM {
-// Assertion handler procedure
-// Do not call directly
-// Always use Assert macro
-CENT_KEY_NORETURN void AssertProc(const char *condition,
- const char *file,
- int line,
- const char *function);
-} // namespace CKM
-
-#define Assert(Condition) do { if (!(Condition)) { CKM::AssertProc(#Condition, \
- __FILE__, \
- __LINE__, \
- __FUNCTION__); \
- } } while (0)
-
-#define AssertMsg(Condition, Msg) \
- do { \
- if (!(Condition)) { \
- CKM::AssertProc( \
- (std::string(std::string(#Condition)+" ") + Msg).c_str(), \
- __FILE__, __LINE__, __FUNCTION__); \
- } \
- } while (0)
-
-#endif // CENT_KEY_ASSERT_H
+++ /dev/null
-/*
- * Copyright (c) 2011 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file noreturn.h
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of noreturn
- */
-#ifndef CENT_KEY_NORETURN_H
-#define CENT_KEY_NORETURN_H
-
-#define CENT_KEY_NORETURN __attribute__((__noreturn__))
-
-#endif // CENT_KEY_NORETURN_H
+++ /dev/null
-/*
- * Copyright (c) 2011 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file assert.cpp
- * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief This file is the implementation file of assert
- */
-#include "dpl/assert.h"
-
-#include <iostream>
-#include <cstdlib>
-#include <dpl/log/log.h>
-
-namespace CKM {
-void AssertProc(const char *condition,
- const char *file,
- int line,
- const char *function)
-{
- try {
- LogError(
- "################################################################################"
- << std::endl <<
- "### CKM assertion failed! ###"
- << std::endl <<
- "################################################################################"
- << std::endl <<
- "### Condition: " << condition << std::endl <<
- "### File: " << file << std::endl <<
- "### Line: " << line << std::endl <<
- "### Function: " << function <<
- "################################################################################");
- } catch (...) {
- // Just ignore possible double errors
- }
-
- // Fail with c-library abort
- abort();
-}
-} // namespace CKM
*/
#include <stddef.h>
#include <dpl/binary_queue.h>
-#include <dpl/assert.h>
+#include <cassert>
#include <algorithm>
#include <functional>
#include <malloc.h>
size_t bytesLeft = bufferSize;
void *ptr = buffer;
BucketList::const_iterator bucketIterator = m_buckets.begin();
- Assert(m_buckets.end() != bucketIterator);
+ assert(m_buckets.end() != bucketIterator);
// Flatten data
while (bytesLeft > 0) {
deleter(dataDeleter),
param(userParam)
{
- Assert(data != NULL);
- Assert(deleter != NULL);
+ assert(data != NULL);
+ assert(deleter != NULL);
}
BinaryQueue::Bucket::~Bucket()
void BinaryQueue::VisitBuckets(BucketVisitor *visitor) const
{
- Assert(visitor != NULL);
+ assert(visitor != NULL);
// Visit all buckets
std::for_each(m_buckets.begin(), m_buckets.end(), BucketVisitorCall(visitor));
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2020 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.
#include <boost/optional.hpp>
#include <dpl/log/log.h>
#include <sqlcipher.h>
-#include <dpl/assert.h>
#include <stdint.h>
#include <dpl/raw-buffer.h>
#include <noncopyable.h>
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2020 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.
*/
#include <stddef.h>
#include <dpl/db/naive_synchronization_object.h>
-#include <dpl/assert.h>
#include <time.h>
+#include <cassert>
namespace {
unsigned int seed = time(NULL);
if (nanosleep(&requestedTime, &remainingTime) == 0)
break;
- int error = errno;
- Assert(error == EINTR);
+ assert(errno == EINTR);
requestedTime = remainingTime;
}
/*
- * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014-2020 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.
#include <stddef.h>
#include <dpl/db/sql_connection.h>
#include <dpl/db/naive_synchronization_object.h>
-#include <dpl/assert.h>
#include <dpl/scoped_ptr.h>
#include <unistd.h>
+#include <cassert>
#include <cstdio>
#include <cstdarg>
#include <memory>
m_masterConnection(connection),
m_stmt(NULL)
{
- Assert(connection != NULL);
+ assert(connection != NULL);
// Notify all after potentially synchronized database connection access
ScopedNotifyAll notifyAll(connection->m_synchronizationObject.get());
return;
}
- AssertMsg(rawPassOld.size() == SQLCIPHER_RAW_DATA_SIZE &&
- rawPassNew.size() == SQLCIPHER_RAW_DATA_SIZE,
- "Binary data for raw password should be 32 bytes long.");
+ // Binary data for raw password should be 32 bytes long.
+ assert(rawPassOld.size() == SQLCIPHER_RAW_DATA_SIZE &&
+ rawPassNew.size() == SQLCIPHER_RAW_DATA_SIZE);
+
// sqlcipher3_rekey requires for key to be already set
if (!m_isKeySet)
LogPedantic("Disconnecting from DB...");
// All stored data commands must be deleted before disconnect
- AssertMsg(m_dataCommandsCount == 0,
- "All stored procedures must be deleted"
- " before disconnecting SqlConnection");
+ assert(m_dataCommandsCount == 0);
int result;
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2020 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.
#include <stdexcept>
-#include <cassert>
-
#include <dpl/log/log.h>
#include <dpl/singleton_safe_impl.h>
#include <dpl/log/old_style_log_provider.h>
/*
- * Copyright (c) 2000 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2020 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.
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
+#include <cassert>
#include <systemd/sd-daemon.h>
#include <dpl/errno_string.h>
#include <dpl/log/log.h>
-#include <dpl/assert.h>
#include <smack-check.h>
#include <socket-manager.h>
int ret = select(m_maxDesc + 1, &readSet, &writeSet, NULL, ptrTimeout);
if (0 == ret) { // timeout
- Assert(!m_timeoutQueue.empty());
+ assert(!m_timeoutQueue.empty());
Timeout pqTimeout = m_timeoutQueue.top();
m_timeoutQueue.pop();
/*
- * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2020 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.
*/
#include <thread>
+#include <cassert>
#include <dpl/log/log.h>
${CMAKE_CURRENT_SOURCE_DIR}/encryption-scheme/smack-access.cpp
${CMAKE_CURRENT_SOURCE_DIR}/encryption-scheme/scheme-test.cpp
- ${KEY_MANAGER_PATH}/dpl/core/src/assert.cpp
${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
${KEY_MANAGER_PATH}/dpl/db/src/sql_connection.cpp
${KEY_MANAGER_PATH}/service/db-crypto.cpp
${KEY_MANAGER_PATH}/crypto/sw-backend/internals.cpp
${KEY_MANAGER_PATH}/crypto/sw-backend/obj.cpp
${KEY_MANAGER_PATH}/crypto/sw-backend/store.cpp
- ${KEY_MANAGER_PATH}/dpl/core/src/assert.cpp
${KEY_MANAGER_PATH}/dpl/core/src/colors.cpp
${KEY_MANAGER_PATH}/dpl/core/src/errno_string.cpp
${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
#include <vector>
#include <string>
#include <sstream>
-#include <assert.h>
#include <sqlcipher.h>
#include <ckm/ckm-type.h>
#include <errno.h>
${KEY_MANAGER_PATH}/crypto/sw-backend/internals.cpp
${KEY_MANAGER_PATH}/crypto/sw-backend/obj.cpp
${KEY_MANAGER_PATH}/crypto/sw-backend/store.cpp
- ${KEY_MANAGER_PATH}/dpl/core/src/assert.cpp
${KEY_MANAGER_PATH}/dpl/db/src/naive_synchronization_object.cpp
${KEY_MANAGER_PATH}/dpl/db/src/sql_connection.cpp
${KEY_MANAGER_PATH}/initial-values/BufferHandler.cpp