Merge branch 'master' into security

Signed-off-by: Kurtulus Oksuztepe <kurtulus.oksuztepe@adlinktech.com>

Conflicts:
	.travis.yml
This commit is contained in:
Kurtulus Oksuztepe 2019-10-29 17:40:33 +01:00
commit aa3b95ee7f
39 changed files with 273 additions and 257 deletions

View file

@ -117,6 +117,7 @@ list(APPEND headers
"${include_path}/dds/ddsrt/static_assert.h")
list(APPEND sources
"${source_path}/bswap.c"
"${source_path}/io.c"
"${source_path}/log.c"
"${source_path}/retcode.c"
@ -262,20 +263,9 @@ if(BUILD_TESTING)
endif()
install(
DIRECTORY "include/dds"
DIRECTORY
"include/"
${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev
FILES_MATCHING PATTERN "*.h")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/dds/version.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dds"
COMPONENT dev)
if(WIN32)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/getopt.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev)
endif()

View file

@ -0,0 +1,87 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef DDSRT_BSWAP_H
#define DDSRT_BSWAP_H
#include <stdint.h>
#include <stdlib.h>
#include "dds/ddsrt/endian.h"
#if defined (__cplusplus)
extern "C" {
#endif
inline uint16_t ddsrt_bswap2u (uint16_t x)
{
return (uint16_t) ((x >> 8) | (x << 8));
}
inline int16_t ddsrt_bswap2 (int16_t x)
{
return (int16_t) ddsrt_bswap2u ((uint16_t) x);
}
inline uint32_t ddsrt_bswap4u (uint32_t x)
{
return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
}
inline int32_t ddsrt_bswap4 (int32_t x)
{
return (int32_t) ddsrt_bswap4u ((uint32_t) x);
}
inline uint64_t ddsrt_bswap8u (uint64_t x)
{
const uint32_t newhi = ddsrt_bswap4u ((uint32_t) x);
const uint32_t newlo = ddsrt_bswap4u ((uint32_t) (x >> 32));
return ((uint64_t) newhi << 32) | (uint64_t) newlo;
}
inline int64_t ddsrt_bswap8 (int64_t x)
{
return (int64_t) ddsrt_bswap8u ((uint64_t) x);
}
#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
#define ddsrt_toBE2(x) ddsrt_bswap2 (x)
#define ddsrt_toBE2u(x) ddsrt_bswap2u (x)
#define ddsrt_toBE4(x) ddsrt_bswap4 (x)
#define ddsrt_toBE4u(x) ddsrt_bswap4u (x)
#define ddsrt_toBE8(x) ddsrt_bswap8 (x)
#define ddsrt_toBE8u(x) ddsrt_bswap8u (x)
#define ddsrt_fromBE2(x) ddsrt_bswap2 (x)
#define ddsrt_fromBE2u(x) ddsrt_bswap2u (x)
#define ddsrt_fromBE4(x) ddsrt_bswap4 (x)
#define ddsrt_fromBE4u(x) ddsrt_bswap4u (x)
#define ddsrt_fromBE8(x) ddsrt_bswap8 (x)
#define ddsrt_fromBE8u(x) ddsrt_bswap8u (x)
#else
#define ddsrt_toBE2u(x) (x)
#define ddsrt_toBE4(x) (x)
#define ddsrt_toBE4u(x) (x)
#define ddsrt_toBE8(x) (x)
#define ddsrt_toBE8u(x) (x)
#define ddsrt_fromBE2(x) (x)
#define ddsrt_fromBE2u(x) (x)
#define ddsrt_fromBE4(x) (x)
#define ddsrt_fromBE4u(x) (x)
#define ddsrt_fromBE8(x) (x)
#define ddsrt_fromBE8u(x) (x)
#endif
#if defined (__cplusplus)
}
#endif
#endif /* DDSRT_BSWAP_H */

View file

@ -17,10 +17,10 @@
#define DDS_VERSION_MINOR @CycloneDDS_VERSION_MINOR@
#define DDS_VERSION_PATCH @CycloneDDS_VERSION_PATCH@
#define DDS_VERSION_TWEAK @CycloneDDS_VERSION_TWEAK@
#define DDS_PROJECT_NAME_NOSPACE_CAPS "@CMAKE_PROJECT_NAME_CAPS@"
#define DDS_PROJECT_NAME_NOSPACE_SMALL "@CMAKE_PROJECT_NAME_SMALL@"
#define DDS_PROJECT_NAME_NOSPACE "@CMAKE_PROJECT_NAME@"
#define DDS_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
#define DDS_PROJECT_NAME_NOSPACE_CAPS "@PROJECT_NAME_CAPS@"
#define DDS_PROJECT_NAME_NOSPACE_SMALL "@PROJECT_NAME_SMALL@"
#define DDS_PROJECT_NAME_NOSPACE "@PROJECT_NAME@"
#define DDS_PROJECT_NAME "@PROJECT_NAME@"
#define DDS_HOST_NAME "@CMAKE_HOST_SYSTEM_NAME@"
#define DDS_TARGET_NAME "@CMAKE_SYSTEM_NAME@"

19
src/ddsrt/src/bswap.c Normal file
View file

@ -0,0 +1,19 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include "dds/ddsrt/bswap.h"
extern inline uint16_t ddsrt_bswap2u (uint16_t x);
extern inline uint32_t ddsrt_bswap4u (uint32_t x);
extern inline uint64_t ddsrt_bswap8u (uint64_t x);
extern inline int16_t ddsrt_bswap2 (int16_t x);
extern inline int32_t ddsrt_bswap4 (int32_t x);
extern inline int64_t ddsrt_bswap8 (int64_t x);