From 7213a361b2c7519c69c8f362c53dbc9d99ec4657 Mon Sep 17 00:00:00 2001 From: timerix Date: Sun, 14 Aug 2022 14:29:03 +0600 Subject: [PATCH] removed PACK() macro --- src/Network/knPackage.h | 4 ++-- src/Network/knSocket.h | 4 ++-- src/base/std.h | 2 -- src/base/types.h | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Network/knPackage.h b/src/Network/knPackage.h index ab7aeca..f5396f0 100644 --- a/src/Network/knPackage.h +++ b/src/Network/knPackage.h @@ -10,9 +10,9 @@ extern "C" { #define KNPAC_MAX_DATA_SIZE (65535-sizeof(knPackage)+sizeof(uint8*)) -typedef enum knPacVersion PACK({ +typedef enum __attribute__((__packed__)) knPacVersion { knPac_V1 -}) knPacVersion; +} knPacVersion; static const char knPacHeader[5]={'k','n','p','a','c'}; diff --git a/src/Network/knSocket.h b/src/Network/knSocket.h index 337f012..18fb319 100644 --- a/src/Network/knSocket.h +++ b/src/Network/knSocket.h @@ -9,9 +9,9 @@ extern "C" { #include "knPackage.h" -typedef enum knSocketType PACK({ +typedef enum __attribute__((__packed__)) knSocketType { knSocketType_TCP, knSocketType_UDP -}) knSocketType; +} knSocketType; typedef struct knSocket { knSocketType type; diff --git a/src/base/std.h b/src/base/std.h index 65c25fb..6024772 100644 --- a/src/base/std.h +++ b/src/base/std.h @@ -50,8 +50,6 @@ extern "C" { #endif -#define PACK(...) __VA_ARGS__ __attribute__((__packed__)) - #if __cplusplus } #endif \ No newline at end of file diff --git a/src/base/types.h b/src/base/types.h index 49df7da..e34d95f 100644 --- a/src/base/types.h +++ b/src/base/types.h @@ -16,7 +16,7 @@ typedef int64_t int64; typedef uint64_t uint64; typedef float float32; typedef double float64; -typedef enum my_type PACK({ +typedef enum __attribute__((__packed__)) my_type { Null, Float32, Float64, Char, Bool, UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64, UInt8Ptr, Int8Ptr, UInt16Ptr, Int16Ptr, UInt32Ptr, Int32Ptr, UInt64Ptr, Int64Ptr, @@ -25,7 +25,7 @@ typedef enum my_type PACK({ AutoarrInt8Ptr, AutoarrUInt8Ptr, AutoarrInt16Ptr, AutoarrUInt16Ptr, AutoarrInt32Ptr, AutoarrUInt32Ptr, AutoarrInt64Ptr, AutoarrUInt64Ptr, AutoarrUnitypePtr, AutoarrKVPairPtr, knSocketPtr -}) my_type; +} my_type; #define my_type_last knSocketPtr const char* my_type_name(my_type t);