From d710787fa9b8d9c426ac89aa5fccccdfa0232eb1 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Mon, 18 Apr 2016 23:10:16 +0200 Subject: [PATCH 1/2] FS-9078 added #pragma for MSVC compiler --- .../libsofia-sip-ua/msg/msg_internal.h | 101 ++++++++++++++++-- 1 file changed, 91 insertions(+), 10 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h index d3e61ff0cb..a033837493 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h @@ -145,70 +145,148 @@ struct hep_ip6hdr { #endif /* HEPv3 types */ + +#if (defined __SUNPRO_CC) || defined(__SUNPRO_C) || defined(_MSC_VER) +#define PACKED +#endif +#ifndef PACKED +#define PACKED __attribute__ ((__packed__)) +#endif + +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk { uint16_t vendor_id; uint16_t type_id; uint16_t length; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk hep_chunk_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_uint8 { hep_chunk_t chunk; uint8_t data; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_uint8 hep_chunk_uint8_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_uint16 { hep_chunk_t chunk; uint16_t data; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_uint16 hep_chunk_uint16_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_uint32 { hep_chunk_t chunk; uint32_t data; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_uint32 hep_chunk_uint32_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_str { hep_chunk_t chunk; char *data; -} __attribute__((packed)); +} PACKED; +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_str hep_chunk_str_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_ip4 { hep_chunk_t chunk; struct in_addr data; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_ip4 hep_chunk_ip4_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif + struct hep_chunk_ip6 { hep_chunk_t chunk; struct in6_addr data; -} __attribute__((packed)); +} PACKED; + +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_chunk_ip6 hep_chunk_ip6_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif struct hep_chunk_payload { hep_chunk_t chunk; char *data; -} __attribute__((packed)); +} PACKED; +#ifdef _MSC_VER +#pragma pack(pop) +#elsif typedef struct hep_chunk_payload hep_chunk_payload_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif struct hep_ctrl { char id[4]; uint16_t length; -} __attribute__((packed)); +} PACKED; +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_ctrl hep_ctrl_t; +#ifdef _MSC_VER +#pragma pack(push, 1) +#endif struct hep_generic { hep_ctrl_t header; hep_chunk_uint8_t ip_family; @@ -219,7 +297,10 @@ struct hep_generic { hep_chunk_uint32_t time_usec; hep_chunk_uint8_t proto_t; hep_chunk_uint32_t capt_id; -} __attribute__((packed)); +} PACKED; +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct hep_generic hep_generic_t; From 024af441b89ca21c1d93f1c2f6e24f2e4b480aa8 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Tue, 19 Apr 2016 20:22:49 +0200 Subject: [PATCH 2/2] one push one pop --- .../libsofia-sip-ua/msg/msg_internal.h | 68 +------------------ 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h index a033837493..3b1ac9bb5e 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h @@ -163,130 +163,64 @@ struct hep_chunk { uint16_t length; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk hep_chunk_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_uint8 { hep_chunk_t chunk; uint8_t data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk_uint8 hep_chunk_uint8_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_uint16 { hep_chunk_t chunk; uint16_t data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk_uint16 hep_chunk_uint16_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_uint32 { hep_chunk_t chunk; uint32_t data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk_uint32 hep_chunk_uint32_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_str { hep_chunk_t chunk; char *data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif typedef struct hep_chunk_str hep_chunk_str_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_ip4 { hep_chunk_t chunk; struct in_addr data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk_ip4 hep_chunk_ip4_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif - struct hep_chunk_ip6 { hep_chunk_t chunk; struct in6_addr data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif - typedef struct hep_chunk_ip6 hep_chunk_ip6_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif struct hep_chunk_payload { hep_chunk_t chunk; char *data; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#elsif typedef struct hep_chunk_payload hep_chunk_payload_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif struct hep_ctrl { char id[4]; uint16_t length; } PACKED; -#ifdef _MSC_VER -#pragma pack(pop) -#endif typedef struct hep_ctrl hep_ctrl_t; -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif struct hep_generic { hep_ctrl_t header; hep_chunk_uint8_t ip_family; @@ -298,13 +232,13 @@ struct hep_generic { hep_chunk_uint8_t proto_t; hep_chunk_uint32_t capt_id; } PACKED; + #ifdef _MSC_VER #pragma pack(pop) #endif typedef struct hep_generic hep_generic_t; - /** Maximum size when streaming. */ #define MSG_SSIZE_MAX (USIZE_MAX)