File mstflint-common_int_handling.patch of Package mstflint
---
common/compatibility.h | 76 ---------------------------------
common/int_handling.h | 92 +++++++++++++++++++++++++++++++++++++++++
common/tools_arch.h | 77 ++++++++++++++++++++++++++++++++++
mtcr_ul/packets_common.h | 57 -------------------------
tools_layouts/adb_to_c_utils.h | 74 +-------------------------------
5 files changed, 174 insertions(+), 202 deletions(-)
Index: common/compatibility.h
===================================================================
--- common/compatibility.h.orig 2016-02-22 10:39:48.917852217 +0100
+++ common/compatibility.h 2016-02-22 10:39:48.945852057 +0100
@@ -46,81 +46,7 @@
#define U64L "ll"
#endif
-
-/* define macros to the architecture of the CPU */
-#if defined(__linux) || defined(__FreeBSD__) /* __linux || __FreeBSD__ */
-# if defined(__i386__)
-# define ARCH_x86
-# elif defined(__x86_64__)
-# define ARCH_x86_64
-# elif defined(__ia64__)
-# define ARCH_ia64
-# elif defined(__PPC64__)
-# define ARCH_ppc64
-# elif defined(__PPC__)
-# define ARCH_ppc
-# elif defined(__aarch64__)
-# define ARCH_arm64
-# elif defined(__s390__)
-# define ARCH_s390
-# elif defined(__s390x__)
-# define ARCH_s390x
-# else
-# error Unknown CPU architecture using the linux OS
-# endif
-#elif defined(__MINGW32__) || defined(__MINGW64__) /* Windows MINGW */
-# if defined(__MINGW32__)
-# define ARCH_x86
-# elif defined(__MINGW64__)
-# define ARCH_x86_64
-# else
-# error Unknown CPU architecture using the windows-mingw OS
-# endif
-#elif defined(_WIN32) || defined(_WIN64) /* Windows */
-# if defined(_WIN32)
-# define ARCH_x86
-# elif defined(_WIN64)
-# define ARCH_x86_64
-# else
-# error Unknown CPU architecture using the windows OS
-# endif
-#else /* Unknown */
-# error Unknown OS
-#endif
-
-/* define macros for print fields */
-#define U32D_FMT "%u"
-#define U32H_FMT "0x%08x"
-#define UH_FMT "0x%x"
-#define STR_FMT "%s"
-#define U16H_FMT "0x%04x"
-#define U8H_FMT "0x%02x"
-
-#if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD) || defined(ARCH_s390)
-# if defined(__MINGW32__) || defined(__MINGW64__)
-# include <inttypes.h>
-# define U64D_FMT "0x%"PRId64
-# define U64H_FMT "0x%"PRIx64
-# define U64H_FMT_GEN ""PRIx64
-# define U48H_FMT "0x%"PRIx64
-# define U64D_FMT_GEN ""PRId64
-# else
-# define U64D_FMT "%llu"
-# define U64H_FMT "0x%016llx"
-# define U64H_FMT_GEN "llx"
-# define U48H_FMT "0x%012llx"
-# define U64D_FMT_GEN "llu"
-# endif
-#elif defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_s390x)
-# define U64D_FMT "%lu"
-# define U64H_FMT "0x%016lx"
-# define U48H_FMT "0x%012lx"
-# define U64H_FMT_GEN "lx"
-# define U64D_FMT_GEN "lu"
-#else
-# error Unknown architecture
-#endif /* ARCH */
-
+#include "common/int_handling.h"
/* define msleep(x) - sleeps for x milliseconds */
#if defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__)
Index: common/int_handling.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ common/int_handling.h 2016-02-22 10:52:38.509472915 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) Feb 2016 SUSE. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef INT_HANDLING_H
+#define INT_HANDLING_H
+
+/* define macros for print fields */
+#define U32D_FMT "%u"
+#define U32H_FMT "0x%08x"
+#define UH_FMT "0x%x"
+#define STR_FMT "%s"
+#define U16H_FMT "0x%04x"
+#define U8H_FMT "0x%02x"
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#include "common/tools_arch.h"
+
+/* define macros for print fields */
+#define U32D_FMT "%u"
+#define U32H_FMT "0x%08x"
+#define UH_FMT "0x%x"
+#define STR_FMT "%s"
+#define U16H_FMT "0x%04x"
+#define U8H_FMT "0x%02x"
+
+
+#if HAVE_STDINT_H && HAVE_INTTYPES_H
+# define U64D_FMT "0x%"PRId64
+# define U64H_FMT "0x%"PRIx64
+# define U64H_FMT_GEN ""PRIx64
+# define U48H_FMT "0x%"PRIx64
+# define U64D_FMT_GEN ""PRId64
+#else
+# include <types.h>
+# if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD) || defined(ARCH_s390)
+# define U64D_FMT "%llu"
+# define U64H_FMT "0x%016llx"
+# define U64H_FMT_GEN "llx"
+# define U48H_FMT "0x%012llx"
+# define U64D_FMT_GEN "llu"
+# elif defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_s390x)
+# define U64D_FMT "%lu"
+# define U64H_FMT "0x%016lx"
+# define U48H_FMT "0x%012lx"
+# define U64H_FMT_GEN "lx"
+# define U64D_FMT_GEN "lu"
+# else
+# error Unknown architecture /* ARCH */
+# endif
+#endif
+
+#endif /* INT_HANDLING_H */
Index: common/tools_arch.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ common/tools_arch.h 2016-02-22 10:51:17.589933567 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) Feb 2016 SUSE GmbH. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef TOOLS_ARCH_H
+#define TOOLS_ARCH_H
+
+/* define macros to the architecture of the CPU */
+#if defined(__linux) || defined(__FreeBSD__) /* __linux || __FreeBSD__ */
+# if defined(__i386__)
+# define ARCH_x86
+# elif defined(__x86_64__)
+# define ARCH_x86_64
+# elif defined(__ia64__)
+# define ARCH_ia64
+# elif defined(__PPC64__)
+# define ARCH_ppc64
+# elif defined(__PPC__)
+# define ARCH_ppc
+# elif defined(__aarch64__)
+# define ARCH_arm64
+# elif defined(__s390__)
+# define ARCH_s390
+# elif defined(__s390x__)
+# define ARCH_s390x
+# else
+# error Unknown CPU architecture using the linux OS
+# endif
+#elif defined(__MINGW32__) || defined(__MINGW64__) /* Windows MINGW */
+# if defined(__MINGW32__)
+# define ARCH_x86
+# elif defined(__MINGW64__)
+# define ARCH_x86_64
+# else
+# error Unknown CPU architecture using the windows-mingw OS
+# endif
+#elif defined(_WIN32) || defined(_WIN64) /* Windows */
+# if defined(_WIN32)
+# define ARCH_x86
+# elif defined(_WIN64)
+# define ARCH_x86_64
+# else
+# error Unknown CPU architecture using the windows OS
+# endif
+#else /* Unknown */
+# error Unknown OS
+#endif
+
+#endif
Index: mtcr_ul/packets_common.h
===================================================================
--- mtcr_ul/packets_common.h.orig 2016-02-22 10:39:48.921852194 +0100
+++ mtcr_ul/packets_common.h 2016-02-22 10:39:48.945852057 +0100
@@ -38,6 +38,7 @@
#include <sys/types.h>
#include "compatibility.h"
+#include "int_handling.h"
#ifndef __WIN__
#include <netinet/in.h>
@@ -131,62 +132,6 @@
#define BE64_TO_CPU(x) (x)
#endif
-
-/************************************/
-/* define macros to the architecture of the CPU */
-#if defined(__linux) || defined(__FreeBSD__)
-# if defined(__i386__)
-# define ARCH_x86
-# elif defined(__x86_64__)
-# define ARCH_x86_64
-# elif defined(__ia64__)
-# define ARCH_ia64
-# elif defined(__PPC64__)
-# define ARCH_ppc64
-# elif defined(__PPC__)
-# define ARCH_ppc
-# elif defined(__aarch64__)
-# define ARCH_arm64
-# elif defined(__s390__)
-# define ARCH_s390
-# elif defined(__s390x__)
-# define ARCH_s390x
-# else
-# error Unknown CPU architecture using the linux OS
-# endif
-#elif defined(_WIN32)
-
-//# error Windows OS need to define macros
-#else /* __linux || __FreeBSD__ */
-# error Unknown OS
-#endif /* __linux || __FreeBSD__ */
-
-
-/**********************************/
-/* define macros for print fields */
-//#if defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__) || defined(ARCH_s390x)
-/*
-#if !defined(UEFI_BUILD) && (defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__)) || defined(ARCH_s390x)
-# define U64H_FMT "0x%016lx"
-# define U64D_FMT "%lu"
-# define U32H_FMT "0x%08x"
-# define U16H_FMT "0x%04x"
-# define U8H_FMT "0x%02x"
-# define U32D_FMT "%u"
-# define STR_FMT "%s"
-#elif defined(ARCH_x86) || defined(ARCH_ppc) || defined(__MINGW32__) || defined(UEFI_BUILD) || defined(ARCH_s390)
-# define U64H_FMT "0x%016llx"
-# define U64D_FMT "%llu"
-# define U32H_FMT "0x%08x"
-# define U16H_FMT "0x%04x"
-# define U8H_FMT "0x%02x"
-# define U32D_FMT "%u"
-# define STR_FMT "%s"
-#else // ARCH
-# error Unknown architecture
-#endif // ARCH
-*/
-
/**********************************/
void push_to_buff_64(u_int8_t *buff, u_int32_t bit_offset, u_int64_t field_value);
void push_to_buff_32(u_int8_t *buff, u_int32_t bit_offset, u_int32_t field_value);
Index: tools_layouts/adb_to_c_utils.h
===================================================================
--- tools_layouts/adb_to_c_utils.h.orig 2016-02-22 10:39:48.921852194 +0100
+++ tools_layouts/adb_to_c_utils.h 2016-02-22 10:39:48.945852057 +0100
@@ -122,80 +122,12 @@ extern "C" {
#endif
-
-/* define macros to the architecture of the CPU */
-#if defined(__linux) || defined(__FreeBSD__) /* __linux || __FreeBSD__ */
-# if defined(__i386__)
-# define ARCH_x86
-# elif defined(__x86_64__)
-# define ARCH_x86_64
-# elif defined(__ia64__)
-# define ARCH_ia64
-# elif defined(__PPC64__)
-# define ARCH_ppc64
-# elif defined(__PPC__)
-# define ARCH_ppc
-# elif defined(__aarch64__)
-# define ARCH_arm64
-# elif defined(__s390__)
-# define ARCH_s390
-# elif defined(__s390x__)
-# define ARCH_s390x
-# else
-# error Unknown CPU architecture using the linux OS
-# endif
-#elif defined(__MINGW32__) || defined(__MINGW64__) /* Windows MINGW */
-# if defined(__MINGW32__)
-# define ARCH_x86
-# elif defined(__MINGW64__)
-# define ARCH_x86_64
-# else
-# error Unknown CPU architecture using the windows-mingw OS
-# endif
-#elif defined(_WIN32) || defined(_WIN64) /* Windows */
-# if defined(_WIN32)
-# define ARCH_x86
-# elif defined(_WIN64)
-# define ARCH_x86_64
-# else
-# error Unknown CPU architecture using the windows OS
-# endif
-#else /* Unknown */
-# error Unknown OS
-#endif
-
-
-/* define macros for print fields */
-#define U32D_FMT "%u"
-#define U32H_FMT "0x%08x"
-#define UH_FMT "0x%x"
-#define STR_FMT "%s"
-#define U16H_FMT "0x%04x"
-#define U8H_FMT "0x%02x"
-
-#if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD) || defined(ARCH_s390)
-# if defined(__MINGW32__) || defined(__MINGW64__)
-# include <inttypes.h>
-# define U64D_FMT "0x%"PRId64
-# define U64H_FMT "0x%"PRIx64
-# define U48H_FMT "0x%"PRIx64
-# else
-# define U64D_FMT "%llu"
-# define U64H_FMT "0x%016llx"
-# define U48H_FMT "0x%012llx"
-# endif
-#elif defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_s390x)
-# define U64D_FMT "%lu"
-# define U64H_FMT "0x%016lx"
-# define U48H_FMT "0x%012lx"
-#else
-# error Unknown architecture
-#endif /* ARCH */
+#include "common/int_handling.h"
#if !defined(_WIN32) && !defined(_WIN64) /* Linux */
#include <sys/types.h>
-#elif defined(__MINGW32__) || defined(__MINGW64__) /* windows - mingw */
+#elif defined(__MINGW32__) || defined(__MINGW64__) || HAVE_STDINT_H /* windows - mingw */
#include <stdint.h>
#ifndef MFT_TOOLS_VARS
#define MFT_TOOLS_VARS
@@ -203,7 +135,7 @@ extern "C" {
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
- #endif
+ #endif
#else /* Windows */
typedef __int8 int8_t;
typedef unsigned __int8 u_int8_t;