Make tones-dir option available for all interface (interface.conf)
[lcr.git] / sofia-sip-gcc-4.8.patch
1 From cfeb1a1ee25865b2d8ba7b8a5ea4ad815077b353 Mon Sep 17 00:00:00 2001
2 From: Arsen Chaloyan <achaloyan@gmail.com>
3 Date: Wed, 23 Apr 2014 13:33:03 -0700
4 Subject: [PATCH] Comply with the aggressive-loop-optimization introduced in
5  gcc 4.8.
6
7 The problem is in gcc loop optimizers which detect a loop operating with out of bounds memory and then optimize it with something undefined since, according to the C standard, out of bounds behavior is undefined. The problem could have been addressed by using the new option -fno-aggressive-loop-optimization as well.
8 ---
9  libsofia-sip-ua/msg/msg_parser.c | 16 +++++++++-------
10  1 file changed, 9 insertions(+), 7 deletions(-)
11
12 diff --git a/libsofia-sip-ua/msg/msg_parser.c b/libsofia-sip-ua/msg/msg_parser.c
13 index 6f796eb..76185f3 100644
14 --- a/libsofia-sip-ua/msg/msg_parser.c
15 +++ b/libsofia-sip-ua/msg/msg_parser.c
16 @@ -2530,8 +2530,6 @@ int msg_header_prepend(msg_t *msg,
17  msg_header_t **
18  msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
19  {
20 -  int i;
21 -
22    assert(mc && hc);
23  
24    if (mc == NULL || hc == NULL)
25 @@ -2543,12 +2541,16 @@ msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
26        if (mc->mc_hash[j].hr_class == hc) {
27         return (msg_header_t **)((char *)mo + mc->mc_hash[j].hr_offset);
28        }
29 -  }
30 -  else
31 +  } else {
32      /* Header has no name. */
33 -    for (i = 0; i <= 6; i++)
34 -      if (hc->hc_hash == mc->mc_request[i].hr_class->hc_hash)
35 -       return (msg_header_t **)((char *)mo + mc->mc_request[i].hr_offset);
36 +    if (hc->hc_hash == mc->mc_request[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_request[0].hr_offset);
37 +    if (hc->hc_hash == mc->mc_status[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_status[0].hr_offset);
38 +    if (hc->hc_hash == mc->mc_separator[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_separator[0].hr_offset);
39 +    if (hc->hc_hash == mc->mc_payload[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_payload[0].hr_offset);
40 +    if (hc->hc_hash == mc->mc_unknown[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_unknown[0].hr_offset);
41 +    if (hc->hc_hash == mc->mc_error[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_error[0].hr_offset);
42 +    if (hc->hc_hash == mc->mc_multipart[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_multipart[0].hr_offset);
43 +  }
44  
45    return NULL;
46  }
47 diff --git a/libsofia-sip-ua/sip/sofia-sip/sip.h b/libsofia-sip-ua/sip/sofia-sip/sip.h
48 index 793af0e..e8f3a4b 100644
49 --- a/libsofia-sip-ua/sip/sofia-sip/sip.h
50 +++ b/libsofia-sip-ua/sip/sofia-sip/sip.h
51 @@ -26,6 +26,8 @@
52  /** Defined when <sofia-sip/sip.h> has been included. */
53  #define SIP_H
54  
55 +#define SOFIA_SIP_GCC_4_8_PATCH_APLLIED
56 +
57  /**@file sofia-sip/sip.h
58   *
59   * SIP objects.